Compare commits

...

12 Commits

16 changed files with 528 additions and 23 deletions

3
.gitignore vendored
View File

@ -10,4 +10,5 @@ vstsdk2.4
# files # files
build/Release64/pdvstdebug.txt build/Release64/pdvstdebug.txt
build/Release32/pdvstdebug.txt

View File

@ -8,8 +8,8 @@ or higher.
# How does it work ? # How does it work ?
PdVst consists of two main parts : PdVst consists of two main parts :
* a vst-plugin (pdvst-template32.dll, pdvst-template64.dll) to place in your favorite vst folder. * a vst-plugin (`pdvst-template.dll`) to place in your favorite vst folder.
* a custom external scheduler (vstschedlib.dll) to copy in the pure-data /bin folder * a custom external scheduler (`vstschedlib.dll`) to copy in the pure-data /bin folder
When a PdVst plugin is opened by the host application, a setup file (*.pdv) is read to determine When a PdVst plugin is opened by the host application, a setup file (*.pdv) is read to determine
information about the plugin, such as the Pd patch file to use, the number of parameters, etc... information about the plugin, such as the Pd patch file to use, the number of parameters, etc...
@ -20,7 +20,7 @@ An instance of Pd.exe is started and opens the Pd patch file whose name was foun
This new version doesn't need a custom version of pure-data. You can use your current pure-data This new version doesn't need a custom version of pure-data. You can use your current pure-data
installation (>= Pd-0.52) with your favorite externals). installation (>= Pd-0.52) with your favorite externals).
1) According to your pd version (32 or 64 bits), go to the folder pd-scheduler32 or pd-scheduler64. 1) According to your pd version (32 or 64 bits), go to the folder `Release32` or `Release64`.
Copy `vstschedlib.dll` to `\bin` directory of your current pure-data installation Copy `vstschedlib.dll` to `\bin` directory of your current pure-data installation
2) Copy your plugin `.dll` file (e.g. `Pd_Gain.dll`) to the vst plugins directory 2) Copy your plugin `.dll` file (e.g. `Pd_Gain.dll`) to the vst plugins directory
@ -49,9 +49,9 @@ Copy `vstschedlib.dll` to `\bin` directory of your current pure-data installatio
files (`.pd` files, external Pd library `.dll` files, etc.) as specified above (section files (`.pd` files, external Pd library `.dll` files, etc.) as specified above (section
"Installation"). "Installation").
* Make a copy of the `pdvst-template32.dll` / `pdvst-template64.dll` file and * Make a copy of the `pdvst-template.dll` file and
rename the same as the plugin and `.pdv` file (e.g. for a plugin named rename the same as the plugin and `.pdv` file (e.g. for a plugin named
Pd_Gain you would copy `pdvst-template32.dll` to a new file named `Pd_Gain.dll`). Pd_Gain you would copy `pdvst-template.dll` to a new file named `Pd_Gain.dll`).
Move your new plugin `.dll` file to the vst plugins folder of the application. Move your new plugin `.dll` file to the vst plugins folder of the application.
# The .pdv Setup File- # The .pdv Setup File-
@ -104,7 +104,13 @@ For an example, see Pd_Gain.pdv.
PARAMETER<integer> = <float> PARAMETER<integer> = <float>
Defines the parameter values for the last declared program. <float> must be Defines the parameter values for the last declared program. <float> must be
between 0 and 1 inclusive. between 0 and 1 inclusive.
PROGRAMSARECHUNKS = <TRUE/FALSE>
Save and Get Pd lists in .fxp file via ([s svstdata] and [r rvstdata])
Some hosts don't work correctly with this.
If in doubt just use FALSE.
# Pd/VST audio/midi Communication # Pd/VST audio/midi Communication
@ -128,16 +134,18 @@ For purposes such as GUI interaction and VST automation, your patch may need to
further with the VST host. Special Pd send/receive symbols can be used in your Pd patch. further with the VST host. Special Pd send/receive symbols can be used in your Pd patch.
For an example, see the pd-gain.pd file. For an example, see the pd-gain.pd file.
* rvstparameter<integer> : Use this symbol to receive parameter values from the VST host. Values will be floats between 0 and 1 inclusive. * `rvstparameter<integer>` : Use this symbol to receive parameter values from the VST host. Values will be floats between 0 and 1 inclusive.
* svstparameter<integer> : Use this symbol to send parameter values to the VST host. Values should be floats between 0 and 1 inclusive. * `svstparameter<integer>` : Use this symbol to send parameter values to the VST host. Values should be floats between 0 and 1 inclusive.
* rvstopengui : Use this symbol to receive notification that the patch's GUI should be opened or closed. The value will be either 1 or 0. * `rvstopengui` : Use this symbol to receive notification that the patch's GUI should be opened or closed. The value will be either 1 or 0.
* rvstplugname : Use this symbol to receive plug & instance name from host * `rvstprognumber`: Use this symbol to receive program number changes from host.
* vstTimeInfo (play head information support) : * `rvstprogname`: Use this symbol to receive program name changes from host.
* `rvstplugname`: Use this symbol to receive plug & instance name from host
* `vstTimeInfo`: (play head information support) :
vstTimeInfo.ppqPos, vstTimeInfo.tempo, vstTimeInfo.timeSigNumerator, vstTimeInfo.timeSigDenominator, vstTimeInfo.flags are experimental receivers for getting time infos from host. Names should change in the future. `vstTimeInfo.ppqPos`, `vstTimeInfo.tempo`, `vstTimeInfo.timeSigNumerator`, `vstTimeInfo.timeSigDenominator`, `vstTimeInfo.flags` are experimental receivers for getting time infos from host. Names should change in the future.
* EXPERIMENTAL * EXPERIMENTAL
guiName : use this symbol to send and signal to the host the name of the gui-extra window to embed (see Pd_Gain(gui) example). `guiName` : use this symbol to send and signal to the host the name of the gui-extra window to embed (see Pd_Gain(gui) example).
Note: for most VST hosts, parameters for VST instruments are recorded as sysex data, so be Note: for most VST hosts, parameters for VST instruments are recorded as sysex data, so be
sure to disable any MIDI message filtering in the VST host. sure to disable any MIDI message filtering in the VST host.

