diff options
-rw-r--r-- | externals/grill/vst/pd/help-vst~.pd | 60 | ||||
-rw-r--r-- | externals/grill/vst/src/main.cpp | 35 | ||||
-rw-r--r-- | externals/grill/vst/src/main.h | 4 | ||||
-rw-r--r-- | externals/grill/vst/src/vsthost.cpp | 4 | ||||
-rw-r--r-- | externals/grill/vst/src/vsthost.h | 5 | ||||
-rw-r--r-- | externals/grill/vst/src/vstmaster.cpp | 16 |
6 files changed, 77 insertions, 47 deletions
diff --git a/externals/grill/vst/pd/help-vst~.pd b/externals/grill/vst/pd/help-vst~.pd index a43cdb2e..db5c5af9 100644 --- a/externals/grill/vst/pd/help-vst~.pd +++ b/externals/grill/vst/pd/help-vst~.pd @@ -1,11 +1,11 @@ -#N canvas 125 128 853 560 12;
+#N canvas 125 128 857 564 12;
#X obj 26 190 dac~;
#X obj 26 94 noise~;
#X obj 93 189 print A;
#X obj 443 431 tgl 15 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0
1;
#X msg 442 453 vis \$1;
-#X obj 231 430 tgl 15 0 empty empty empty 0 -6 0 8 -225271 -1 -1 1
+#X obj 231 430 tgl 15 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0
1;
#X msg 230 452 edit \$1;
#X msg 298 452 getedit;
@@ -159,27 +159,32 @@ #X text 256 239 mute output;
#X msg 230 262 mute \$1;
#X msg 312 262 getmute;
-#N canvas 200 110 477 376 parameters 0;
-#X obj 84 118 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -225271
+#N canvas 200 110 481 432 parameters 0;
+#X obj 114 125 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -225271
-1 -1 0 1;
-#X msg 81 135 param 2 \$1;
-#X obj 40 324 s \$0-vst;
-#X msg 44 36 getparams;
-#X text 122 36 get number of parameters;
-#X msg 183 136 getparam 2;
-#X msg 84 192 param gain 0;
-#X text 153 84 get parameter name;
-#X text 97 267 get value in textual representation;
-#X text 106 157 set/get parameter (0-based);
-#X msg 84 245 getptext \$1;
-#X obj 84 228 nbx 5 14 0 10000 0 0 empty empty empty 0 -6 0 10 -225271
+#X msg 111 142 param 2 \$1;
+#X obj 21 195 s \$0-vst;
+#X msg 113 26 getparams;
+#X text 191 26 get number of parameters;
+#X msg 213 143 getparam 2;
+#X msg 107 202 param gain 0;
+#X text 203 84 get parameter name;
+#X text 120 277 get value in textual representation;
+#X text 136 164 set/get parameter (0-based);
+#X msg 107 255 getptext \$1;
+#X obj 107 238 nbx 5 14 0 10000 0 0 empty empty empty 0 -6 0 10 -225271
-1 -1 0 256;
-#X obj 61 68 nbx 5 14 0 10000 0 0 empty empty empty 0 -6 0 10 -225271
+#X obj 111 68 nbx 5 14 0 10000 0 0 empty empty empty 0 -6 0 10 -225271
-1 -1 0 256;
-#X msg 61 86 getpname \$1;
-#X msg 189 245 getptext gain;
-#X msg 191 192 getparam gain;
-#X text 93 283 (may be ambigous!);
+#X msg 111 86 getpname \$1;
+#X msg 212 255 getptext gain;
+#X msg 214 202 getparam gain;
+#X text 116 293 (may be ambigous!);
+#X obj 106 335 tgl 15 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0
+1;
+#X msg 108 356 feedback \$1;
+#X msg 213 356 getfeedback;
+#X text 108 378 get parameter feedback through dump outlet;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 3 0 2 0;
@@ -191,6 +196,9 @@ #X connect 13 0 2 0;
#X connect 14 0 2 0;
#X connect 15 0 2 0;
+#X connect 17 0 18 0;
+#X connect 18 0 2 0;
+#X connect 19 0 2 0;
#X restore 444 143 pd parameters;
#N canvas 0 0 462 312 programs 0;
#X obj 39 245 s \$0-vst;
@@ -238,10 +246,10 @@ #X obj 17 225 s \$0-vst;
#X msg 112 78 samplepos \$1;
#X obj 111 60 nbx 5 14 0 1e+037 0 0 empty empty empty 0 -6 0 10 -225271
--1 -1 5 256;
+-1 -1 0 256;
#X msg 224 77 getsamplepos;
#X obj 111 108 nbx 5 14 0 1e+037 0 0 empty empty empty 0 -6 0 10 -225271
--1 -1 11 256;
+-1 -1 0 256;
#X msg 112 126 ppqpos \$1;
#X msg 199 127 getppqpos;
#X obj 111 153 nbx 5 14 5 400 0 1 empty empty empty 0 -6 0 10 -225271
@@ -250,18 +258,18 @@ #X msg 199 172 gettempo;
#X msg 113 28 playing \$1;
#X msg 203 28 getplaying;
-#X obj 112 -1 tgl 25 0 empty empty empty 0 -6 0 8 -225271 -1 -1 1 1
+#X obj 112 -1 tgl 25 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0 1
;
-#X obj 109 218 tgl 25 0 empty empty empty 0 -6 0 8 -225271 -1 -1 1
+#X obj 109 218 tgl 25 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0
1;
#X msg 110 247 looping \$1;
#X msg 200 247 getlooping;
#X obj 111 275 nbx 5 14 0 1e+037 0 0 empty empty empty 0 -6 0 10 -225271
--1 -1 5 256;
+-1 -1 0 256;
#X msg 112 293 loopstart \$1;
#X msg 222 293 getloopstart;
#X obj 111 319 nbx 5 14 0 1e+037 0 0 empty empty empty 0 -6 0 10 -225271
--1 -1 35 256;
+-1 -1 0 256;
#X msg 112 337 loopend \$1;
#X msg 222 337 getloopend;
#X obj 111 363 nbx 5 14 0 1e+037 0 0 empty empty empty 0 -6 0 10 -225271
diff --git a/externals/grill/vst/src/main.cpp b/externals/grill/vst/src/main.cpp index bf50b197..9a4b3a6c 100644 --- a/externals/grill/vst/src/main.cpp +++ b/externals/grill/vst/src/main.cpp @@ -26,7 +26,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. #endif -#define VST_VERSION "0.1.0pre20" +#define VST_VERSION "0.1.0pre21" class vst @@ -40,10 +40,10 @@ public: ~vst(); protected: - virtual void m_dsp(int n,t_signalvec const *insigs,t_signalvec const *outsigs); - virtual void m_signal(int n,t_sample *const *insigs,t_sample *const *outsigs); + virtual bool CbDsp(); + virtual void CbSignal(); - virtual void m_click() { ms_edit(true); } + virtual void CbClick() { ms_edit(true); } bool ms_plug(int argc,const t_atom *argv); bool ms_plug(const AtomList &args) { return ms_plug(args.Count(),args.Atoms()); } @@ -110,6 +110,8 @@ protected: void ms_playing(bool p) { if(plug) plug->SetPlaying(p); } void mg_looping(bool &p) { p = plug && plug->GetLooping(); } void ms_looping(bool p) { if(plug) plug->SetLooping(p); } + void mg_feedback(bool &p) { p = plug && plug->GetFeedback(); } + void ms_feedback(bool p) { if(plug) plug->SetFeedback(p); } void mg_samplepos(float &p) { p = plug?(float)plug->GetSamplePos():0; } void ms_samplepos(float p) { if(plug) plug->SetSamplePos(p); } void mg_ppqpos(float &p) { p = plug?(float)plug->GetPPQPos():0; } @@ -210,6 +212,7 @@ private: FLEXT_CALLVAR_B(mg_playing,ms_playing) FLEXT_CALLVAR_B(mg_looping,ms_looping) + FLEXT_CALLVAR_B(mg_feedback,ms_feedback) FLEXT_CALLVAR_F(mg_samplepos,ms_samplepos) FLEXT_CALLVAR_F(mg_ppqpos,ms_ppqpos) FLEXT_CALLVAR_F(mg_tempo,ms_tempo) @@ -261,7 +264,7 @@ void vst::Setup(t_classid c) FLEXT_CADDMETHOD_I(c,0,"getpname",m_pname); FLEXT_CADDATTR_VAR(c,"pnames",paramnames,ms_paramnames); FLEXT_CADDMETHOD_2(c,0,"param",ms_param,int,float); - FLEXT_CADDMETHOD_2(c,0,"param",ms_params,t_symptr,float); + FLEXT_CADDMETHOD_(c,0,"param",ms_params); FLEXT_CADDMETHOD_(c,0,"getparam",mg_param); FLEXT_CADDMETHOD_(c,0,"getparam",mg_params); FLEXT_CADDMETHOD_(c,0,"getptext",m_ptext); @@ -286,6 +289,7 @@ void vst::Setup(t_classid c) FLEXT_CADDATTR_VAR(c,"playing",mg_playing,ms_playing); FLEXT_CADDATTR_VAR(c,"looping",mg_looping,ms_looping); + FLEXT_CADDATTR_VAR(c,"feedback",mg_feedback,ms_feedback); FLEXT_CADDATTR_VAR(c,"samplepos",mg_samplepos,ms_samplepos); FLEXT_CADDATTR_VAR(c,"ppqpos",mg_ppqpos,ms_ppqpos); FLEXT_CADDATTR_VAR(c,"tempo",mg_tempo,ms_tempo); @@ -566,7 +570,7 @@ void vst::ms_subplug(int argc,const t_atom *argv) LoadPlug(); } -void vst::m_dsp(int n,t_signalvec const *,t_signalvec const *) +bool vst::CbDsp() { if(plug) { FLEXT_ASSERT(vstfun); @@ -579,13 +583,18 @@ void vst::m_dsp(int n,t_signalvec const *,t_signalvec const *) InitBuf(); } } + return true; } -void vst::m_signal(int n,t_sample *const *insigs,t_sample *const *outsigs) +void vst::CbSignal() { if(mute) - flext_dsp::m_signal(n,insigs,outsigs); + flext_dsp::CbSignal(); else if(bypass) { + const int n = Blocksize(); + t_sample *const *insigs = InSig(); + t_sample *const *outsigs = OutSig(); + // copy as many channels as possible and zero dangling ones int i,mx = CntInSig(); @@ -615,12 +624,14 @@ void vst::m_signal(int n,t_sample *const *insigs,t_sample *const *outsigs) ZeroSamples(outsigs[i],n); } else if(plug) { - const int inputs = plug->GetNumInputs(),outputs = plug->GetNumOutputs(); - if(sigmatch) - (plug->*vstfun)(const_cast<t_sample **>(insigs),const_cast<t_sample **>(outsigs),n); + (plug->*vstfun)(const_cast<t_sample **>(InSig()),const_cast<t_sample **>(OutSig()),Blocksize()); else { + const int inputs = plug->GetNumInputs(),outputs = plug->GetNumOutputs(); const int cntin = CntInSig(),cntout = CntOutSig(); + const int n = Blocksize(); + t_sample *const *insigs = InSig(); + t_sample *const *outsigs = OutSig(); t_sample **inv,**outv; if(inputs <= cntin) @@ -660,7 +671,7 @@ void vst::m_signal(int n,t_sample *const *insigs,t_sample *const *outsigs) } } else - flext_dsp::m_signal(n,insigs,outsigs); + flext_dsp::CbSignal(); } diff --git a/externals/grill/vst/src/main.h b/externals/grill/vst/src/main.h index ffd138ec..c395b63b 100644 --- a/externals/grill/vst/src/main.h +++ b/externals/grill/vst/src/main.h @@ -14,8 +14,8 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include <flext.h> -#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 405) -#error You need at least flext version 0.4.5 +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 500) +#error You need at least flext version 0.5.0 #endif #if FLEXT_OS == FLEXT_OS_WIN || FLEXT_OS == FLEXT_OS_MAC diff --git a/externals/grill/vst/src/vsthost.cpp b/externals/grill/vst/src/vsthost.cpp index 2c4f0643..3b9d6241 100644 --- a/externals/grill/vst/src/vsthost.cpp +++ b/externals/grill/vst/src/vsthost.cpp @@ -11,6 +11,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. const t_symbol + *VSTPlugin::sym_param, *VSTPlugin::sym_event, *VSTPlugin::sym_evmidi, *VSTPlugin::sym_evaudio, @@ -23,6 +24,7 @@ const t_symbol void VSTPlugin::Setup() { + sym_param = flext::MakeSymbol("param"); sym_event = flext::MakeSymbol("event"); sym_evmidi = flext::MakeSymbol("midi"); sym_evaudio = flext::MakeSymbol("audio"); @@ -50,7 +52,7 @@ VSTPlugin::VSTPlugin(Responder *resp) , midichannel(0),eventqusz(0) , paramnamecnt(0) , transchg(true) - , playing(false),looping(false) + , playing(false),looping(false),feedback(false) , samplerate(0) , samplepos(0),ppqpos(0) , tempo(120) diff --git a/externals/grill/vst/src/vsthost.h b/externals/grill/vst/src/vsthost.h index 8dc20394..bda1d538 100644 --- a/externals/grill/vst/src/vsthost.h +++ b/externals/grill/vst/src/vsthost.h @@ -214,6 +214,8 @@ public: bool GetPlaying() const { return playing; } void SetLooping(bool p) { if(looping != p) transchg = true,looping = p; } bool GetLooping() const { return looping; } + void SetFeedback(bool p) { feedback = p; } + bool GetFeedback() const { return feedback; } void SetSamplePos(double p) { if(samplepos != p) transchg = true,samplepos = p; } double GetSamplePos() const { return samplepos; } @@ -240,7 +242,7 @@ public: private: - bool playing,looping; + bool playing,looping,feedback; float samplerate; bool transchg; @@ -307,6 +309,7 @@ private: static long VSTCALLBACK Master(AEffect *effect, long opcode, long index, long value, void *ptr, float opt); + static const t_symbol *sym_param; static const t_symbol *sym_event,*sym_evmidi,*sym_evaudio,*sym_evvideo,*sym_evparam,*sym_evtrigger,*sym_evsysex,*sym_ev_; static const t_symbol *sym_midi[8]; diff --git a/externals/grill/vst/src/vstmaster.cpp b/externals/grill/vst/src/vstmaster.cpp index 863b57f9..108d8079 100644 --- a/externals/grill/vst/src/vstmaster.cpp +++ b/externals/grill/vst/src/vstmaster.cpp @@ -78,11 +78,12 @@ long VSTPlugin::Master(AEffect *effect, long opcode, long index, long value, voi switch (opcode) {
case audioMasterAutomate: // 0
-#ifdef FLEXT_LOGGING
- post("Automate index=%li value=%li opt=%f",index,value,opt);
-#endif
- // index, value given
- //! \todo set effect parameter
+ if(th && th->feedback && th->responder) {
+ t_atom lst[2];
+ SetInt(lst[0],index);
+ SetFloat(lst[1],opt);
+ th->responder->Respond(sym_param,2,lst);
+ }
return 0;
case audioMasterVersion: // 1
@@ -123,6 +124,7 @@ long VSTPlugin::Master(AEffect *effect, long opcode, long index, long value, voi if(th->transchg) { time.flags |= kVstTransportChanged; th->transchg = false; }
if(th->playing) time.flags |= kVstTransportPlaying;
if(th->looping) time.flags |= kVstTransportCycleActive;
+// if(th->feedback) time.flags |= kVstAutomationWriting;
time.sampleRate = th->samplerate;
time.samplePos = th->samplepos;
@@ -188,6 +190,10 @@ long VSTPlugin::Master(AEffect *effect, long opcode, long index, long value, voi // return thread state
return flext::GetThreadId() == flext::GetSysThreadId()?2:1;
+ case audioMasterGetAutomationState: // 24
+// return th?(th->feedback?2:1):0;
+ return 0;
+
case audioMasterGetVendorString: // 32
strcpy((char*)ptr,vendor);
return 0;
|