From ae2a0507ce70fa52fc437e38ec1e0c40f1597d5d Mon Sep 17 00:00:00 2001 From: Lucas Cordiviola Date: Sun, 21 Apr 2024 07:16:06 -0300 Subject: [PATCH] seems working --- build/Release64/Pd_Chunks-test/Pd_Chunks-test.pd | 8 +++++--- vst-template/pdvst.cpp | 12 +++++++++++- vst-template/pdvstTransfer.h | 1 + 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/build/Release64/Pd_Chunks-test/Pd_Chunks-test.pd b/build/Release64/Pd_Chunks-test/Pd_Chunks-test.pd index 0b97269..f7ed972 100644 --- a/build/Release64/Pd_Chunks-test/Pd_Chunks-test.pd +++ b/build/Release64/Pd_Chunks-test/Pd_Chunks-test.pd @@ -1,4 +1,4 @@ -#N canvas 0 265 595 358 12; +#N canvas 0 265 818 358 12; #X obj 78 87 adc~, f 6; #X obj 73 241 loadbang; #X msg 73 271 \; pd dsp 1 \;; @@ -13,10 +13,11 @@ #X obj 242 263 dbtorms; #X obj 242 290 s gain; #X obj 300 225 s svstparameter0; -#X obj 277 75 vsl 50 128 0 1 0 0 empty empty empty 0 -9 0 10 -262144 --1 -1 0 1; +#X obj 277 75 vsl 50 128 0 1 0 0 empty empty empty 0 -9 0 10 #fcfcfc #000000 #000000 0 1; #X msg 277 42 set \$1; #X text 355 117 range is 0..1; +#X obj 498 10 r rvstplugname; +#X symbolatom 498 48 17 0 0 0 - - - 0; #X connect 0 0 7 0; #X connect 0 1 6 0; #X connect 1 0 2 0; @@ -33,3 +34,4 @@ #X connect 14 0 13 0; #X connect 14 0 10 0; #X connect 15 0 14 0; +#X connect 17 0 18 0; diff --git a/vst-template/pdvst.cpp b/vst-template/pdvst.cpp index 617c74c..7ffbd83 100644 --- a/vst-template/pdvst.cpp +++ b/vst-template/pdvst.cpp @@ -227,6 +227,7 @@ pdvst::pdvst(audioMasterCallback audioMaster) timeFromStartup=GetTickCount(); // JYG } programsAreChunks(true); + sendPlugName(globalPluginName); } pdvst::~pdvst() @@ -609,7 +610,16 @@ VstInt32 pdvst::getChunk (void** data, bool isPreset) } VstInt32 pdvst::setChunk (void* data, VstInt32 byteSize, bool isPreset) -{ +{ + + WaitForSingleObject(pdvstTransferMutex, 10); + { + pdvstData->datachunk.direction = PD_RECEIVE; + pdvstData->datachunk.type = STRING_TYPE; + strcpy(pdvstData->datachunk.value.stringData,(char *)data); + pdvstData->datachunk.updated = 1; + ReleaseMutex(pdvstTransferMutex); + } MessageBox(0,"setchunk","debug",MB_OK); debugLog("setchunk: %s", data); return 1; diff --git a/vst-template/pdvstTransfer.h b/vst-template/pdvstTransfer.h index ec6f84a..41c5d3c 100644 --- a/vst-template/pdvstTransfer.h +++ b/vst-template/pdvstTransfer.h @@ -121,6 +121,7 @@ typedef struct _pdvstTransferData pdvstMidiMessage midiQueue[MAXMIDIQUEUESIZE]; pdvstParameter guiState; pdvstParameter plugName; // transmitted by host + pdvstParameter datachunk; // get/set chunk from .fxp file pdvstParameter guiName; // transmitted by pd : name of gui window to be embedded // #ifdef VSTMIDIOUTENABLE int midiOutQueueSize;