Compare commits

..

3 Commits

Author SHA1 Message Date
dd34df995f update readme 2024-10-21 00:41:18 -03:00
cb790214d5 cleanup 2024-10-07 12:45:42 -03:00
4cc0976f81 seems working 2024-10-03 02:36:57 -03:00
9 changed files with 97 additions and 64 deletions

View File

@ -1,9 +1,18 @@
# Attention
This repository has moved to
https://github.com/Lucarda/pdvst-0.52
# 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 Based on https://github.com/jyg/pure-data/tree/master/pdvst but updated to load with Pd-0.52
or higher. or higher.
Get pre-built binaries on https://git.nubegris.com.ar/lucarda/pdvst-0.52/releases
# How does it work ? # How does it work ?
@ -107,9 +116,10 @@ For an example, see Pd_Gain.pdv.
between 0 and 1 inclusive. between 0 and 1 inclusive.
PROGRAMSARECHUNKS = <TRUE/FALSE> PROGRAMSARECHUNKS = <TRUE/FALSE>
Save and Get Pd lists in .fxp file via ([s svstdata] and [r rvstdata]) All vst parameters are saved in the host session and additionally
Some hosts don't work correctly with this. you can set/get some "Pd list" in the session or to a .fxp/.fxb file
If in doubt just use FALSE. via [s svstdata] and [r rvstdata]
# Pd/VST audio/midi Communication # Pd/VST audio/midi Communication
@ -136,6 +146,8 @@ 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.
* `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. * `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. * `rvstprognumber`: Use this symbol to receive program number changes from host.
* `rvstprogname`: Use this symbol to receive program name changes from host. * `rvstprogname`: Use this symbol to receive program name changes from host.
@ -154,11 +166,11 @@ sure to disable any MIDI message filtering in the VST host.
* Windows x32 and x64 only * Windows x32 and x64 only
* Support for embedding external gui window into host * Support for embedding external gui window into host
* multichannel audio in/out support * Multichannel audio in/out support
* integrated vst midi-in, experimental midi-out * Integrated CST MIDI-in, experimental MIDI-out
* added play head information support (see examples) * Play head information support (see examples)
* Save chunk data to host DAW
#TODO #TODO
* optimize plugin loading * optimize plugin loading
* use of chunks for preset saving

View File

@ -1,4 +1,4 @@
#N canvas 19 118 885 488 12; #N canvas 19 118 947 544 12;
#X obj 78 87 adc~, f 6; #X obj 78 87 adc~, f 6;
#X obj 73 241 loadbang; #X obj 73 241 loadbang;
#X msg 73 271 \; pd dsp 1 \;; #X msg 73 271 \; pd dsp 1 \;;
@ -18,18 +18,14 @@
#X text 320 114 range is 0..1; #X text 320 114 range is 0..1;
#X obj 64 393 r rvstplugname; #X obj 64 393 r rvstplugname;
#X symbolatom 64 425 26 0 0 0 - - - 0; #X symbolatom 64 425 26 0 0 0 - - - 0;
#X obj 478 422 r rvstdata; #X obj 478 447 r rvstdata;
#X obj 476 331 s svstdata; #X obj 476 356 s svstdata;
#X obj 478 454 print; #X obj 478 479 print;
#X symbolatom 673 132 26 0 0 0 - - - 0; #X symbolatom 673 132 26 0 0 0 - - - 0;
#X obj 673 100 r rvstprogname; #X obj 673 100 r rvstprogname;
#X obj 503 100 r rvstprognumber; #X obj 503 100 r rvstprognumber;
#X floatatom 503 124 5 0 0 0 - - - 0; #X floatatom 503 124 5 0 0 0 - - - 0;
#X text 464 273 1 send some data to the host's data chunk; #X msg 476 324 hello world 1.2;
#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; #N canvas 182 182 450 300 additionally 0;
#X msg 121 99 12 34 56 hello; #X msg 121 99 12 34 56 hello;
#X msg 150 136 0.2 0.4 0.78 foo; #X msg 150 136 0.2 0.4 0.78 foo;
@ -53,6 +49,10 @@
#X listbox 503 182 23 0 0 0 - - - 0; #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 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 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 0 7 0;
#X connect 0 1 6 0; #X connect 0 1 6 0;
#X connect 1 0 2 0; #X connect 1 0 2 0;
@ -65,14 +65,14 @@
#X connect 9 0 15 0; #X connect 9 0 15 0;
#X connect 10 0 11 0; #X connect 10 0 11 0;
#X connect 11 0 12 0; #X connect 11 0 12 0;
#X connect 14 0 34 0; #X connect 14 0 30 0;
#X connect 15 0 14 0; #X connect 15 0 14 0;
#X connect 17 0 18 0; #X connect 17 0 18 0;
#X connect 19 0 21 0; #X connect 19 0 21 0;
#X connect 23 0 22 0; #X connect 23 0 22 0;
#X connect 24 0 25 0; #X connect 24 0 25 0;
#X connect 25 0 31 0; #X connect 25 0 27 0;
#X connect 28 0 20 0; #X connect 26 0 20 0;
#X connect 31 0 32 0; #X connect 27 0 28 0;
#X connect 34 0 10 0; #X connect 30 0 10 0;
#X connect 34 1 13 0; #X connect 30 1 13 0;