View File

@ -0,0 +1,78 @@
#N canvas 19 118 885 488 12;
#X obj 78 87 adc~, f 6;
#X obj 73 241 loadbang;
#X msg 73 271 \; pd dsp 1 \;;
#X obj 77 162 dac~, f 6;
#X msg 142 52 \$1 30;
#X obj 142 87 line~;
#X obj 122 127 *~;
#X obj 78 127 *~;
#X obj 142 11 r gain;
#X obj 242 8 r rvstparameter0;
#X obj 239 279 * 100;
#X obj 239 307 dbtorms;
#X obj 239 334 s gain;
#X obj 297 269 s svstparameter0;
#X obj 242 72 vsl 50 128 0 1 0 0 empty empty empty 0 -9 0 10 #fcfcfc #000000 #000000 0 1;
#X msg 242 39 set \$1;
#X text 320 114 range is 0..1;
#X obj 64 393 r rvstplugname;
#X symbolatom 64 425 26 0 0 0 - - - 0;
#X obj 478 422 r rvstdata;
#X obj 476 331 s svstdata;
#X obj 478 454 print;
#X symbolatom 673 132 26 0 0 0 - - - 0;
#X obj 673 100 r rvstprogname;
#X obj 503 100 r rvstprognumber;
#X floatatom 503 124 5 0 0 0 - - - 0;
#X text 464 273 1 send some data to the host's data chunk;
#X text 463 358 2 from the host save the file as .fxp or .fxb;
#X msg 476 299 hello world 1.2;
#X text 462 392 3 from the host open the file you saved;
#X text 500 11 When the host chamges the program these 2 are updated. Additionally you can use this to set lots of parameters that are not exposed to host. The program used is stored and recalled in the host/DAW project., f 49;
#N canvas 182 182 450 300 additionally 0;
#X msg 121 99 12 34 56 hello;
#X msg 150 136 0.2 0.4 0.78 foo;
#X msg 190 179 0.2 0.4 0.78 bar;
#X msg 211 208 0.7 0.5 10 something;
#X obj 117 49 sel 0 1 2 3;
#X obj 136 250 list;
#X obj 136 274 outlet;
#X obj 117 15 inlet;
#X connect 0 0 5 0;
#X connect 1 0 5 0;
#X connect 2 0 5 0;
#X connect 3 0 5 0;
#X connect 4 0 0 0;
#X connect 4 1 1 0;
#X connect 4 2 2 0;
#X connect 4 3 3 0;
#X connect 5 0 6 0;
#X connect 7 0 4 0;
#X restore 503 154 pd additionally;
#X listbox 503 182 23 0 0 0 - - - 0;
#X text 466 223 Experimental. Not all hosts supports it correctly. See the .pdv file. This only works if PROGRAMSARECHUNKS = TRUE is set., f 50;
#X obj 242 213 t f f;
#X connect 0 0 7 0;
#X connect 0 1 6 0;
#X connect 1 0 2 0;
#X connect 4 0 5 0;
#X connect 5 0 6 1;
#X connect 5 0 7 1;
#X connect 6 0 3 1;
#X connect 7 0 3 0;
#X connect 8 0 4 0;
#X connect 9 0 15 0;
#X connect 10 0 11 0;
#X connect 11 0 12 0;
#X connect 14 0 34 0;
#X connect 15 0 14 0;
#X connect 17 0 18 0;
#X connect 19 0 21 0;
#X connect 23 0 22 0;
#X connect 24 0 25 0;
#X connect 25 0 31 0;
#X connect 28 0 20 0;
#X connect 31 0 32 0;
#X connect 34 0 10 0;
#X connect 34 1 13 0;

