aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/vst/src
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2005-03-13 05:02:28 +0000
committerThomas Grill <xovo@users.sourceforge.net>2005-03-13 05:02:28 +0000
commitbf9523d0f232dc39ddf0b5d1985e93d431100c13 (patch)
tree620ffe0e85e061888b22b724211b37d82f870ada /externals/grill/vst/src
parentb50fbb2f1b491fd365b64d51844791a741eaf6e5 (diff)
fixed bug with param method
minimal updated for new flext function naming feedback attribute for parameter reporting added event processing (like Midi in) svn path=/trunk/; revision=2626
Diffstat (limited to 'externals/grill/vst/src')
-rw-r--r--externals/grill/vst/src/main.cpp35
-rw-r--r--externals/grill/vst/src/main.h4
-rw-r--r--externals/grill/vst/src/vsthost.cpp4
-rw-r--r--externals/grill/vst/src/vsthost.h5
-rw-r--r--externals/grill/vst/src/vstmaster.cpp16
5 files changed, 43 insertions, 21 deletions
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;