View File

@ -25,10 +25,10 @@ DEBUG = TRUE
# ***OBSOLETE, use [declare] inside patch instead*** # ***OBSOLETE, use [declare] inside patch instead***
#LIB = #LIB =
# Save and Get Pd lists in .fxp file via ([s svstdata] and [r rvstdata]) # All vst parameters are saved in the host session and additionally
# Some hosts don't work correctly with this. # you can set/get some "Pd list" in the session or to a .fxp/.fxb file
# If in doubt just use FALSE. # via [s svstdata] and [r rvstdata]
PROGRAMSARECHUNKS = FALSE PROGRAMSARECHUNKS = TRUE
# Number of VST parameters (up to 128) # Number of VST parameters (up to 128)
PARAMETERS = 1 PARAMETERS = 1

View File

@ -1,4 +1,4 @@
#N canvas 19 118 885 488 12; #N canvas 19 118 947 544 12;
#X obj 78 87 adc~, f 6; #X obj 78 87 adc~, f 6;
#X obj 73 241 loadbang; #X obj 73 241 loadbang;
#X msg 73 271 \; pd dsp 1 \;; #X msg 73 271 \; pd dsp 1 \;;
@ -18,18 +18,14 @@
#X text 320 114 range is 0..1; #X text 320 114 range is 0..1;
#X obj 64 393 r rvstplugname; #X obj 64 393 r rvstplugname;
#X symbolatom 64 425 26 0 0 0 - - - 0; #X symbolatom 64 425 26 0 0 0 - - - 0;
#X obj 478 422 r rvstdata; #X obj 478 447 r rvstdata;
#X obj 476 331 s svstdata; #X obj 476 356 s svstdata;
#X obj 478 454 print; #X obj 478 479 print;
#X symbolatom 673 132 26 0 0 0 - - - 0; #X symbolatom 673 132 26 0 0 0 - - - 0;
#X obj 673 100 r rvstprogname; #X obj 673 100 r rvstprogname;
#X obj 503 100 r rvstprognumber; #X obj 503 100 r rvstprognumber;
#X floatatom 503 124 5 0 0 0 - - - 0; #X floatatom 503 124 5 0 0 0 - - - 0;
#X text 464 273 1 send some data to the host's data chunk; #X msg 476 324 hello world 1.2;
#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; #N canvas 182 182 450 300 additionally 0;
#X msg 121 99 12 34 56 hello; #X msg 121 99 12 34 56 hello;
#X msg 150 136 0.2 0.4 0.78 foo; #X msg 150 136 0.2 0.4 0.78 foo;
@ -53,6 +49,10 @@
#X listbox 503 182 23 0 0 0 - - - 0; #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 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 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 0 7 0;
#X connect 0 1 6 0; #X connect 0 1 6 0;
#X connect 1 0 2 0; #X connect 1 0 2 0;
@ -65,14 +65,14 @@
#X connect 9 0 15 0; #X connect 9 0 15 0;
#X connect 10 0 11 0; #X connect 10 0 11 0;
#X connect 11 0 12 0; #X connect 11 0 12 0;
#X connect 14 0 34 0; #X connect 14 0 30 0;
#X connect 15 0 14 0; #X connect 15 0 14 0;
#X connect 17 0 18 0; #X connect 17 0 18 0;
#X connect 19 0 21 0; #X connect 19 0 21 0;
#X connect 23 0 22 0; #X connect 23 0 22 0;
#X connect 24 0 25 0; #X connect 24 0 25 0;
#X connect 25 0 31 0; #X connect 25 0 27 0;
#X connect 28 0 20 0; #X connect 26 0 20 0;
#X connect 31 0 32 0; #X connect 27 0 28 0;
#X connect 34 0 10 0; #X connect 30 0 10 0;
#X connect 34 1 13 0; #X connect 30 1 13 0;