View File

@ -0,0 +1,57 @@
# Number of audio input and output channels
CHANNELS = 2
# installation directory of puredata (optional)
# If non specified, will search in <host_exec_dir>\pdvst\pd\
# then in <vst_dir>\.pd\
#PDPATH = D:\Programs\pd-0.48-1-test\
# Main Pd patch of the plugin
MAIN = Pd_Chunks-test.pd
# Unique four character VST plugin ID
ID = pdch
# Whether this is a VSTi
SYNTH = FALSE
# Whether there is a custom GUI (e.g. GrIPD)
CUSTOMGUI = FALSE
# Display Pd GUI or not
DEBUG = TRUE
# External libraries (comma delimited list, relative to pdvst/)
# ***OBSOLETE, use [declare] inside patch instead***
#LIB =
# Save and Get Pd lists in .fxp file via ([s svstdata] and [r rvstdata])
# Some hosts don't work correctly with this.
# If in doubt just use FALSE.
PROGRAMSARECHUNKS = FALSE
# Number of VST parameters (up to 128)
PARAMETERS = 1
# Name of first VST parameter
# used when CUSTOMGUI is false or VST host doesn't support custom editors
NAMEPARAMETER0 = Level
# Define a program (up to 128)
PROGRAM = Full Blast
# Set first parameter value for this program
PARAMETER0 = 1.0
#another program
PROGRAM = Muted
PARAMETER0 = 0.0
#another program
PROGRAM = -6dB
PARAMETER0 = 0.5
#another program
PROGRAM = test empty param

Binary file not shown.

View File

