now working only with symbols

This commit is contained in:
Lucas Cordiviola 2024-04-21 10:29:49 -03:00
parent bea578104f
commit 9f9fae2822
3 changed files with 56 additions and 2 deletions

View File

@ -20,6 +20,8 @@
#X symbolatom 498 48 17 0 0 0 - - - 0; #X symbolatom 498 48 17 0 0 0 - - - 0;
#X obj 516 102 r rvstdata; #X obj 516 102 r rvstdata;
#X symbolatom 516 136 17 0 0 0 - - - 0; #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 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;
@ -38,3 +40,4 @@
#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 20 0; #X connect 19 0 20 0;
#X connect 22 0 21 0;

View File

@ -70,12 +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,
@ -242,6 +250,17 @@ void sendPdVstFloatParameter(t_vstParameterReceiver *x, t_float floatValue)
ReleaseMutex(pdvstTransferMutex); 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) void sendPdVstGuiName(t_vstGuiNameReceiver *x, t_symbol *symbolValue)
{ {
WaitForSingleObject(pdvstTransferMutex, INFINITE); WaitForSingleObject(pdvstTransferMutex, INFINITE);
@ -266,6 +285,7 @@ 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()
@ -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); class_addfloat(vstParameterReceiver_class, (t_method)sendPdVstFloatParameter);
makePdvstParameterReceivers(); 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"), vstGuiNameReceiver_class = class_new(gensym("vstGuiNameReceiver"),
0, 0,
0, 0,

View File

@ -605,8 +605,8 @@ bool pdvst::getOutputProperties(VstInt32 index, VstPinProperties* properties)
VstInt32 pdvst::getChunk (void** data, bool isPreset) VstInt32 pdvst::getChunk (void** data, bool isPreset)
{ {
MessageBox(0,"getchunk","debug",MB_OK); MessageBox(0,"getchunk","debug",MB_OK);
strcpy ((char *)*data, "hello world"); strcpy ((char *)*data, pdvstData->datachunk.value.stringData);
return 11; return strlen(pdvstData->datachunk.value.stringData);
} }
VstInt32 pdvst::setChunk (void* data, VstInt32 byteSize, bool isPreset) 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); ReleaseMutex(pdvstTransferMutex);