program change name and number receivers

This commit is contained in:
Lucas Cordiviola 2024-04-25 04:58:24 -03:00
parent 290c706d1a
commit ee34558c30
6 changed files with 110 additions and 27 deletions

View File

@ -1,4 +1,4 @@
#N canvas 0 265 818 358 12;
#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 \;;
@ -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 42 26 0 0 0 - - - 0;
#X obj 516 102 r rvstdata;
#X obj 516 265 s svstdata;
#X obj 516 134 print;
#X msg 516 233 test 1.3 hello 0.3 2 ff;
#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;
@ -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 34 0;
#X connect 15 0 14 0;
#X connect 17 0 18 0;
#X connect 19 0 21 0;
#X connect 22 0 20 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

@ -51,4 +51,7 @@ PARAMETER0 = 0.0
#another program
PROGRAM = -6dB
PARAMETER0 = 0.94
PARAMETER0 = 0.5
#another program
PROGRAM = test empty param

View File

@ -205,7 +205,6 @@ int setPdvstPlugName(char* instanceName)
return 0;
}
/*receive data chunk from host*/
int setPdvstChunk(const char *amsg)
{
@ -491,7 +490,7 @@ int scheduler()
pdvstData->plugName.updated=0;
}
// get data chunk from file
// check for data chunk from file
if (pdvstData->datachunk.direction == PD_RECEIVE && \
pdvstData->datachunk.updated)
{
@ -499,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

@ -493,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);
@ -500,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
@ -625,7 +645,7 @@ VstInt32 pdvst::getChunk (void** data, bool isPreset)
}
VstInt32 pdvst::setChunk (void* data, VstInt32 byteSize, bool isPreset)
{
{
//MessageBoxA(NULL, "setchunk call", "debug", MB_OK);
if(byteSize)
{
@ -1132,9 +1152,9 @@ void pdvst::updatePdvstParameters()
}
// to data chunk
if (pdvstData->datachunk.direction == PD_SEND && \
pdvstData->datachunk.updated)
{

View File

@ -99,8 +99,9 @@ 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];

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;