@ -0,0 +1,78 @@
#N canvas 19 118 885 488 12;
#X obj 78 87 adc~, f 6;
#X obj 73 241 loadbang;
#X msg 73 271 \; pd dsp 1 \;;
#X obj 77 162 dac~, f 6;
#X msg 142 52 \$1 30;
#X obj 142 87 line~;
#X obj 122 127 *~;
#X obj 78 127 *~;
#X obj 142 11 r gain;
#X obj 242 8 r rvstparameter0;
#X obj 239 279 * 100;
#X obj 239 307 dbtorms;
#X obj 239 334 s gain;
#X obj 297 269 s svstparameter0;
#X obj 242 72 vsl 50 128 0 1 0 0 empty empty empty 0 -9 0 10 #fcfcfc #000000 #000000 0 1;
#X msg 242 39 set \$1;
#X text 320 114 range is 0..1;
#X obj 64 393 r rvstplugname;
#X symbolatom 64 425 26 0 0 0 - - - 0;
#X obj 478 422 r rvstdata;
#X obj 476 331 s svstdata;
#X obj 478 454 print;
#X symbolatom 673 132 26 0 0 0 - - - 0;
#X obj 673 100 r rvstprogname;
#X obj 503 100 r rvstprognumber;
#X floatatom 503 124 5 0 0 0 - - - 0;
#X text 464 273 1 send some data to the host's data chunk;
#X text 463 358 2 from the host save the file as .fxp or .fxb;
#X msg 476 299 hello world 1.2;
#X text 462 392 3 from the host open the file you saved;
#X text 500 11 When the host chamges the program these 2 are updated. Additionally you can use this to set lots of parameters that are not exposed to host. The program used is stored and recalled in the host/DAW project., f 49;
#N canvas 182 182 450 300 additionally 0;
#X msg 121 99 12 34 56 hello;
#X msg 150 136 0.2 0.4 0.78 foo;
#X msg 190 179 0.2 0.4 0.78 bar;
#X msg 211 208 0.7 0.5 10 something;
#X obj 117 49 sel 0 1 2 3;
#X obj 136 250 list;
#X obj 136 274 outlet;
#X obj 117 15 inlet;
#X connect 0 0 5 0;
#X connect 1 0 5 0;
#X connect 2 0 5 0;
#X connect 3 0 5 0;
#X connect 4 0 0 0;
#X connect 4 1 1 0;
#X connect 4 2 2 0;
#X connect 4 3 3 0;
#X connect 5 0 6 0;
#X connect 7 0 4 0;
#X restore 503 154 pd additionally;
#X listbox 503 182 23 0 0 0 - - - 0;
#X text 466 223 Experimental. Not all hosts supports it correctly. See the .pdv file. This only works if PROGRAMSARECHUNKS = TRUE is set., f 50;
#X obj 242 213 t f f;
#X connect 0 0 7 0;
#X connect 0 1 6 0;
#X connect 1 0 2 0;
#X connect 4 0 5 0;
#X connect 5 0 6 1;
#X connect 5 0 7 1;
#X connect 6 0 3 1;
#X connect 7 0 3 0;
#X connect 8 0 4 0;
#X connect 9 0 15 0;
#X connect 10 0 11 0;
#X connect 11 0 12 0;
#X connect 14 0 34 0;
#X connect 15 0 14 0;
#X connect 17 0 18 0;
#X connect 19 0 21 0;
#X connect 23 0 22 0;
#X connect 24 0 25 0;
#X connect 25 0 31 0;
#X connect 28 0 20 0;
#X connect 31 0 32 0;
#X connect 34 0 10 0;
#X connect 34 1 13 0;

View File

@ -0,0 +1,57 @@
# Number of audio input and output channels
CHANNELS = 2
# installation directory of puredata (optional)
# If non specified, will search in <host_exec_dir>\pdvst\pd\
# then in <vst_dir>\.pd\
#PDPATH = D:\Programs\pd-0.48-1-test\
# Main Pd patch of the plugin
MAIN = Pd_Chunks-test.pd
# Unique four character VST plugin ID
ID = pdch
# Whether this is a VSTi
SYNTH = FALSE
# Whether there is a custom GUI (e.g. GrIPD)
CUSTOMGUI = FALSE
# Display Pd GUI or not
DEBUG = TRUE
# External libraries (comma delimited list, relative to pdvst/)
# ***OBSOLETE, use [declare] inside patch instead***
#LIB =
# Save and Get Pd lists in .fxp file via ([s svstdata] and [r rvstdata])
# Some hosts don't work correctly with this.
# If in doubt just use FALSE.
PROGRAMSARECHUNKS = FALSE
# Number of VST parameters (up to 128)
PARAMETERS = 1
# Name of first VST parameter
# used when CUSTOMGUI is false or VST host doesn't support custom editors
NAMEPARAMETER0 = Level
# Define a program (up to 128)
PROGRAM = Full Blast
# Set first parameter value for this program
PARAMETER0 = 1.0
#another program
PROGRAM = Muted
PARAMETER0 = 0.0
#another program
PROGRAM = -6dB
PARAMETER0 = 0.5
#another program
PROGRAM = test empty param

Binary file not shown.

View File

@ -23,7 +23,7 @@ DEBUG = FALSE
# External libraries (comma delimited list, relative to pdvst/) # External libraries (comma delimited list, relative to pdvst/)
# ***OBSOLETE, use [declare] inside patch instead*** # ***OBSOLETE, use [declare] inside patch instead***
#LIB = #LIB =
# Number of VST parameters (up to 128) # Number of VST parameters (up to 128)
PARAMETERS = 1 PARAMETERS = 1

View File

