diff --git a/build/Release64/Pd_Chunks-test/Pd_Chunks-test.pd b/build/Release64/Pd_Chunks-test/Pd_Chunks-test.pd index 63d057c..2f2a958 100644 --- a/build/Release64/Pd_Chunks-test/Pd_Chunks-test.pd +++ b/build/Release64/Pd_Chunks-test/Pd_Chunks-test.pd @@ -20,6 +20,8 @@ #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 connect 0 0 7 0; #X connect 0 1 6 0; #X connect 1 0 2 0; @@ -38,3 +40,4 @@ #X connect 15 0 14 0; #X connect 17 0 18 0; #X connect 19 0 20 0; +#X connect 22 0 21 0; diff --git a/vst-scheduler/vstschedlib.c b/vst-scheduler/vstschedlib.c index ce60617..c88c05d 100644 --- a/vst-scheduler/vstschedlib.c +++ b/vst-scheduler/vstschedlib.c @@ -70,12 +70,20 @@ typedef struct _vstGuiNameReceiver t_vstGuiNameReceiver *vstGuiNameReceiver; +typedef struct _vstChunkReceiver +{ + t_object x_obj; +}t_vstChunkReceiver; + +t_vstChunkReceiver *vstChunkReceiver; + t_vstParameterReceiver *vstParameterReceivers[MAXPARAMETERS]; t_class *vstParameterReceiver_class; t_class *vstGuiNameReceiver_class; +t_class *vstChunkReceiver_class; char *pdvstTransferMutexName, *pdvstTransferFileMapName, @@ -242,6 +250,17 @@ void sendPdVstFloatParameter(t_vstParameterReceiver *x, t_float floatValue) ReleaseMutex(pdvstTransferMutex); } +void sendPdVstChunk(t_vstChunkReceiver *x, t_symbol *sym) +{ + + WaitForSingleObject(pdvstTransferMutex, INFINITE); + pdvstData->datachunk.type = STRING_TYPE; + pdvstData->datachunk.direction = PD_SEND; + pdvstData->datachunk.updated = 1; + strcpy(pdvstData->datachunk.value.stringData,sym->s_name); + ReleaseMutex(pdvstTransferMutex); +} + void sendPdVstGuiName(t_vstGuiNameReceiver *x, t_symbol *symbolValue) { WaitForSingleObject(pdvstTransferMutex, INFINITE); @@ -266,6 +285,7 @@ void makePdvstParameterReceivers() vstParameterReceivers[i]->x_sym = gensym(string); pd_bind(&vstParameterReceivers[i]->x_obj.ob_pd, gensym(string)); } + } void makePdvstGuiNameReceiver() @@ -275,6 +295,13 @@ void makePdvstGuiNameReceiver() } +void makevstChunkReceiver() +{ + vstChunkReceiver = (t_vstChunkReceiver *)pd_new(vstChunkReceiver_class); + pd_bind(&vstChunkReceiver->x_obj.ob_pd, gensym("svstdata")); + +} + @@ -348,7 +375,20 @@ int scheduler() class_addfloat(vstParameterReceiver_class, (t_method)sendPdVstFloatParameter); makePdvstParameterReceivers(); + + vstChunkReceiver_class = class_new(gensym("vstChunkReceiver"), + 0, + 0, + sizeof(t_vstChunkReceiver), + 0, + 0); + + class_addsymbol(vstChunkReceiver_class,(t_method)sendPdVstChunk); + makevstChunkReceiver(); + + + vstGuiNameReceiver_class = class_new(gensym("vstGuiNameReceiver"), 0, 0, diff --git a/vst-template/pdvst.cpp b/vst-template/pdvst.cpp index 7ffbd83..bc4c8f2 100644 --- a/vst-template/pdvst.cpp +++ b/vst-template/pdvst.cpp @@ -605,8 +605,8 @@ bool pdvst::getOutputProperties(VstInt32 index, VstPinProperties* properties) VstInt32 pdvst::getChunk (void** data, bool isPreset) { MessageBox(0,"getchunk","debug",MB_OK); - strcpy ((char *)*data, "hello world"); - return 11; + strcpy ((char *)*data, pdvstData->datachunk.value.stringData); + return strlen(pdvstData->datachunk.value.stringData); } VstInt32 pdvst::setChunk (void* data, VstInt32 byteSize, bool isPreset) @@ -1113,6 +1113,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);