All pastes #739606 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-10-17 10:09 UTC
rendered paste body
Communicating Directly With The VST Host

You can bypass the SynthEdit SDK, and talk directly to the VST Host (Cubase or whatever).  This example gets the Host Vendor name.

  // testing direct call to VST Host (getting host vendor in this example)
  se_call_vst_host_params params;
  memset( &params, 0, sizeof(params) ); // clear structure

  char host_name[100] = ""; // a string to store the result of this query

  params.opcode = 32; // audioMasterGetVendorString;
  params.index = 0;
  params.value = 0;
  params.ptr = host_name;
  params.opt = 0;

  // when running in SynthEdit, you get a result -1, indicates no VST Host
  long res = CallHost(seaudioMasterCallVstHost, 0,0, &params);

Normally you use the opcode name (audioMasterGetVendorString) directly, I have used it's value (32) instead, to allow this example to compile without the VST SDK.

The Opcodes available are listed in the VST SDK.  Get it at.

http://ygrabit.steinberg.de/users/ygrabit/public_html/

(or Google it).  The available opcodes are listed in files aeffect.h and aeffectx.h

For questions on the VST SDK sign up to the VST Mailing List
[/quote]

2. I don't think so.
3. Because synths usually don't have audio inputs. It's logical.
4. You could use CreateSharedLookup. The info is also removed from synthedit.com. Here's it:

[quote]
Sharing Data between Modules - CreateSharedLookup

// in module.h header file...
float *m_lookup_table;

// in module.cpp ...
#define TABLE_SIZE 100;

char table_name[40];
sprintf(table_name, "SE wave shaper %x curve", Handle() );
bool need_initialise = CreateSharedLookup( table_name, &m_lookup_table, -1, TABLE_SIZE );

if( need_initialise == true )
{
    for( int i = 0 ; i < TABLE_SIZE ; i++ )
    {
        m_lookup_table[i] = whatever; // fill your table with some data
    }
}  

CreateSharedLookup() is for when your module needs a large table (e.g. an oscillator wavetable), and you want to share that table between all instances of the module.  This much more efficient than having each oscillator create it's own copy of the table.

  Each table must have a unique name, if you look at the waveshaper example, you will see the name, e.g. "SE wave shaper curve 23".  23 is the handle of that instance of the waveshaper, it is unique for each waveshaper.  i.e. if you have two different waveshapers, they each get their own table.  For an Oscillator, you may want to share the table between all oscillators, for example, SE's internal Osc shares it's sine wave table between all oscillators including any PD Oscs.  in this case don't use the handle, e.g. "my osc sine wave".

  Your module needs a pointer to the table, SE will create the table for you. CreateSharedLookup's return value tells you if you're creating the table for the very first time or not.  The idea being that the first module to use the table needs to initialize it, any subsequent modules can skip that step. 

The 3rd parameter to CreateSharedLookup is the sample rate.  If the sample rate changes SynthEdit will re-initialise your module and CreateSharedLookup returns true to indicate you should re-initialize the table.  If your table doesn't depend on the samplerate, pass -1 as the samplerate.

The 4th parameter is the size of the table, specified in 'floats' ( a float variable is 4 bytes in size).  i.e. a table size of 1 = 4 bytes.  For example to create a table size of 100 bytes specify size of 25.

Use any type of data you need in the table (int, float, whatever).  It doesn't actually have to be a 'table', you could store a 'struct'.  organise it any way you require.

See the se_waveshaper for an example of a shared table.