@ -17,5 +17,6 @@ ALL: vstschedlib.c
gcc -Wall -I$(PDDIR)src -I../vst-template vstschedlib.c -static-libgcc \ gcc -Wall -I$(PDDIR)src -I../vst-template vstschedlib.c -static-libgcc \
-shared -L$(PDDIR)bin -l:pd.dll -o vstschedlib.dll -shared -L$(PDDIR)bin -l:pd.dll -o vstschedlib.dll
strip vstschedlib.dll strip vstschedlib.dll
cp vstschedlib.dll ../build/pd-scheduler$(arch)/vstschedlib.dll #cp vstschedlib.dll ../build/pd-scheduler$(arch)/vstschedlib.dll
#cp vstschedlib.dll ../build/Release$(arch)/.pd/bin/vstschedlib.dll #cp vstschedlib.dll ../build/Release$(arch)/.pd/bin/vstschedlib.dll
cp vstschedlib.dll ../build/Release$(arch)/vstschedlib.dll

View File

@ -70,10 +70,20 @@ typedef struct _vstGuiNameReceiver
t_vstGuiNameReceiver *vstGuiNameReceiver; t_vstGuiNameReceiver *vstGuiNameReceiver;
typedef struct _vstChunkReceiver
{
t_object x_obj;
}t_vstChunkReceiver;
t_vstChunkReceiver *vstChunkReceiver;
t_vstParameterReceiver *vstParameterReceivers[MAXPARAMETERS]; t_vstParameterReceiver *vstParameterReceivers[MAXPARAMETERS];
t_class *vstParameterReceiver_class; t_class *vstParameterReceiver_class;
t_class *vstGuiNameReceiver_class; t_class *vstGuiNameReceiver_class;
t_class *vstChunkReceiver_class;
char *pdvstTransferMutexName, char *pdvstTransferMutexName,
*pdvstTransferFileMapName, *pdvstTransferFileMapName,
@ -195,6 +205,54 @@ int setPdvstPlugName(char* instanceName)
return 0; return 0;
} }
/*receive data chunk from host*/
int setPdvstChunk(const char *amsg)
{
t_symbol *tempSym;
tempSym = gensym("rvstdata");
if (tempSym->s_thing)
{
size_t len = strlen(amsg);
t_binbuf* bbuf = binbuf_new();
binbuf_text(bbuf, amsg, len);
int msg, natom = binbuf_getnatom(bbuf);
t_atom *at = binbuf_getvec(bbuf);
for (msg = 0; msg < natom;) {
int emsg;
for (emsg = msg; emsg < natom && at[emsg].a_type != A_COMMA
&& at[emsg].a_type != A_SEMI; emsg++);
if (emsg > msg) {
int i;
/* check for illegal atoms */
for (i = msg; i < emsg; i++)
if (at[i].a_type == A_DOLLAR || at[i].a_type == A_DOLLSYM) {
pd_error(NULL, "rvstdata: got dollar sign in message");
goto nodice;
}
if (at[msg].a_type == A_FLOAT) {
if (emsg > msg + 1)
pd_list(tempSym->s_thing, 0, emsg-msg, at + msg);
else pd_float(tempSym->s_thing, at[msg].a_w.w_float);
}
else if (at[msg].a_type == A_SYMBOL) {
pd_anything(tempSym->s_thing, at[msg].a_w.w_symbol, emsg-msg-1, at + msg + 1);
}
}
nodice:
msg = emsg + 1;
}
binbuf_free(bbuf);
return 1;
}
else
return 0;
}
int setPdvstFloatParameter(int index, float value) int setPdvstFloatParameter(int index, float value)
{ {
@ -227,6 +285,32 @@ void sendPdVstFloatParameter(t_vstParameterReceiver *x, t_float floatValue)
ReleaseMutex(pdvstTransferMutex); ReleaseMutex(pdvstTransferMutex);
} }
/*send data chunk to host*/
void sendPdVstChunk(t_vstChunkReceiver *x, t_symbol *s, int argc, t_atom *argv)
{
char *buf;
int length;
t_atom at;
t_binbuf*bbuf = binbuf_new();
SETSYMBOL(&at, s);
binbuf_add(bbuf, 1, &at);
binbuf_add(bbuf, argc, argv);
binbuf_gettext(bbuf, &buf, &length);
binbuf_free(bbuf);
WaitForSingleObject(pdvstTransferMutex, INFINITE);
memset(&pdvstData->datachunk.value.stringData, '\0', MAXSTRINGSIZE);
pdvstData->datachunk.type = STRING_TYPE;
pdvstData->datachunk.direction = PD_SEND;
pdvstData->datachunk.updated = 1;
//strcpy(pdvstData->datachunk.value.stringData,buf);
memcpy(pdvstData->datachunk.value.stringData, buf, length);
ReleaseMutex(pdvstTransferMutex);
freebytes(buf, length+1);
}
void sendPdVstGuiName(t_vstGuiNameReceiver *x, t_symbol *symbolValue) void sendPdVstGuiName(t_vstGuiNameReceiver *x, t_symbol *symbolValue)
{ {
WaitForSingleObject(pdvstTransferMutex, INFINITE); WaitForSingleObject(pdvstTransferMutex, INFINITE);
@ -234,9 +318,7 @@ void sendPdVstGuiName(t_vstGuiNameReceiver *x, t_symbol *symbolValue)
pdvstData->guiName.direction = PD_SEND; pdvstData->guiName.direction = PD_SEND;
pdvstData->guiName.updated = 1; pdvstData->guiName.updated = 1;
strcpy(pdvstData->guiName.value.stringData,symbolValue->s_name); strcpy(pdvstData->guiName.value.stringData,symbolValue->s_name);
ReleaseMutex(pdvstTransferMutex); ReleaseMutex(pdvstTransferMutex);
} }
void makePdvstParameterReceivers() void makePdvstParameterReceivers()
@ -251,16 +333,20 @@ void makePdvstParameterReceivers()
vstParameterReceivers[i]->x_sym = gensym(string); vstParameterReceivers[i]->x_sym = gensym(string);
pd_bind(&vstParameterReceivers[i]->x_obj.ob_pd, gensym(string)); pd_bind(&vstParameterReceivers[i]->x_obj.ob_pd, gensym(string));
} }
} }
void makePdvstGuiNameReceiver() void makePdvstGuiNameReceiver()
{ {
vstGuiNameReceiver = (t_vstGuiNameReceiver *)pd_new(vstGuiNameReceiver_class); vstGuiNameReceiver = (t_vstGuiNameReceiver *)pd_new(vstGuiNameReceiver_class);
pd_bind(&vstGuiNameReceiver->x_obj.ob_pd, gensym("guiName")); pd_bind(&vstGuiNameReceiver->x_obj.ob_pd, gensym("guiName"));
} }
void makevstChunkReceiver()
{
vstChunkReceiver = (t_vstChunkReceiver *)pd_new(vstChunkReceiver_class);
pd_bind(&vstChunkReceiver->x_obj.ob_pd, gensym("svstdata"));
}
void send_dacs(void) void send_dacs(void)
{ {
@ -331,7 +417,20 @@ int scheduler()
class_addfloat(vstParameterReceiver_class, (t_method)sendPdVstFloatParameter); class_addfloat(vstParameterReceiver_class, (t_method)sendPdVstFloatParameter);
makePdvstParameterReceivers(); makePdvstParameterReceivers();
vstChunkReceiver_class = class_new(gensym("vstChunkReceiver"),
0,
0,
sizeof(t_vstChunkReceiver),
0,
0);
class_addanything(vstChunkReceiver_class,(t_method)sendPdVstChunk);
makevstChunkReceiver();
vstGuiNameReceiver_class = class_new(gensym("vstGuiNameReceiver"), vstGuiNameReceiver_class = class_new(gensym("vstGuiNameReceiver"),
0, 0,
0, 0,
@ -390,7 +489,38 @@ int scheduler()
if (setPdvstPlugName((char*)pdvstData->plugName.value.stringData)) if (setPdvstPlugName((char*)pdvstData->plugName.value.stringData))
pdvstData->plugName.updated=0; pdvstData->plugName.updated=0;
} }
// check for data chunk from file
if (pdvstData->datachunk.direction == PD_RECEIVE && \
pdvstData->datachunk.updated)
{
if (setPdvstChunk((char*)pdvstData->datachunk.value.stringData))
pdvstData->datachunk.updated=0;
}
// check for vst program name changed
if (pdvstData->prognumber2pd.direction == PD_RECEIVE && \
pdvstData->prognumber2pd.updated)
{
t_symbol *tempSym;
tempSym = gensym("rvstprognumber");
if (tempSym->s_thing)
pd_float(tempSym->s_thing, (t_float)pdvstData->prognumber2pd.value.floatData);
pdvstData->prognumber2pd.updated=0;
}
// check for vst program number changed
if (pdvstData->progname2pd.direction == PD_RECEIVE && \
pdvstData->progname2pd.updated)
{
t_symbol *tempSym;
tempSym = gensym("rvstprogname");
if (tempSym->s_thing)
pd_symbol(tempSym->s_thing, \
gensym(pdvstData->progname2pd.value.stringData));
pdvstData->progname2pd.updated=0;
}
if (pdvstData->hostTimeInfo.updated) if (pdvstData->hostTimeInfo.updated)
{ {
pdvstData->hostTimeInfo.updated=0; pdvstData->hostTimeInfo.updated=0;

View File

@ -38,6 +38,7 @@ ALL: $(SOURCES)
cp pdvst-template.dll ../build/Release$(arch)/Pd_Gain-gui.dll cp pdvst-template.dll ../build/Release$(arch)/Pd_Gain-gui.dll
cp pdvst-template.dll ../build/Release$(arch)/Pd_Gain-nogui.dll cp pdvst-template.dll ../build/Release$(arch)/Pd_Gain-nogui.dll
cp pdvst-template.dll ../build/Release$(arch)/Pd_Midi.dll cp pdvst-template.dll ../build/Release$(arch)/Pd_Midi.dll
cp pdvst-template.dll ../build/Release$(arch)/Pd_Chunks-test.dll

View File

@ -56,6 +56,7 @@ extern char globalHostPdvstPath[MAXFILENAMELEN];
extern bool globalCustomGui; extern bool globalCustomGui;
extern int globalCustomGuiWidth; extern int globalCustomGuiWidth;
extern int globalCustomGuiHeight; extern int globalCustomGuiHeight;
extern bool globalProgramsAreChunks;
extern bool globalIsASynth; extern bool globalIsASynth;
extern pdvstProgram globalProgram[MAXPROGRAMS]; extern pdvstProgram globalProgram[MAXPROGRAMS];
@ -226,6 +227,8 @@ pdvst::pdvst(audioMasterCallback audioMaster)
// {JYG see pdvst::setProgram below for explanation // {JYG see pdvst::setProgram below for explanation
timeFromStartup=GetTickCount(); timeFromStartup=GetTickCount();
// JYG } // JYG }
programsAreChunks(globalProgramsAreChunks);
sendPlugName(globalPluginName);
} }
pdvst::~pdvst() pdvst::~pdvst()
@ -490,6 +493,25 @@ void pdvst::resume()
} }
} }
void pdvst::sendProgChange(VstInt32 prgm)
{
WaitForSingleObject(pdvstTransferMutex, 10);
{
pdvstData->prognumber2pd.direction = PD_RECEIVE;
pdvstData->prognumber2pd.type = FLOAT_TYPE;
pdvstData->prognumber2pd.value.floatData = (float)prgm;
pdvstData->prognumber2pd.updated = 1;
pdvstData->progname2pd.direction = PD_RECEIVE;
pdvstData->progname2pd.type = STRING_TYPE;
strcpy(pdvstData->progname2pd.value.stringData, program[prgm].name);
pdvstData->progname2pd.updated = 1;
ReleaseMutex(pdvstTransferMutex);
}
}
void pdvst::setProgram(VstInt32 prgmNum) void pdvst::setProgram(VstInt32 prgmNum)
{ {
debugLog("appel de setProgram %d", prgmNum); debugLog("appel de setProgram %d", prgmNum);
@ -497,6 +519,7 @@ void pdvst::setProgram(VstInt32 prgmNum)
if (prgmNum >= 0 && prgmNum < nPrograms) if (prgmNum >= 0 && prgmNum < nPrograms)
{ {
curProgram = prgmNum; curProgram = prgmNum;
sendProgChange(prgmNum);
// {JYG to prevent host call of setProgram to override current param settings // {JYG to prevent host call of setProgram to override current param settings
@ -600,6 +623,46 @@ bool pdvst::getOutputProperties(VstInt32 index, VstPinProperties* properties)
return false; return false;
} }
VstInt32 pdvst::getChunk (void** data, bool isPreset)
{
VstInt32 len;
//MessageBoxA(NULL, "getchunk call", "debug", MB_OK); // all host gets here
if(*data)
{
//MessageBoxA(NULL, "getchunk if data", "debug", MB_OK); // not all hosts gets here
WaitForSingleObject(pdvstTransferMutex, 10);
{
//strcpy ((char *)*data, pdvstData->datachunk.value.stringData);
*data = pdvstData->datachunk.value.stringData;
len = (VstInt32)strlen(pdvstData->datachunk.value.stringData);
//memcpy(*data, pdvstData->datachunk.value.stringData, (size_t)len+1);
ReleaseMutex(pdvstTransferMutex);
}
return len+1;
}
else
return 0;
}
VstInt32 pdvst::setChunk (void* data, VstInt32 byteSize, bool isPreset)
{
//MessageBoxA(NULL, "setchunk call", "debug", MB_OK);
if(byteSize)
{
//MessageBoxA(NULL, "setchunk call if bytesize", "debug", MB_OK);
WaitForSingleObject(pdvstTransferMutex, 10);
{
pdvstData->datachunk.direction = PD_RECEIVE;
pdvstData->datachunk.type = STRING_TYPE;
memset(&pdvstData->datachunk.value.stringData, '\0', MAXSTRINGSIZE);
strncpy(pdvstData->datachunk.value.stringData,(char *)data, (size_t)byteSize);
pdvstData->datachunk.updated = 1;
ReleaseMutex(pdvstTransferMutex);
}
}
return 0;
}
VstInt32 pdvst::canDo(char* text) VstInt32 pdvst::canDo(char* text)
{ {
//if (isASynth) //if (isASynth)
@ -1088,6 +1151,17 @@ void pdvst::updatePdvstParameters()
}
// to data chunk
if (pdvstData->datachunk.direction == PD_SEND && \
pdvstData->datachunk.updated)
{
if (pdvstData->datachunk.type == STRING_TYPE)
{
pdvstData->datachunk.updated=0;
}
} }
ReleaseMutex(pdvstTransferMutex); ReleaseMutex(pdvstTransferMutex);

View File

@ -99,12 +99,16 @@ public:
// virtual VstInt32 canMono (); // virtual VstInt32 canMono ();
virtual void suspend(); virtual void suspend();
virtual void resume(); virtual void resume();
void sendGuiAction(int action); void sendGuiAction(int action);
void sendPlugName(char * name ); // JYG : to send plug name to puredatapatch void sendPlugName(char * name ); // JYG : to send plug name to puredatapatch
void sendProgChange(VstInt32 prgm); // send vst prog name and number to patch
LPTSTR displayString;//= new TCHAR[MAXSTRINGSIZE]; LPTSTR displayString;//= new TCHAR[MAXSTRINGSIZE];
HWND pdGui; HWND pdGui;
virtual VstInt32 getChunk (void** data, bool isPreset);
virtual VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset);
protected: protected:
static int referenceCount; static int referenceCount;

View File

@ -44,6 +44,7 @@ bool globalCustomGui = false;
int globalCustomGuiWidth= 320; int globalCustomGuiWidth= 320;
int globalCustomGuiHeight= 150; int globalCustomGuiHeight= 150;
pdvstProgram globalProgram[MAXPROGRAMS]; pdvstProgram globalProgram[MAXPROGRAMS];
bool globalProgramsAreChunks = false;
char *trimWhitespace(char *str); char *trimWhitespace(char *str);
void parseSetupFile(); void parseSetupFile();
@ -376,6 +377,18 @@ void parseSetupFile()
globalProgram[progNum].paramValue[paramNum] = \ globalProgram[progNum].paramValue[paramNum] = \
(float)atof(value); (float)atof(value);
} }
// programsarechunks (save custom data in .fxp or .fxb file)
if (strcmp(param, "programsarechunks") == 0)
{
if (strcmp(strlwr(value), "true") == 0)
{
globalProgramsAreChunks = true;
}
else if (strcmp(strlwr(value), "false") == 0)
{
globalProgramsAreChunks = false;
}
}
} }
} }
} }

View File

@ -121,6 +121,9 @@ typedef struct _pdvstTransferData
pdvstMidiMessage midiQueue[MAXMIDIQUEUESIZE]; pdvstMidiMessage midiQueue[MAXMIDIQUEUESIZE];
pdvstParameter guiState; pdvstParameter guiState;
pdvstParameter plugName; // transmitted by host pdvstParameter plugName; // transmitted by host
pdvstParameter datachunk; // get/set chunk from .fxp .fxb files
pdvstParameter progname2pd; // send program name to Pd
pdvstParameter prognumber2pd; // send program name to Pd
pdvstParameter guiName; // transmitted by pd : name of gui window to be embedded pdvstParameter guiName; // transmitted by pd : name of gui window to be embedded
// #ifdef VSTMIDIOUTENABLE // #ifdef VSTMIDIOUTENABLE
int midiOutQueueSize; int midiOutQueueSize;