From ac13c2a1bdc42d3605bce6bbfbed8719932154c9 Mon Sep 17 00:00:00 2001 From: Lucas Cordiviola Date: Mon, 22 Apr 2024 09:17:15 -0300 Subject: [PATCH] programsarechunks flag working --- build/Release64/Pd_Chunks-test/Pd_Chunks-test.pdv | 5 +++++ build/Release64/Pd_Gain-nogui/Pd_Gain-nogui.pdv | 2 +- vst-scheduler/vstschedlib.c | 2 +- vst-template/pdvst.cpp | 5 +++-- vst-template/pdvst.hpp | 1 - vst-template/pdvstMain.cpp | 13 +++++++++++++ 6 files changed, 23 insertions(+), 5 deletions(-) diff --git a/build/Release64/Pd_Chunks-test/Pd_Chunks-test.pdv b/build/Release64/Pd_Chunks-test/Pd_Chunks-test.pdv index 706a883..9a610da 100644 --- a/build/Release64/Pd_Chunks-test/Pd_Chunks-test.pdv +++ b/build/Release64/Pd_Chunks-test/Pd_Chunks-test.pdv @@ -25,6 +25,11 @@ DEBUG = TRUE # ***OBSOLETE, use [declare] inside patch instead*** #LIB = +# 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 = TRUE + # Number of VST parameters (up to 128) PARAMETERS = 1 diff --git a/build/Release64/Pd_Gain-nogui/Pd_Gain-nogui.pdv b/build/Release64/Pd_Gain-nogui/Pd_Gain-nogui.pdv index 84e4099..41b1966 100644 --- a/build/Release64/Pd_Gain-nogui/Pd_Gain-nogui.pdv +++ b/build/Release64/Pd_Gain-nogui/Pd_Gain-nogui.pdv @@ -23,7 +23,7 @@ DEBUG = FALSE # External libraries (comma delimited list, relative to pdvst/) # ***OBSOLETE, use [declare] inside patch instead*** -#LIB = +#LIB = # Number of VST parameters (up to 128) PARAMETERS = 1 diff --git a/vst-scheduler/vstschedlib.c b/vst-scheduler/vstschedlib.c index fd74892..9b083c0 100644 --- a/vst-scheduler/vstschedlib.c +++ b/vst-scheduler/vstschedlib.c @@ -492,7 +492,7 @@ int scheduler() pdvstData->plugName.updated=0; } - // lucarda get data chunk from file + // get data chunk from file if (pdvstData->datachunk.direction == PD_RECEIVE && \ pdvstData->datachunk.updated) { diff --git a/vst-template/pdvst.cpp b/vst-template/pdvst.cpp index ded91b2..b634229 100644 --- a/vst-template/pdvst.cpp +++ b/vst-template/pdvst.cpp @@ -56,6 +56,7 @@ extern char globalHostPdvstPath[MAXFILENAMELEN]; extern bool globalCustomGui; extern int globalCustomGuiWidth; extern int globalCustomGuiHeight; +extern bool globalProgramsAreChunks; extern bool globalIsASynth; extern pdvstProgram globalProgram[MAXPROGRAMS]; @@ -226,7 +227,7 @@ pdvst::pdvst(audioMasterCallback audioMaster) // {JYG see pdvst::setProgram below for explanation timeFromStartup=GetTickCount(); // JYG } - programsAreChunks(false); + programsAreChunks(globalProgramsAreChunks); sendPlugName(globalPluginName); } @@ -616,7 +617,7 @@ VstInt32 pdvst::getChunk (void** data, bool isPreset) VstInt32 pdvst::setChunk (void* data, VstInt32 byteSize, bool isPreset) { - MessageBox(NULL,"debug","setchunk",MB_OK); + //MessageBox(NULL,"debug","setchunk",MB_OK); WaitForSingleObject(pdvstTransferMutex, 10); { pdvstData->datachunk.direction = PD_RECEIVE; diff --git a/vst-template/pdvst.hpp b/vst-template/pdvst.hpp index 14c5cfa..881e168 100644 --- a/vst-template/pdvst.hpp +++ b/vst-template/pdvst.hpp @@ -173,7 +173,6 @@ protected: // JYG } - //void programsAreChunks (bool) {} }; #endif diff --git a/vst-template/pdvstMain.cpp b/vst-template/pdvstMain.cpp index 6c6b813..5679f9e 100644 --- a/vst-template/pdvstMain.cpp +++ b/vst-template/pdvstMain.cpp @@ -44,6 +44,7 @@ bool globalCustomGui = false; int globalCustomGuiWidth= 320; int globalCustomGuiHeight= 150; pdvstProgram globalProgram[MAXPROGRAMS]; +bool globalProgramsAreChunks = false; char *trimWhitespace(char *str); void parseSetupFile(); @@ -376,6 +377,18 @@ void parseSetupFile() globalProgram[progNum].paramValue[paramNum] = \ (float)atof(value); } + // programsarechunks (save custom data in .fxb file) + if (strcmp(param, "programsarechunks") == 0) + { + if (strcmp(strlwr(value), "true") == 0) + { + globalProgramsAreChunks = true; + } + else if (strcmp(strlwr(value), "false") == 0) + { + globalProgramsAreChunks = false; + } + } } } }