aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/vst
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2004-08-22 02:47:19 +0000
committerThomas Grill <xovo@users.sourceforge.net>2004-08-22 02:47:19 +0000
commitee368127a7c944dfe1d412edf3d0f95ecf3eb3f9 (patch)
tree8799b06a272d5a55e282c7fa7e607e735d5a5053 /externals/grill/vst
parente4eff144d6733edd2111e53613904f22cef9a109 (diff)
""
svn path=/trunk/; revision=1966
Diffstat (limited to 'externals/grill/vst')
-rw-r--r--externals/grill/vst/pd/help-vst~.pd (renamed from externals/grill/vst/pd/vst~.pd)77
-rw-r--r--externals/grill/vst/readme.txt2
-rw-r--r--externals/grill/vst/src/VstHost.cpp77
-rw-r--r--externals/grill/vst/src/main.cpp56
4 files changed, 171 insertions, 41 deletions
diff --git a/externals/grill/vst/pd/vst~.pd b/externals/grill/vst/pd/help-vst~.pd
index b8837589..8aaeb983 100644
--- a/externals/grill/vst/pd/vst~.pd
+++ b/externals/grill/vst/pd/help-vst~.pd
@@ -1,4 +1,4 @@
-#N canvas 123 23 868 653 12;
+#N canvas 118 11 818 647 12;
#X obj 26 190 dac~;
#X obj 26 94 noise~;
#X obj 444 172 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -225271
@@ -68,7 +68,7 @@
#X msg 543 190 getparam 2;
#X msg 105 295 getplug;
#X obj 26 323 s \$0-vst;
-#X text 175 294 set/get plugin;
+#X text 65 249 set/get plugin;
#X text 480 561 further information;
#X obj 23 15 cnv 15 700 58 empty empty vst~ 10 32 0 24 -260818 -1 0
;
@@ -129,34 +129,42 @@
#X obj 27 240 bng 25 250 50 0 empty empty empty 0 -6 0 8 -225271 -1
-1;
#X obj 27 271 openpanel;
-#N canvas 0 0 462 312 midi 0;
+#N canvas 461 281 486 331 midi 0;
#X obj 20 279 s \$0-vst;
-#X msg 20 29 note 10 100;
-#X msg 156 105 ctlchg 3 123;
+#X msg 238 147 ctlchg 3 123;
#X text 116 28 note on;
-#X msg 36 59 note 10 0;
-#X text 212 58 note off;
-#X text 266 104 control change;
-#X text 230 191 pitch bend;
-#X text 237 132 program change;
-#X msg 155 133 progchg 2;
-#X msg 122 59 noteoff 10;
-#X text 233 240 after touch;
-#X obj 156 171 nbx 5 14 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+#X text 287 29 note off;
+#X text 348 146 control change;
+#X text 312 233 pitch bend;
+#X text 319 174 program change;
+#X msg 237 175 progchg 2;
+#X msg 197 30 noteoff 10;
+#X text 315 282 after touch;
+#X obj 238 213 nbx 5 14 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+10 -262144 -1 -1 0 256;
+#X obj 238 264 nbx 5 14 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
10 -262144 -1 -1 0 256;
-#X obj 156 222 nbx 5 14 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+#X msg 237 233 pbend \$1;
+#X msg 236 283 atouch \$1;
+#X obj 35 71 nbx 5 14 -1e+037 1e+037 0 0 empty empty empty 0 -6 0 10
+-262144 -1 -1 0 256;
+#X msg 20 29 note 10 100;
+#X msg 36 94 note \$1 100;
+#X msg 193 94 noteoff \$1;
+#X obj 194 72 nbx 5 14 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
10 -262144 -1 -1 0 256;
-#X msg 155 191 pbend \$1;
-#X msg 154 241 atouch \$1;
#X connect 1 0 0 0;
-#X connect 2 0 0 0;
-#X connect 4 0 0 0;
-#X connect 9 0 0 0;
-#X connect 10 0 0 0;
-#X connect 12 0 14 0;
-#X connect 13 0 15 0;
-#X connect 14 0 0 0;
+#X connect 7 0 0 0;
+#X connect 8 0 0 0;
+#X connect 10 0 12 0;
+#X connect 11 0 13 0;
+#X connect 12 0 0 0;
+#X connect 13 0 0 0;
+#X connect 14 0 16 0;
#X connect 15 0 0 0;
+#X connect 16 0 0 0;
+#X connect 17 0 0 0;
+#X connect 18 0 17 0;
#X restore 25 581 pd midi;
#X text 93 582 midi messages for vst synths;
#X msg 414 442 getprogcats;
@@ -165,6 +173,20 @@
;
#X text 133 14 VST plugins for PD \, (C)2003-04 Thomas Grill;
#X obj 26 140 vst~ 1 2;
+#X obj 685 548 loadbang;
+#X msg 685 575 \; pd dsp 1;
+#X obj 233 367 tgl 15 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0
+1;
+#X obj 231 416 s \$0-vst;
+#X msg 232 389 bypass \$1;
+#X msg 314 389 getbypass;
+#X text 258 366 bypass plugin;
+#X obj 237 264 tgl 15 0 empty empty empty 0 -6 0 8 -225271 -1 -1 1
+1;
+#X obj 235 313 s \$0-vst;
+#X text 262 263 mute output;
+#X msg 236 286 mute \$1;
+#X msg 318 286 getmute;
#X connect 1 0 56 0;
#X connect 2 0 3 0;
#X connect 3 0 17 0;
@@ -193,3 +215,10 @@
#X connect 56 0 0 0;
#X connect 56 1 0 1;
#X connect 56 2 4 0;
+#X connect 57 0 58 0;
+#X connect 59 0 61 0;
+#X connect 61 0 60 0;
+#X connect 62 0 60 0;
+#X connect 64 0 67 0;
+#X connect 67 0 65 0;
+#X connect 68 0 65 0;
diff --git a/externals/grill/vst/readme.txt b/externals/grill/vst/readme.txt
index 20c0107c..9d96e2cb 100644
--- a/externals/grill/vst/readme.txt
+++ b/externals/grill/vst/readme.txt
@@ -49,6 +49,8 @@ Version history:
- plugin can be changed with plug attribute
- fixed crash on destroying vst~ with open editor window
- stripped all MFC code
+- fixed DSP initialization, zero dangling audio vectors
+- added "bypass" and "mute" attributes
0.0.0:
- version of mark@junklight.com
diff --git a/externals/grill/vst/src/VstHost.cpp b/externals/grill/vst/src/VstHost.cpp
index 1d4b6543..041acb76 100644
--- a/externals/grill/vst/src/VstHost.cpp
+++ b/externals/grill/vst/src/VstHost.cpp
@@ -133,7 +133,6 @@ void VSTPlugin::Free() // Called also in destruction
Dispatch(effMainsChanged, 0, 0);
Dispatch(effClose);
-// delete _pEffect; // <- Should check for the necessity of this command.
_pEffect = NULL;
if(h_dll) { FreeLibrary(h_dll); h_dll = NULL; }
}
@@ -344,17 +343,26 @@ void VSTPlugin::process( float **inputs, float **outputs, long sampleframes )
// Host callback dispatcher
long VSTPlugin::Master(AEffect *effect, long opcode, long index, long value, void *ptr, float opt)
{
-#if 1 //def FLEXT_DEBUG
- post("VST -> host: Eff = 0x%.8X, Opcode = %d, Index = %d, Value = %d, PTR = %.8X, OPT = %.3f\n",(int)effect, opcode,index,value,(int)ptr,opt);
+#if 0
+ audioMasterEnum op = (audioMasterEnum)opcode;
+ audioMasterEnumx opx = (audioMasterEnumx)opcode;
+#endif
+
+#ifdef FLEXT_DEBUG
+// post("VST -> host: Eff = 0x%.8X, Opcode = %d, Index = %d, Value = %d, PTR = %.8X, OPT = %.3f\n",(int)effect, opcode,index,value,(int)ptr,opt);
#endif
switch (opcode) {
case audioMasterAutomate: // 0
+#ifdef FLEXT_DEBUG
+ post("Automate index=%li value=%li",index,value);
+#endif
// index, value given
//! \todo set effect parameter
return 0;
case audioMasterVersion: // 1
- return 2;
+ // support VST 2.3
+ return 2300;
case audioMasterCurrentId: // 2
return 0;
case audioMasterIdle: // 3
@@ -363,12 +371,73 @@ long VSTPlugin::Master(AEffect *effect, long opcode, long index, long value, voi
case audioMasterPinConnected: // 4
//! \todo set connection state correctly (if possible..)
// index=pin, value=0..input, else..output
+#ifdef FLEXT_DEBUG
+ post("Pin connected pin=%li conn=%li",index,value);
+#endif
return 0; // 0 means connected
+ case audioMasterWantMidi: // 6
+#ifdef FLEXT_DEBUG
+ post("Want MIDI = %li",value);
+#endif
+ return 0; // VST header says: "currently ignored"
case audioMasterGetTime: // 7
return 0; // not supported
+ case audioMasterProcessEvents: { // 8
+ // VST event data from plugin
+ VstEvent *ev = static_cast<VstEvent *>(ptr);
+ if(ev->type == kVstMidiType) {
+ VstMidiEvent *mev = static_cast<VstMidiEvent *>(ptr);
+#ifdef FLEXT_DEBUG
+ if(mev->byteSize == 24)
+ post("MIDI event delta=%li len=%li offs=%li detune=%i offvel=%i",mev->deltaFrames,mev->noteLength,mev->noteOffset,(int)mev->detune,(int)mev->noteOffVelocity);
+ else
+ // has incorrect size
+ post("MIDI event");
+#endif
+ }
+ else {
+#ifdef FLEXT_DEBUG
+ post("VST event type=%li",ev->type);
+#endif
+ }
+ return 1;
+ }
+ case audioMasterSetTime: { // 9
+ VstTimeInfo *tminfo = static_cast<VstTimeInfo *>(ptr);
+#ifdef FLEXT_DEBUG
+ post("TimeInfo pos=%lf rate=%lf filter=%li",tminfo->samplePos,tminfo->sampleRate,value);
+#endif
+ return 0; // not supported
+ }
+ case audioMasterTempoAt: // 10
+ return 0; // not supported
case audioMasterGetNumAutomatableParameters: // 11
return 0; // not supported
+ case audioMasterGetCurrentProcessLevel: // 23
+ // return thread state
+ return flext::GetThreadId() == flext::GetSysThreadId()?2:1;
+ case audioMasterGetVendorString: // 32
+ strcpy((char*)ptr,"grrrr.org");
+ return 0;
+ case audioMasterGetProductString: // 33
+ strcpy((char *)ptr,"vst~ host external");
+ return 0;
+ case audioMasterGetVendorVersion: // 34
+ return 100;
+ case audioMasterCanDo: // 37
+#ifdef FLEXT_DEBUG
+ post("\taudioMasterCanDo PTR = %s",ptr);
+#endif
+ return 0; // not supported
+ case audioMasterGetLanguage: // 38
+ return kVstLangEnglish;
+ case audioMasterGetDirectory: // 41
+ // return full path of plugin
+ return 0; // not supported
default:
+#ifdef FLEXT_DEBUG
+ post("Unknown opcode %li",opcode);
+#endif
return 0;
}
}
diff --git a/externals/grill/vst/src/main.cpp b/externals/grill/vst/src/main.cpp
index 54450c77..2467e1bd 100644
--- a/externals/grill/vst/src/main.cpp
+++ b/externals/grill/vst/src/main.cpp
@@ -20,7 +20,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
using namespace std;
-#define VST_VERSION "0.1.0pre11"
+#define VST_VERSION "0.1.0pre12"
class vst:
@@ -57,9 +57,9 @@ protected:
V mg_params(I &p) const { p = plug?plug->GetNumParams():0; }
V mg_programs(I &p) const { p = plug?plug->GetNumPrograms():0; }
V mg_progcats(I &p) const { p = plug?plug->GetNumCategories():0; }
- V mg_plugname(const S *&s) const { s = MakeSymbol(plug?plug->GetName():""); }
- V mg_plugvendor(const S *&s) const { s = MakeSymbol(plug?plug->GetVendorName():""); }
- V mg_plugdll(const S *&s) const { s = MakeSymbol(plug?plug->GetDllName():""); }
+ V mg_plugname(const S *&s) const { s = plug?MakeSymbol(plug->GetName()):sym__; }
+ V mg_plugvendor(const S *&s) const { s = plug?MakeSymbol(plug->GetVendorName()):sym__; }
+ V mg_plugdll(const S *&s) const { s = plug?MakeSymbol(plug->GetDllName()):sym__; }
V mg_plugversion(I &v) const { v = plug?plug->GetVersion():0; }
V mg_issynth(BL &s) const { s = plug && plug->IsSynth(); }
@@ -86,7 +86,7 @@ private:
VSTPlugin *plug;
string plugname;
- BL echoparam,visible;
+ BL echoparam,visible,bypass,mute;
I blsz;
V (VSTPlugin::*vstfun)(R **insigs,R **outsigs,L n);
@@ -95,9 +95,11 @@ private:
V InitPlug();
V ClearPlug();
+ V InitPlugDSP();
V InitBuf();
V ClearBuf();
- static V Setup(t_classid);
+
+ static V Setup(t_classid);
FLEXT_CALLBACK_V(m_print)
@@ -107,6 +109,8 @@ private:
FLEXT_CALLVAR_B(mg_edit,ms_edit)
FLEXT_CALLGET_B(mg_editor)
FLEXT_CALLVAR_B(mg_vis,ms_vis)
+ FLEXT_ATTRVAR_B(bypass)
+ FLEXT_ATTRVAR_B(mute)
// FLEXT_CALLBACK_2(m_control,t_symptr,int)
FLEXT_CALLBACK_I(m_pitchbend)
@@ -153,6 +157,8 @@ V vst::Setup(t_classid c)
FLEXT_CADDATTR_VAR(c,"edit",mg_edit,ms_edit);
FLEXT_CADDATTR_GET(c,"editor",mg_editor);
FLEXT_CADDATTR_VAR(c,"vis",mg_vis,ms_vis);
+ FLEXT_CADDATTR_VAR1(c,"bypass",bypass);
+ FLEXT_CADDATTR_VAR1(c,"mute",mute);
FLEXT_CADDMETHOD_(c,0,"print",m_print);
FLEXT_CADDMETHOD_II(c,0,"note",m_note);
@@ -193,7 +199,7 @@ vst::vst(I argc,const A *argv):
plug(NULL),visible(false),
blsz(0),
vstfun(NULL),vstin(NULL),vstout(NULL),tmpin(NULL),tmpout(NULL),
- echoparam(false)
+ echoparam(false),bypass(false),mute(false)
{
if(argc >= 2 && CanbeInt(argv[0]) && CanbeInt(argv[1])) {
AddInSignal(GetAInt(argv[0]));
@@ -201,10 +207,8 @@ vst::vst(I argc,const A *argv):
if(argc >= 3 && !ms_plug(argc-2,argv+2)) InitProblem();
}
- else {
- post("%s - syntax: vst~ inputs outputs [plug]",thisName());
- InitProblem();
- }
+ else
+ throw "syntax: vst~ inputs outputs [plug]";
}
vst::~vst()
@@ -227,10 +231,19 @@ V vst::InitPlug()
vstfun = plug->IsReplacing()?VSTPlugin::processReplacing:VSTPlugin::process;
sigmatch = plug->GetNumInputs() == CntInSig() && plug->GetNumOutputs() == CntOutSig();
+ InitPlugDSP();
InitBuf();
}
+V vst::InitPlugDSP()
+{
+ FLEXT_ASSERT(plug);
+ // this might be invalid if DSP is switched off,
+ // but the plug will get updated settings with m_dsp later
+ plug->DspInit(Samplerate(),Blocksize());
+}
+
V vst::ClearBuf()
{
if(!plug) return;
@@ -399,9 +412,10 @@ BL vst::ms_plug(I argc,const A *argv)
V vst::m_dsp(I n,t_signalvec const *,t_signalvec const *)
{
if(plug) {
- plug->DspInit(Samplerate(),Blocksize());
FLEXT_ASSERT(vstfun);
+ InitPlugDSP();
+
if(blsz != Blocksize()) {
blsz = Blocksize();
ClearBuf();
@@ -412,7 +426,19 @@ V vst::m_dsp(I n,t_signalvec const *,t_signalvec const *)
V vst::m_signal(I n,R *const *insigs,R *const *outsigs)
{
- if(plug) {
+ if(mute)
+ flext_dsp::m_signal(n,insigs,outsigs);
+ else if(bypass) {
+ // copy as many channels as possible and zero dangling ones
+
+ int i,mx = CntInSig();
+ if(mx > CntOutSig()) mx = CntOutSig();
+ for(i = 0; i < mx; ++i)
+ CopySamples(outsigs[i],insigs[i],n);
+ for(; i < CntOutSig(); ++i)
+ ZeroSamples(outsigs[i],n);
+ }
+ else if(plug) {
const int inputs = plug->GetNumInputs(),outputs = plug->GetNumOutputs();
if(sigmatch)
@@ -448,6 +474,10 @@ V vst::m_signal(I n,R *const *insigs,R *const *outsigs)
if(more) {
// according to mode set dangling output vectors
+
+ // currently simply clear them....
+ for(int i = outputs; i < CntOutSig(); ++i)
+ ZeroSamples(outsigs[i],n);
}
}
}