seems working

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

View File

@ -28,7 +28,7 @@ DEBUG = TRUE
# Save and Get Pd lists in .fxp file via ([s svstdata] and [r rvstdata])
# Some hosts don't work correctly with this.
# If in doubt just use FALSE.
PROGRAMSARECHUNKS = FALSE
PROGRAMSARECHUNKS = TRUE
# Number of VST parameters (up to 128)
PARAMETERS = 1

View File

@ -149,6 +149,7 @@ pdvst::pdvst(audioMasterCallback audioMaster)
vstParamName[i] = new char[MAXSTRLEN];
memset(vstParam, 0, MAXPARAMETERS * sizeof(float));
program = new pdvstProgram[MAXPROGRAMS];
Chunk = new pdvstProgramAreChunks;
for (i = 0; i < nExternalLibs; i++)
{
@ -626,19 +627,32 @@ bool pdvst::getOutputProperties(VstInt32 index, VstPinProperties* properties)
VstInt32 pdvst::getChunk (void** data, bool isPreset)
{
VstInt32 len;
//MessageBoxA(NULL, "getchunk call", "debug", MB_OK); // all host gets here
if(*data)
int i = 0;
MessageBoxA(NULL, "getchunk call", "debug", MB_OK); // all host gets here
for (i = 0; i < MAXPARAMS; i++)
{
Chunk->vstParam[i] = vstParam[i];
}
if(1)
{
//MessageBoxA(NULL, "getchunk if data", "debug", MB_OK); // not all hosts gets here
WaitForSingleObject(pdvstTransferMutex, 10);
{
//strcpy ((char *)*data, pdvstData->datachunk.value.stringData);
*data = pdvstData->datachunk.value.stringData;
len = (VstInt32)strlen(pdvstData->datachunk.value.stringData);
strcpy (Chunk->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;
debugLog("luc:debug-size-of-chunk %d", sizeof(*Chunk));
*data = Chunk;
//memcpy(*data,(char *)Chunk, sizeof(*Chunk)+1);
debugLog("luc:debug %s", (char*)data);
return sizeof(*Chunk)+1;
}
else
return 0;
@ -646,16 +660,17 @@ VstInt32 pdvst::getChunk (void** data, bool isPreset)
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)
{
{
Chunk = (pdvstProgramAreChunks*)data;
//MessageBoxA(NULL, "setchunk call if bytesize", "debug", MB_OK);
WaitForSingleObject(pdvstTransferMutex, 10);
{
pdvstData->datachunk.direction = PD_RECEIVE;
pdvstData->datachunk.type = STRING_TYPE;
memset(&pdvstData->datachunk.value.stringData, '\0', MAXSTRINGSIZE);
strncpy(pdvstData->datachunk.value.stringData,(char *)data, (size_t)byteSize);
strcpy(pdvstData->datachunk.value.stringData, Chunk->Data);
pdvstData->datachunk.updated = 1;
ReleaseMutex(pdvstTransferMutex);
}

View File

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