Compare commits

..

11 Commits

14 changed files with 420 additions and 81 deletions

3
.gitignore vendored
View File

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

View File

@ -1,15 +1,24 @@
# Attention
This repository has moved to
https://github.com/Lucarda/pdvst-0.52
# Pdvst-0.52
Based on https://github.com/jyg/pure-data/tree/master/pdvst but updated to load with Pd-0.52
or higher.
Get pre-built binaries on https://git.nubegris.com.ar/lucarda/pdvst-0.52/releases
# How does it work ?
PdVst consists of two main parts :
* a vst-plugin (pdvst-template32.dll, pdvst-template64.dll) to place in your favorite vst folder.
* a custom external scheduler (vstschedlib.dll) to copy in the pure-data /bin 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
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...
@ -20,7 +29,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
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
2) Copy your plugin `.dll` file (e.g. `Pd_Gain.dll`) to the vst plugins directory
@ -49,9 +58,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
"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
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.
# The .pdv Setup File-
@ -104,7 +113,14 @@ For an example, see Pd_Gain.pdv.
PARAMETER<integer> = <float>
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>
All vst parameters are saved in the host session and additionally
you can set/get some "Pd list" in the session or to a .fxp/.fxb file
via [s svstdata] and [r rvstdata]
# Pd/VST audio/midi Communication
@ -128,16 +144,20 @@ 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.
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.
* 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.
* rvstplugname : Use this symbol to receive plug & instance name from host
* vstTimeInfo (play head information support) :
* `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.
* `svstdata` : Use this symbol to save a Pd list as "chunk" data in the host DAW's save file (see `PROGRAMSARECHUNKS` setting above).
* `rvstdata` : Use this symbol to receive a Pd list of "chunk" data that was saved into the DAW file by your patch. Triggered at load time.
* `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.
* `rvstprognumber`: Use this symbol to receive program number changes from host.
* `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
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
sure to disable any MIDI message filtering in the VST host.
@ -146,11 +166,11 @@ sure to disable any MIDI message filtering in the VST host.
* Windows x32 and x64 only
* Support for embedding external gui window into host
* multichannel audio in/out support
* integrated vst midi-in, experimental midi-out
* added play head information support (see examples)
* Multichannel audio in/out support
* Integrated CST MIDI-in, experimental MIDI-out
* Play head information support (see examples)
* Save chunk data to host DAW
#TODO
* optimize plugin loading
* use of chunks for preset saving

View File

@ -0,0 +1,78 @@
#N canvas 19 118 947 544 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 447 r rvstdata;
#X obj 476 356 s svstdata;
#X obj 478 479 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 msg 476 324 hello world 1.2;
#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 text 464 273 1 all vstparameters are tracked and additionally you can send some Pd list to the host's data chunk;
#X text 463 383 2 from the host save your current session (or to a file as .fxp or .fxb);
#X text 462 417 3 from the host open your session (or 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 the host. The program used is stored and recalled in the host/DAW project., f 52;
#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 30 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 27 0;
#X connect 26 0 20 0;
#X connect 27 0 28 0;
#X connect 30 0 10 0;
#X connect 30 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 =
# All vst parameters are saved in the host session and additionally
# you can set/get some "Pd list" in the session or to a .fxp/.fxb file
# via [s svstdata] and [r rvstdata]
PROGRAMSARECHUNKS = TRUE
# 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

View File

@ -1,4 +1,4 @@
#N canvas 0 265 818 358 12;
#N canvas 19 118 947 544 12;
#X obj 78 87 adc~, f 6;
#X obj 73 241 loadbang;
#X msg 73 271 \; pd dsp 1 \;;
@ -9,19 +9,50 @@
#X obj 78 127 *~;
#X obj 142 11 r gain;
#X obj 242 8 r rvstparameter0;
#X obj 242 235 * 100;
#X obj 242 263 dbtorms;
#X obj 242 290 s gain;
#X obj 300 225 s svstparameter0;
#X obj 277 75 vsl 50 128 0 1 0 0 empty empty empty 0 -9 0 10 #fcfcfc #000000 #000000 0 1;
#X msg 277 42 set \$1;
#X text 355 117 range is 0..1;
#X obj 498 10 r rvstplugname;
#X symbolatom 498 48 17 0 0 0 - - - 0;
#X obj 516 102 r rvstdata;
#X symbolatom 516 136 17 0 0 0 - - - 0;
#X obj 516 265 s svstdata;
#X msg 547 216 symbol hello\ world\ 2;
#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 447 r rvstdata;
#X obj 476 356 s svstdata;
#X obj 478 479 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 msg 476 324 hello world 1.2;
#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 text 464 273 1 all vstparameters are tracked and additionally you can send some Pd list to the host's data chunk;
#X text 463 383 2 from the host save your current session (or to a file as .fxp or .fxb);
#X text 462 417 3 from the host open your session (or 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 the host. The program used is stored and recalled in the host/DAW project., f 52;
#X connect 0 0 7 0;
#X connect 0 1 6 0;
#X connect 1 0 2 0;
@ -31,13 +62,17 @@
#X connect 6 0 3 1;
#X connect 7 0 3 0;
#X connect 8 0 4 0;
#X connect 9 0 10 0;
#X connect 9 0 15 0;
#X connect 10 0 11 0;
#X connect 11 0 12 0;
#X connect 14 0 13 0;
#X connect 14 0 10 0;
#X connect 14 0 30 0;
#X connect 15 0 14 0;
#X connect 17 0 18 0;
#X connect 19 0 20 0;
#X connect 22 0 21 0;
#X connect 19 0 21 0;
#X connect 23 0 22 0;
#X connect 24 0 25 0;
#X connect 25 0 27 0;
#X connect 26 0 20 0;
#X connect 27 0 28 0;
#X connect 30 0 10 0;
#X connect 30 1 13 0;

View File

@ -25,6 +25,11 @@ DEBUG = TRUE
# ***OBSOLETE, use [declare] inside patch instead***
#LIB =
# All vst parameters are saved in the host session and additionally
# you can set/get some "Pd list" in the session or to a .fxp/.fxb file
# via [s svstdata] and [r rvstdata]
PROGRAMSARECHUNKS = TRUE
# Number of VST parameters (up to 128)
PARAMETERS = 1
@ -46,4 +51,7 @@ PARAMETER0 = 0.0
#another program
PROGRAM = -6dB
PARAMETER0 = 0.94
PARAMETER0 = 0.5
#another program
PROGRAM = test empty param

View File

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

View File

@ -18,4 +18,5 @@ ALL: vstschedlib.c
-shared -L$(PDDIR)bin -l:pd.dll -o vstschedlib.dll
strip 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

@ -205,17 +205,52 @@ int setPdvstPlugName(char* instanceName)
return 0;
}
int setPdvstChunk(char* instanceName)
/*receive data chunk from host*/
int setPdvstChunk(const char *amsg)
{
t_symbol *tempSym;
tempSym = gensym("rvstdata");
if (tempSym->s_thing)
{
pd_symbol(tempSym->s_thing, gensym(instanceName));
return 1;
}
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;
return 0;
}
@ -250,15 +285,30 @@ void sendPdVstFloatParameter(t_vstParameterReceiver *x, t_float floatValue)
ReleaseMutex(pdvstTransferMutex);
}
void sendPdVstChunk(t_vstChunkReceiver *x, t_symbol *sym)
/*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,sym->s_name);
//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)
@ -268,9 +318,7 @@ void sendPdVstGuiName(t_vstGuiNameReceiver *x, t_symbol *symbolValue)
pdvstData->guiName.direction = PD_SEND;
pdvstData->guiName.updated = 1;
strcpy(pdvstData->guiName.value.stringData,symbolValue->s_name);
ReleaseMutex(pdvstTransferMutex);
}
void makePdvstParameterReceivers()
@ -292,20 +340,14 @@ void makePdvstGuiNameReceiver()
{
vstGuiNameReceiver = (t_vstGuiNameReceiver *)pd_new(vstGuiNameReceiver_class);
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)
{
int i, j, sampleCount, nChannels, blockSize;
@ -384,7 +426,7 @@ int scheduler()
0,
0);
class_addsymbol(vstChunkReceiver_class,(t_method)sendPdVstChunk);
class_addanything(vstChunkReceiver_class,(t_method)sendPdVstChunk);
makevstChunkReceiver();
@ -448,7 +490,7 @@ int scheduler()
pdvstData->plugName.updated=0;
}
// lucarda get data chunk from file
// check for data chunk from file
if (pdvstData->datachunk.direction == PD_RECEIVE && \
pdvstData->datachunk.updated)
{
@ -456,6 +498,29 @@ int scheduler()
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)
{
pdvstData->hostTimeInfo.updated=0;

View File

@ -56,6 +56,7 @@ extern char globalHostPdvstPath[MAXFILENAMELEN];
extern bool globalCustomGui;
extern int globalCustomGuiWidth;
extern int globalCustomGuiHeight;
extern bool globalProgramsAreChunks;
extern bool globalIsASynth;
extern pdvstProgram globalProgram[MAXPROGRAMS];
@ -226,7 +227,7 @@ pdvst::pdvst(audioMasterCallback audioMaster)
// {JYG see pdvst::setProgram below for explanation
timeFromStartup=GetTickCount();
// JYG }
programsAreChunks(true);
programsAreChunks(globalProgramsAreChunks);
sendPlugName(globalPluginName);
}
@ -492,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)
{
debugLog("appel de setProgram %d", prgmNum);
@ -499,6 +519,7 @@ void pdvst::setProgram(VstInt32 prgmNum)
if (prgmNum >= 0 && prgmNum < nPrograms)
{
curProgram = prgmNum;
sendProgChange(prgmNum);
// {JYG to prevent host call of setProgram to override current param settings
@ -604,25 +625,55 @@ bool pdvst::getOutputProperties(VstInt32 index, VstPinProperties* properties)
VstInt32 pdvst::getChunk (void** data, bool isPreset)
{
MessageBox(0,"getchunk","debug",MB_OK);
strcpy ((char *)*data, pdvstData->datachunk.value.stringData);
return strlen(pdvstData->datachunk.value.stringData);
Chunk = new pdvstProgramAreChunks;
//MessageBoxA(NULL, "getchunk call", "debug", MB_OK); // all host gets here
for (int i = 0; i < nParameters; i++)
{
Chunk->vstParam[i] = vstParam[i];
}
//MessageBoxA(NULL, "getchunk if data", "debug", MB_OK); // not all hosts gets here
WaitForSingleObject(pdvstTransferMutex, 10);
{
memset(&Chunk->Data, '\0', MAXSTRLEN);
strcpy (Chunk->Data, pdvstData->datachunk.value.stringData);
ReleaseMutex(pdvstTransferMutex);
}
debugLog("luc:debug-size-of-chunk %d", sizeof(*Chunk));
*data = (void*)Chunk;
return sizeof(*Chunk);
}
VstInt32 pdvst::setChunk (void* data, VstInt32 byteSize, bool isPreset)
{
//MessageBoxA(NULL, "setchunk call", "debug", MB_OK);
if(byteSize)
{
Chunk = (pdvstProgramAreChunks*)data;
//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', MAXSTRLEN);
strcpy(pdvstData->datachunk.value.stringData, Chunk->Data);
pdvstData->datachunk.updated = 1;
WaitForSingleObject(pdvstTransferMutex, 10);
{
pdvstData->datachunk.direction = PD_RECEIVE;
pdvstData->datachunk.type = STRING_TYPE;
strcpy(pdvstData->datachunk.value.stringData,(char *)data);
pdvstData->datachunk.updated = 1;
ReleaseMutex(pdvstTransferMutex);
for (int i = 0; i < nParameters; i++)
{
pdvstData->vstParameters[i].type = FLOAT_TYPE;
pdvstData->vstParameters[i].value.floatData = Chunk->vstParam[i];
pdvstData->vstParameters[i].direction = PD_RECEIVE;
pdvstData->vstParameters[i].updated = 1;
}
ReleaseMutex(pdvstTransferMutex);
}
}
MessageBox(0,"setchunk","debug",MB_OK);
debugLog("setchunk: %s", data);
return 1;
return 0;
}
VstInt32 pdvst::canDo(char* text)
@ -1114,13 +1165,13 @@ void pdvst::updatePdvstParameters()
}
// to data chunk
if (pdvstData->datachunk.direction == PD_SEND && \
pdvstData->datachunk.updated)
{
if (pdvstData->datachunk.type = STRING_TYPE)
if (pdvstData->datachunk.type == STRING_TYPE)
{
pdvstData->datachunk.updated=0;
}

View File

@ -53,6 +53,13 @@ typedef struct _pdvstProgram
float paramValue[MAXPARAMETERS];
} pdvstProgram;
/* for programsarechunks*/
typedef struct _pdvstProgramAreChunks
{
float vstParam[MAXPARAMETERS];
char Data[MAXSTRLEN];
} pdvstProgramAreChunks;
class pdVstBuffer
{
@ -99,15 +106,16 @@ public:
// virtual VstInt32 canMono ();
virtual void suspend();
virtual void resume();
void sendGuiAction(int action);
void sendPlugName(char * name ); // JYG : to send plug name to puredatapatch
void sendGuiAction(int action);
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];
HWND pdGui;
virtual VstInt32 getChunk (void** data, bool isPreset = false);
virtual VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset = false);
virtual VstInt32 getChunk (void** data, bool isPreset);
virtual VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset);
protected:
static int referenceCount;
@ -127,6 +135,7 @@ protected:
char **vstParamName;
int nParameters;
pdvstProgram *program;
pdvstProgramAreChunks *Chunk;
int nPrograms;
int nChannels;
int nExternalLibs;
@ -173,7 +182,6 @@ protected:
// JYG }
//void programsAreChunks (bool) {}
};
#endif

View File

@ -44,6 +44,7 @@ bool globalCustomGui = false;
int globalCustomGuiWidth= 320;
int globalCustomGuiHeight= 150;
pdvstProgram globalProgram[MAXPROGRAMS];
bool globalProgramsAreChunks = false;
char *trimWhitespace(char *str);
void parseSetupFile();
@ -376,6 +377,18 @@ void parseSetupFile()
globalProgram[progNum].paramValue[paramNum] = \
(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,7 +121,9 @@ typedef struct _pdvstTransferData
pdvstMidiMessage midiQueue[MAXMIDIQUEUESIZE];
pdvstParameter guiState;
pdvstParameter plugName; // transmitted by host
pdvstParameter datachunk; // get/set chunk from .fxp file
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
// #ifdef VSTMIDIOUTENABLE
int midiOutQueueSize;