diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2005-03-17 04:57:22 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2005-03-17 04:57:22 +0000 |
commit | 428806256328220836f6833c7b0fea5bc7157eac (patch) | |
tree | db5bf3316bcf833f4820a75dce0eab4c6d699bef /externals/grill/vst/src | |
parent | 4fe8863a1176f7fe4057d82b2844dd7127b13bca (diff) |
clean handling of plugin deletion (potentially open editor window etc.)
workarounds for Waves5 bundle
svn path=/trunk/; revision=2631
Diffstat (limited to 'externals/grill/vst/src')
-rw-r--r-- | externals/grill/vst/src/main.cpp | 84 | ||||
-rw-r--r-- | externals/grill/vst/src/vsthost.cpp | 7 | ||||
-rw-r--r-- | externals/grill/vst/src/vsthost.h | 8 |
3 files changed, 51 insertions, 48 deletions
diff --git a/externals/grill/vst/src/main.cpp b/externals/grill/vst/src/main.cpp index d1c369c3..29263cdd 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.0pre23" +#define VST_VERSION "0.1.0pre24" class vst @@ -616,7 +616,7 @@ bool vst::CbDsp() void vst::CbSignal() { - if(mute) + if(!plug || !plug->UniqueID() || mute) flext_dsp::CbSignal(); else if(bypass) { const int n = Blocksize(); @@ -651,55 +651,51 @@ void vst::CbSignal() for(; i < CntOutSig(); ++i) ZeroSamples(outsigs[i],n); } - else if(plug) { - if(sigmatch) - (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) - inv = const_cast<t_sample **>(insigs); - else { // more plug inputs than inlets - int i; - for(i = 0; i < cntin; ++i) tmpin[i] = const_cast<t_sample *>(insigs[i]); - - // set dangling inputs to zero - // according to mode... (e.g. set zero) - for(; i < inputs; ++i) ZeroSamples(tmpin[i] = vstin[i],n); - - inv = tmpin; - } + else if(sigmatch) + (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; - const bool more = outputs <= cntout; - if(more) // more outlets than plug outputs - outv = const_cast<t_sample **>(outsigs); - else { - int i; - for(i = 0; i < cntout; ++i) tmpout[i] = outsigs[i]; - for(; i < outputs; ++i) tmpout[i] = vstout[i]; + if(inputs <= cntin) + inv = const_cast<t_sample **>(insigs); + else { // more plug inputs than inlets + int i; + for(i = 0; i < cntin; ++i) tmpin[i] = const_cast<t_sample *>(insigs[i]); - outv = tmpout; - } + // set dangling inputs to zero + // according to mode... (e.g. set zero) + for(; i < inputs; ++i) ZeroSamples(tmpin[i] = vstin[i],n); - // call plugin DSP function - (plug->*vstfun)(inv,outv,n); + inv = tmpin; + } - if(more) { - // according to mode set dangling output vectors + const bool more = outputs <= cntout; + if(more) // more outlets than plug outputs + outv = const_cast<t_sample **>(outsigs); + else { + int i; + for(i = 0; i < cntout; ++i) tmpout[i] = outsigs[i]; + for(; i < outputs; ++i) tmpout[i] = vstout[i]; - // currently simply clear them.... - for(int i = outputs; i < cntout; ++i) - ZeroSamples(outsigs[i],n); - } + outv = tmpout; + } + + // call plugin DSP function + (plug->*vstfun)(inv,outv,n); + + if(more) { + // according to mode set dangling output vectors + + // currently simply clear them.... + for(int i = outputs; i < cntout; ++i) + ZeroSamples(outsigs[i],n); } } - else - flext_dsp::CbSignal(); } void vst::mg_progname(int argc,const t_atom *argv) const diff --git a/externals/grill/vst/src/vsthost.cpp b/externals/grill/vst/src/vsthost.cpp index 5f2443fc..8cb69f93 100644 --- a/externals/grill/vst/src/vsthost.cpp +++ b/externals/grill/vst/src/vsthost.cpp @@ -311,7 +311,12 @@ bool VSTPlugin::Instance(const char *name,const char *subname) long plugid; char tmp[64]; - // scan shell for subplugins + + // Waves5 continues with the next plug after the last loaded + // that's not what we want - workaround: swallow all remaining + while((plugid = Dispatch(effShellGetNextPlugin,0,0,tmp))) {} + + // restart from the beginning while((plugid = Dispatch(effShellGetNextPlugin,0,0,tmp))) { // subplug needs a name FLEXT_LOG1("subplug %s",tmp); diff --git a/externals/grill/vst/src/vsthost.h b/externals/grill/vst/src/vsthost.h index 0b1adef0..d4365e97 100644 --- a/externals/grill/vst/src/vsthost.h +++ b/externals/grill/vst/src/vsthost.h @@ -67,7 +67,7 @@ private: public: bool Is() const { return effect != NULL; } - long GetVersion() const { return effect?effect->version:0; } + long GetVersion() const { return effect->version; } bool IsSynth() const { return HasFlags(effFlagsIsSynth); } bool IsReplacing() const { return HasFlags(effFlagsCanReplacing); } @@ -77,8 +77,10 @@ public: const char *GetVendorName() const { return vendorname; } const char *GetDllName() const { return dllname.c_str(); } - int GetNumInputs() const { return effect?effect->numInputs:0; } - int GetNumOutputs() const { return effect?effect->numOutputs:0; } + long UniqueID() const { return effect->uniqueID; } + + int GetNumInputs() const { return effect->numInputs; } + int GetNumOutputs() const { return effect->numOutputs; } void ListPlugs(const t_symbol *sym) const; |