seems working

This commit is contained in:
Lucas Cordiviola 2024-10-02 05:41:43 -03:00
parent 80461d11c8
commit 4cc0976f81
3 changed files with 44 additions and 13 deletions

View File

@ -28,7 +28,7 @@ DEBUG = TRUE
# Save and Get Pd lists in .fxp file via ([s svstdata] and [r rvstdata]) # Save and Get Pd lists in .fxp file via ([s svstdata] and [r rvstdata])
# Some hosts don't work correctly with this. # Some hosts don't work correctly with this.
# If in doubt just use FALSE. # If in doubt just use FALSE.
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,20 +625,30 @@ bool pdvst::getOutputProperties(VstInt32 index, VstPinProperties* properties)
VstInt32 pdvst::getChunk (void** data, bool isPreset) VstInt32 pdvst::getChunk (void** data, bool isPreset)
{ {
VstInt32 len;
//MessageBoxA(NULL, "getchunk call", "debug", MB_OK); // all host gets here Chunk = new pdvstProgramAreChunks;
if(*data)
MessageBoxA(NULL, "getchunk call", "debug", MB_OK); // all host gets here
for (int i = 0; i < nParameters; i++)
{
Chunk->vstParam[i] = vstParam[i];
}
if(1)
{ {
//MessageBoxA(NULL, "getchunk if data", "debug", MB_OK); // not all hosts gets here //MessageBoxA(NULL, "getchunk if data", "debug", MB_OK); // not all hosts gets here
WaitForSingleObject(pdvstTransferMutex, 10); WaitForSingleObject(pdvstTransferMutex, 10);
{ {
//strcpy ((char *)*data, pdvstData->datachunk.value.stringData); memset(&Chunk->Data, '\0', MAXSTRLEN);
*data = pdvstData->datachunk.value.stringData; strcpy (Chunk->Data, pdvstData->datachunk.value.stringData);
len = (VstInt32)strlen(pdvstData->datachunk.value.stringData);
//memcpy(*data, pdvstData->datachunk.value.stringData, (size_t)len+1);
ReleaseMutex(pdvstTransferMutex); ReleaseMutex(pdvstTransferMutex);
} }
return len+1;
debugLog("luc:debug-size-of-chunk %d", sizeof(*Chunk));
*data = (void*)Chunk;
return sizeof(*Chunk);
} }
else else
return 0; return 0;
@ -648,18 +658,31 @@ 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);
//memcpy(pdvstData->datachunk.value.stringData, Chunk->Data, MAXSTRLEN);
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;