View File

@ -25,10 +25,10 @@ DEBUG = TRUE
# ***OBSOLETE, use [declare] inside patch instead*** # ***OBSOLETE, use [declare] inside patch instead***
#LIB = #LIB =
# Save and Get Pd lists in .fxp file via ([s svstdata] and [r rvstdata]) # All vst parameters are saved in the host session and additionally
# Some hosts don't work correctly with this. # you can set/get some "Pd list" in the session or to a .fxp/.fxb file
# If in doubt just use FALSE. # via [s svstdata] and [r rvstdata]
PROGRAMSARECHUNKS = FALSE PROGRAMSARECHUNKS = TRUE
# Number of VST parameters (up to 128) # Number of VST parameters (up to 128)
PARAMETERS = 1 PARAMETERS = 1

View File

@ -625,23 +625,24 @@ bool pdvst::getOutputProperties(VstInt32 index, VstPinProperties* properties)
VstInt32 pdvst::getChunk (void** data, bool isPreset) VstInt32 pdvst::getChunk (void** data, bool isPreset)
{ {
VstInt32 len;
Chunk = new pdvstProgramAreChunks;
//MessageBoxA(NULL, "getchunk call", "debug", MB_OK); // all host gets here //MessageBoxA(NULL, "getchunk call", "debug", MB_OK); // all host gets here
if(*data) for (int i = 0; i < nParameters; i++)
{ {
//MessageBoxA(NULL, "getchunk if data", "debug", MB_OK); // not all hosts gets here Chunk->vstParam[i] = vstParam[i];
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 //MessageBoxA(NULL, "getchunk if data", "debug", MB_OK); // not all hosts gets here
return 0; 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) VstInt32 pdvst::setChunk (void* data, VstInt32 byteSize, bool isPreset)
@ -649,17 +650,29 @@ VstInt32 pdvst::setChunk (void* data, VstInt32 byteSize, bool isPreset)
//MessageBoxA(NULL, "setchunk call", "debug", MB_OK); //MessageBoxA(NULL, "setchunk call", "debug", MB_OK);
if(byteSize) if(byteSize)
{ {
Chunk = (pdvstProgramAreChunks*)data;
//MessageBoxA(NULL, "setchunk call if bytesize", "debug", MB_OK); //MessageBoxA(NULL, "setchunk call if bytesize", "debug", MB_OK);
WaitForSingleObject(pdvstTransferMutex, 10); WaitForSingleObject(pdvstTransferMutex, 10);
{ {
pdvstData->datachunk.direction = PD_RECEIVE; pdvstData->datachunk.direction = PD_RECEIVE;
pdvstData->datachunk.type = STRING_TYPE; pdvstData->datachunk.type = STRING_TYPE;
memset(&pdvstData->datachunk.value.stringData, '\0', MAXSTRINGSIZE); memset(&pdvstData->datachunk.value.stringData, '\0', MAXSTRLEN);
strncpy(pdvstData->datachunk.value.stringData,(char *)data, (size_t)byteSize); strcpy(pdvstData->datachunk.value.stringData, Chunk->Data);
pdvstData->datachunk.updated = 1; pdvstData->datachunk.updated = 1;
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); ReleaseMutex(pdvstTransferMutex);
} }
} }
return 0; return 0;
} }

View File

@ -53,6 +53,13 @@ typedef struct _pdvstProgram
float paramValue[MAXPARAMETERS]; float paramValue[MAXPARAMETERS];
} pdvstProgram; } pdvstProgram;
/* for programsarechunks*/
typedef struct _pdvstProgramAreChunks
{
float vstParam[MAXPARAMETERS];
char Data[MAXSTRLEN];
} pdvstProgramAreChunks;
class pdVstBuffer class pdVstBuffer
{ {
@ -128,6 +135,7 @@ protected:
char **vstParamName; char **vstParamName;
int nParameters; int nParameters;
pdvstProgram *program; pdvstProgram *program;
pdvstProgramAreChunks *Chunk;
int nPrograms; int nPrograms;
int nChannels; int nChannels;
int nExternalLibs; int nExternalLibs;