From 1fa5251f469a756d09f7f7c98113a69186688206 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Sat, 11 Sep 2004 04:09:17 +0000 Subject: "" svn path=/trunk/; revision=2023 --- externals/grill/flext/changes.txt | 1 + externals/grill/flext/source/flatom.cpp | 3 +- externals/grill/flext/source/flbind.cpp | 4 +- externals/grill/flext/source/flclass.h | 12 +- externals/grill/flext/source/flmeth.cpp | 4 +- externals/grill/flext/source/flqueue.cpp | 359 ++++++++++++++----------------- externals/grill/pool/pool.vcproj | 67 ++++++ externals/grill/vst/readme.txt | 3 +- externals/grill/vst/src/EditorWin.cpp | 25 ++- externals/grill/vst/src/VstHost.cpp | 56 ++++- externals/grill/vst/src/VstHost.h | 6 +- externals/grill/vst/src/main.cpp | 16 +- 12 files changed, 324 insertions(+), 232 deletions(-) (limited to 'externals') diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt index d39e882e..8a9b6a9b 100644 --- a/externals/grill/flext/changes.txt +++ b/externals/grill/flext/changes.txt @@ -28,6 +28,7 @@ Version history: - attribute editor: zoomed editor accepts , as newline separator - attribute editor: close editor window on object destruction - fixed $0-arguments in attribute saving +- introducing ring buffer for message queue (thanks to Tom Schouten) 0.4.6: - added a text edit window for list attributes diff --git a/externals/grill/flext/source/flatom.cpp b/externals/grill/flext/source/flatom.cpp index 45739e66..593a58b5 100644 --- a/externals/grill/flext/source/flatom.cpp +++ b/externals/grill/flext/source/flatom.cpp @@ -42,9 +42,8 @@ int flext::CmpAtom(const t_atom &a,const t_atom &b) t_atom *flext::CopyList(int argc,const t_atom *argv) { - int i; t_atom *dst = new t_atom[argc]; - for(i = 0; i < argc; ++i) CopyAtom(dst+i,argv+i); + memcpy(dst,argv,argc*sizeof(t_atom)); return dst; } diff --git a/externals/grill/flext/source/flbind.cpp b/externals/grill/flext/source/flbind.cpp index 8eefefb4..ce775de0 100644 --- a/externals/grill/flext/source/flbind.cpp +++ b/externals/grill/flext/source/flbind.cpp @@ -35,7 +35,7 @@ void flext_base::SetupBindProxy() #elif FLEXT_SYS == FLEXT_SYS_MAX pxbnd_class = new t_class; - pxbnd_class->c_sym = gensym(""); + pxbnd_class->c_sym = sym__; pxbnd_class->c_freelist = &px_freelist; pxbnd_class->c_freefun = NULL; pxbnd_class->c_size = sizeof(pxbnd_object); @@ -43,7 +43,7 @@ void flext_base::SetupBindProxy() pxbnd_class->c_noinlet = 1; px_messlist[0].m_sym = (t_symbol *)pxbnd_class; - px_messlist[1].m_sym = gensym("anything"); + px_messlist[1].m_sym = sym_anything; px_messlist[1].m_fun = (method)pxbnd_object::px_method; px_messlist[1].m_type[0] = A_GIMME; px_messlist[1].m_type[1] = 0; diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index cd1d4943..5183c5fa 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -276,29 +276,29 @@ public: //! Send bang to self (inlet n) - void ToSelfBang(int n) const; + void ToSelfBang(int n) const { ToQueueBang(-1-n); } //! Send float to self (inlet n) - void ToSelfFloat(int n,float f) const; + void ToSelfFloat(int n,float f) const { ToQueueFloat(-1-n,f); } //! Send integer to self (inlet n) - void ToSelfInt(int n,int f) const; + void ToSelfInt(int n,int f) const { ToQueueInt(-1-n,f); } //! Send boolean to self (inlet n) void ToSelfBool(int n,bool f) const { ToSelfInt(n,f?1:0); } //! Send symbol to self (inlet n) - void ToSelfSymbol(int n,const t_symbol *s) const; + void ToSelfSymbol(int n,const t_symbol *s) const { ToQueueSymbol(-1-n,s); } //! Send string aka symbol to self (inlet 0) void ToSelfString(int n,const char *s) const { ToSelfSymbol(n,MakeSymbol(s)); } //! Send list to self (inlet n) - void ToSelfList(int n,int argc,const t_atom *argv) const; + void ToSelfList(int n,int argc,const t_atom *argv) const { ToQueueList(-1-n,argc,argv); } //! Send list to self (inlet n) void ToSelfList(int n,const AtomList &list) const { ToSelfList(n,list.Count(),list.Atoms()); } //! Send anything to self (inlet n) - void ToSelfAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const; + void ToSelfAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const { ToQueueAnything(-1-n,s,argc,argv); } //! Send anything to self (inlet n) void ToSelfAnything(int n,const AtomAnything &any) const { ToSelfAnything(n,any.Header(),any.Count(),any.Atoms()); } diff --git a/externals/grill/flext/source/flmeth.cpp b/externals/grill/flext/source/flmeth.cpp index 21e15f5c..eaaca622 100755 --- a/externals/grill/flext/source/flmeth.cpp +++ b/externals/grill/flext/source/flmeth.cpp @@ -125,10 +125,12 @@ void flext_base::ListMethods(AtomList &la,int inlet) const bool flext_base::ListMethods(int inlet) const { + static const t_symbol *sym_methods = MakeSymbol("methods"); + if(procattr) { AtomList la; ListMethods(la,inlet); - ToOutAnything(GetOutAttr(),MakeSymbol("methods"),la.Count(),la.Atoms()); + ToOutAnything(GetOutAttr(),sym_methods,la.Count(),la.Atoms()); return true; } else diff --git a/externals/grill/flext/source/flqueue.cpp b/externals/grill/flext/source/flqueue.cpp index 41941734..4165e968 100755 --- a/externals/grill/flext/source/flqueue.cpp +++ b/externals/grill/flext/source/flqueue.cpp @@ -19,55 +19,160 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "flext.h" #include "flinternal.h" + #ifdef FLEXT_THREADS //! Thread id of message queue thread flext::thrid_t flext::thrmsgid = 0; #endif + +#define QUEUE_LENGTH 256 +#define QUEUE_ATOMS 1024 + class qmsg { public: - qmsg(flext_base *b): nxt(NULL),th(b),tp(tp_none) {} - ~qmsg(); - - qmsg *nxt; - - void Clear(); + void Set(flext_base *t,int o,const t_symbol *s,int ac,const t_atom *av) { th = t,out = o,sym = s,argc = ac,argv = av; } + + // \note PD lock must already be held by caller + void Send() const + { + if(out < 0) + // message to self + th->m_methodmain(-1-out,sym,argc,argv); + else + // message to outlet + th->ToSysAnything(out,sym,argc,argv); + } - void SetBang(int o) { Clear(); out = o; tp = tp_bang; } - void SetFloat(int o,float f) { Clear(); out = o; tp = tp_float; _float = f; } - void SetInt(int o,int i) { Clear(); out = o; tp = tp_int; _int = i; } - void SetSymbol(int o,const t_symbol *s) { Clear(); out = o; tp = tp_sym; _sym = s; } - void SetList(int o,int argc,const t_atom *argv) { Clear(); out = o; tp = tp_list; _list.argc = argc,_list.argv = flext::CopyList(argc,argv); } - void SetAny(int o,const t_symbol *s,int argc,const t_atom *argv) { Clear(); out = o; tp = tp_any; _any.s = s,_any.argc = argc,_any.argv = flext::CopyList(argc,argv); } + int Args() const { return argc; } +private: flext_base *th; int out; - enum { tp_none,tp_bang,tp_float,tp_int,tp_sym,tp_list,tp_any } tp; - union { - float _float; - int _int; - const t_symbol *_sym; - struct { int argc; t_atom *argv; } _list; - struct { const t_symbol *s; int argc; t_atom *argv; } _any; - }; + const t_symbol *sym; + int argc; + const t_atom *argv; }; -qmsg::~qmsg() -{ - Clear(); - if(nxt) delete nxt; -} +// _should_ work without locks.... have yet to check if it really does.... +class Queue: + public flext +{ +public: + Queue() + { + qhead = qtail = 0; + ahead = atail = 0; + } -void qmsg::Clear() -{ - if(tp == tp_list) { if(_list.argv) delete[] _list.argv; } - else if(tp == tp_any) { if(_any.argv) delete[] _any.argv; } - tp = tp_none; -} + bool Empty() const { return qhead == qtail; } + + int Count() const + { + int c = qtail-qhead; + return c >= 0?c:c+QUEUE_LENGTH; + } + + const qmsg &Head() { return lst[qhead]; } + + void Pop() + { + PopAtoms(Head().Args()); + qhead = (qhead+1)%QUEUE_LENGTH; + } + + void Push(flext_base *th,int o) // bang + { + Set(th,o,sym_bang,0,NULL); + } + + void Push(flext_base *th,int o,float dt) + { + t_atom *at = GetAtoms(1); + SetFloat(*at,dt); + Set(th,o,sym_float,1,at); + } + + void Push(flext_base *th,int o,int dt) + { + t_atom *at = GetAtoms(1); + SetInt(*at,dt); +#if FLEXT_SYS == FLEXT_SYS_PD + const t_symbol *sym = sym_float; +#elif FLEXT_SYS == FLEXT_SYS_MAX + const t_symbol *sym = sym_int; +#else +#error Not implemented! +#endif + Set(th,o,sym,1,at); + } + + void Push(flext_base *th,int o,const t_symbol *dt) + { + t_atom *at = GetAtoms(1); + SetSymbol(*at,dt); + Set(th,o,sym_symbol,1,at); + } + + void Push(flext_base *th,int o,int argc,const t_atom *argv) + { + t_atom *at = GetAtoms(argc); + memcpy(at,argv,argc*sizeof(t_atom)); + Set(th,o,sym_list,argc,at); + } + + void Push(flext_base *th,int o,const t_symbol *sym,int argc,const t_atom *argv) + { + t_atom *at = GetAtoms(argc); + memcpy(at,argv,argc*sizeof(t_atom)); + Set(th,o,sym,argc,at); + } + +protected: + void Set(flext_base *th,int o,const t_symbol *sym,int argc,const t_atom *argv) + { + FLEXT_ASSERT(Count() < QUEUE_LENGTH-1); + lst[qtail].Set(th,o,sym,argc,argv); + qtail = (qtail+1)%QUEUE_LENGTH; + } + + int CntAtoms() const + { + int c = atail-ahead; + return c >= 0?c:c+QUEUE_ATOMS; + } + + // must return contiguous region + t_atom *GetAtoms(int argc) + { + // \todo check for available space + + if(atail+argc >= QUEUE_ATOMS) { + atail = argc; + return atoms; + } + else { + t_atom *at = atoms+atail; + atail += argc; + return at; + } + } + + void PopAtoms(int argc) + { + const int p = ahead+argc; + ahead = p >= QUEUE_ATOMS?argc:p; + } + + int qhead,qtail; + qmsg lst[QUEUE_LENGTH]; + int ahead,atail; + t_atom atoms[QUEUE_ATOMS]; +}; + +static Queue queue; -static volatile int qcnt = 0; -static qmsg *volatile qhead = NULL,*volatile qtail = NULL; #ifdef FLEXT_QTHR static flext::ThrCond qthrcond; @@ -75,102 +180,33 @@ static flext::ThrCond qthrcond; static t_qelem *qclk = NULL; #endif -#ifdef FLEXT_THREADS -static flext::ThrMutex qmutex; -#endif #define CHUNK 10 -static void QWork(bool qlock,bool syslock) +static void QWork(bool syslock) { for(;;) { // Since qcnt can only be increased from any other function than QWork // qc will be a minimum guaranteed number of present queue elements. // On the other hand, if new queue elements are added by the methods called // in the loop, these will be sent in the next tick to avoid recursion overflow. - int qc = qcnt; + int qc = queue.Count(); if(!qc) break; #ifdef FLEXT_QTHR if(syslock) sys_lock(); #endif - for(int i = 0; i < qc && qhead; ++i) { - #ifdef FLEXT_THREADS - if(qlock) qmutex.Lock(); - #endif - qmsg *m = qhead; - qcnt--; - qhead = m->nxt; - if(!qhead) qtail = NULL; - m->nxt = NULL; - #ifdef FLEXT_THREADS - if(qlock) qmutex.Unlock(); - #endif - - if(m->out < 0) { - // message to self - - const int n = -1-m->out; - t_atom tmp; - - switch(m->tp) { - case qmsg::tp_bang: - m->th->m_methodmain(n,flext::sym_bang,0,&tmp); - break; - case qmsg::tp_float: - flext::SetFloat(tmp,m->_float); - m->th->m_methodmain(n,flext::sym_float,1,&tmp); - break; - case qmsg::tp_int: - flext::SetInt(tmp,m->_int); - #if FLEXT_SYS == FLEXT_SYS_PD - m->th->m_methodmain(n,flext::sym_float,1,&tmp); - #elif FLEXT_SYS == FLEXT_SYS_MAX - m->th->m_methodmain(n,flext::sym_int,1,&tmp); - #else - #error Not implemented! - #endif - case qmsg::tp_sym: - flext::SetSymbol(tmp,m->_sym); - m->th->m_methodmain(n,flext::sym_symbol,1,&tmp); - break; - case qmsg::tp_list: - m->th->m_methodmain(n,flext::sym_list,m->_list.argc,m->_list.argv); - break; - case qmsg::tp_any: - m->th->m_methodmain(n,m->_any.s,m->_any.argc,m->_any.argv); - break; - #ifdef FLEXT_DEBUG - default: ERRINTERNAL(); - #endif - } - } - else { - // message to outlet - - switch(m->tp) { - case qmsg::tp_bang: m->th->ToSysBang(m->out); break; - case qmsg::tp_float: m->th->ToSysFloat(m->out,m->_float); break; - case qmsg::tp_int: m->th->ToSysInt(m->out,m->_int); break; - case qmsg::tp_sym: m->th->ToSysSymbol(m->out,m->_sym); break; - case qmsg::tp_list: m->th->ToSysList(m->out,m->_list.argc,m->_list.argv); break; - case qmsg::tp_any: m->th->ToSysAnything(m->out,m->_any.s,m->_any.argc,m->_any.argv); break; - #ifdef FLEXT_DEBUG - default: ERRINTERNAL(); - #endif - } - } - - // delete processed queue element - delete m; + for(int i = 0; i < qc; ++i) { + queue.Head().Send(); + queue.Pop(); } // inner loop #ifdef FLEXT_QTHR if(syslock) sys_unlock(); #endif - } // for(;;) + } } #if !defined(FLEXT_QTHR) @@ -181,11 +217,10 @@ static void QTick(fts_object_t *c,int winlet, fts_symbol_t s, int ac, const fts_ static void QTick(flext_base *c) { #endif -// post("qtick"); #ifdef FLEXT_THREADS FLEXT_ASSERT(flext::IsSystemThread()); #endif - QWork(true,false); + QWork(false); } #endif @@ -201,30 +236,12 @@ void flext_base::QFlush(flext_base *th) return; } #endif -#ifdef FLEXT_THREADS - qmutex.Lock(); -#endif - while(qcnt) QWork(false,false); -#ifdef FLEXT_THREADS - qmutex.Unlock(); -#endif + + while(!queue.Empty()) QWork(false); } -static void Queue(qmsg *m) +static void Trigger() { -// post("Queue"); - -#ifdef FLEXT_THREADS - qmutex.Lock(); -#endif - if(qtail) qtail->nxt = m; - else qhead = m; - qtail = m; - qcnt++; -#ifdef FLEXT_THREADS - qmutex.Unlock(); -#endif - #if FLEXT_SYS == FLEXT_SYS_PD #ifdef FLEXT_QTHR // wake up a worker thread @@ -249,7 +266,7 @@ void flext_base::QWorker(thr_params *) thrmsgid = GetThreadId(); for(;;) { qthrcond.Wait(); - QWork(true,true); + QWork(true); } } #endif @@ -260,10 +277,6 @@ void flext_base::StartQueue() if(started) return; else started = true; - // message queue ticker - qhead = qtail = NULL; - qcnt = 0; - #ifdef FLEXT_QTHR LaunchThread(QWorker,NULL); #else @@ -277,86 +290,36 @@ void flext_base::StartQueue() void flext_base::ToQueueBang(int o) const { - FLEXT_ASSERT(o >= 0); - qmsg *m = new qmsg(const_cast(this)); - m->SetBang(o); - Queue(m); + queue.Push(const_cast(this),o); + Trigger(); } void flext_base::ToQueueFloat(int o,float f) const { - FLEXT_ASSERT(o >= 0); - qmsg *m = new qmsg(const_cast(this)); - m->SetFloat(o,f); - Queue(m); + queue.Push(const_cast(this),o,f); + Trigger(); } void flext_base::ToQueueInt(int o,int f) const { - FLEXT_ASSERT(o >= 0); - qmsg *m = new qmsg(const_cast(this)); - m->SetInt(o,f); - Queue(m); + queue.Push(const_cast(this),o,f); + Trigger(); } void flext_base::ToQueueSymbol(int o,const t_symbol *s) const { - FLEXT_ASSERT(o >= 0); - qmsg *m = new qmsg(const_cast(this)); - m->SetSymbol(o,s); - Queue(m); + queue.Push(const_cast(this),o,s); + Trigger(); } void flext_base::ToQueueList(int o,int argc,const t_atom *argv) const { - FLEXT_ASSERT(o >= 0); - qmsg *m = new qmsg(const_cast(this)); - m->SetList(o,argc,argv); - Queue(m); + queue.Push(const_cast(this),o,argc,argv); + Trigger(); } void flext_base::ToQueueAnything(int o,const t_symbol *s,int argc,const t_atom *argv) const { - FLEXT_ASSERT(o >= 0); - qmsg *m = new qmsg(const_cast(this)); - m->SetAny(o,s,argc,argv); - Queue(m); -} - - -void flext_base::ToSelfBang(int n) const -{ - FLEXT_ASSERT(n >= 0); - ToQueueBang(-1-n); -} - -void flext_base::ToSelfFloat(int n,float f) const -{ - FLEXT_ASSERT(n >= 0); - ToQueueFloat(-1-n,f); -} - -void flext_base::ToSelfInt(int n,int f) const -{ - FLEXT_ASSERT(n >= 0); - ToQueueInt(-1-n,f); + queue.Push(const_cast(this),o,s,argc,argv); + Trigger(); } - -void flext_base::ToSelfSymbol(int n,const t_symbol *s) const -{ - FLEXT_ASSERT(n >= 0); - ToQueueSymbol(-1-n,s); -} - -void flext_base::ToSelfList(int n,int argc,const t_atom *argv) const -{ - FLEXT_ASSERT(n >= 0); - ToQueueList(-1-n,argc,argv); -} - -void flext_base::ToSelfAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const -{ - FLEXT_ASSERT(n >= 0); - ToQueueAnything(-1-n,s,argc,argv); -} - diff --git a/externals/grill/pool/pool.vcproj b/externals/grill/pool/pool.vcproj index 606e39e4..1b8a819a 100644 --- a/externals/grill/pool/pool.vcproj +++ b/externals/grill/pool/pool.vcproj @@ -281,6 +281,73 @@ + + + + + + + + + + + + + + + diff --git a/externals/grill/vst/readme.txt b/externals/grill/vst/readme.txt index 5702eee4..402d4210 100644 --- a/externals/grill/vst/readme.txt +++ b/externals/grill/vst/readme.txt @@ -48,6 +48,7 @@ Version history: - fixed DSP initialization, zero dangling audio vectors - pre12: added "bypass" and "mute" attributes - pre13: with flext 0.4.7 no more interruptions on window close +- pre14: allow window titles with spaces and update it on window startup 0.0.0: - version of mark@junklight.com @@ -55,11 +56,11 @@ Version history: --------------------------------------------------------------------------- BUGS: -- Waveshell crashes on load - mouse interaction in editor can cause audio dropouts - crash when unloading plugin with open window TODO: +- examine why Waveshell behaves so strange (vendor string length exceed VST specification) - add VSTTimeInfo functionality - add Midi out functionality - include necessary Steinberg license stuff diff --git a/externals/grill/vst/src/EditorWin.cpp b/externals/grill/vst/src/EditorWin.cpp index 82ab55ba..a5601d09 100644 --- a/externals/grill/vst/src/EditorWin.cpp +++ b/externals/grill/vst/src/EditorWin.cpp @@ -55,12 +55,12 @@ static LRESULT CALLBACK wndproc(HWND hwnd,UINT msg,WPARAM wp,LPARAM lp) // stop editor thread PostQuitMessage(0); break; - case WM_TIMER: -// plug->Dispatch(effEditIdle, 0, 0, NULL, 0.0f); - // break; + + case WM_TIMER: // fall through case WM_ENTERIDLE: plug->EditorIdle(); break; + case WM_MOVE: { // ignore after WM_CLOSE so that x,y positions are preserved if(!plug->IsEdited()) break; @@ -74,15 +74,22 @@ static LRESULT CALLBACK wndproc(HWND hwnd,UINT msg,WPARAM wp,LPARAM lp) #endif break; } -/* + +#if 0 // NOT needed for Windows case WM_PAINT: { // Paint the window's client area. RECT rect; - GetUpdateRect(hwnd,rect,FALSE); - plug->Paint(rect); + GetUpdateRect(hwnd,&rect,FALSE); + ERect erect; + erect.left = rect.left; + erect.top = rect.top; + erect.right = rect.right; + erect.bottom = rect.bottom; + plug->Paint(erect); break; } -*/ +#endif + #if 0 //def FLEXT_DEBUG case WM_SIZE: { WORD wx = LOWORD(lp),wy = HIWORD(lp); @@ -94,6 +101,10 @@ static LRESULT CALLBACK wndproc(HWND hwnd,UINT msg,WPARAM wp,LPARAM lp) #endif default: + #ifdef FLEXT_DEBUG + flext::post("WND MSG %i, WP=%i, lp=%i",msg,wp,lp); + #endif + res = DefWindowProc(hwnd,msg,wp,lp); } return res; diff --git a/externals/grill/vst/src/VstHost.cpp b/externals/grill/vst/src/VstHost.cpp index 30b8ba36..beb3e8be 100644 --- a/externals/grill/vst/src/VstHost.cpp +++ b/externals/grill/vst/src/VstHost.cpp @@ -66,8 +66,8 @@ int VSTPlugin::Instance(const char *dllname) FLEXT_ASSERT(ret == 'NvEf'); *_sProductName = 0; - Dispatch( effGetProductString, 0, 0, &_sProductName, 0.0f); - if(_sProductName) { + ret = Dispatch( effGetProductString, 0, 0, _sProductName, 0.0f); + if(!*_sProductName) { // no product name given by plugin -> extract it from the filename std::string str1(dllname); @@ -91,7 +91,7 @@ int VSTPlugin::Instance(const char *dllname) } if(*_sProductName) { - char tmp[256]; + char tmp[512]; sprintf(tmp,"vst~ - %s",_sProductName); title = tmp; } @@ -99,7 +99,7 @@ int VSTPlugin::Instance(const char *dllname) title = "vst~"; *_sVendorName = 0; - Dispatch( effGetVendorString, 0, 0, &_sVendorName, 0.0f); + Dispatch( effGetVendorString, 0, 0,_sVendorName, 0.0f); _sDllName = dllname; @@ -272,6 +272,9 @@ void VSTPlugin::StartEditing(WHandle h) { FLEXT_ASSERT(h != NULL); Dispatch(effEditOpen,0,0,hwnd = h); +// Dispatch(effEditTop); + + TitleEditor(this,title.c_str()); } void VSTPlugin::StopEditing() @@ -422,7 +425,7 @@ 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 0 +#if 1 audioMasterEnum op = (audioMasterEnum)opcode; audioMasterEnumx opx = (audioMasterEnumx)opcode; #endif @@ -434,18 +437,19 @@ long VSTPlugin::Master(AEffect *effect, long opcode, long index, long value, voi switch (opcode) { case audioMasterAutomate: // 0 #ifdef FLEXT_DEBUG - post("Automate index=%li value=%li",index,value); + post("Automate index=%li value=%li opt=%f",index,value,opt); #endif // index, value given //! \todo set effect parameter return 0; case audioMasterVersion: // 1 // support VST 2.3 - return 2300; +// return 2300; + return 2; case audioMasterCurrentId: // 2 return 0; case audioMasterIdle: // 3 -// effect->dispatcher(effect, effEditIdle, 0, 0, NULL, 0.0f); + effect->dispatcher(effect, effEditIdle, 0, 0, NULL, 0.0f); return 0; case audioMasterPinConnected: // 4 //! \todo set connection state correctly (if possible..) @@ -492,6 +496,10 @@ long VSTPlugin::Master(AEffect *effect, long opcode, long index, long value, voi return 0; // not supported case audioMasterGetNumAutomatableParameters: // 11 return 0; // not supported + case audioMasterSizeWindow: // 15 + return 0; +// case audioMasterGetSampleRate: // 16 +// case audioMasterGetBlockSize: // 17 case audioMasterGetCurrentProcessLevel: // 23 // return thread state return flext::GetThreadId() == flext::GetSysThreadId()?2:1; @@ -507,12 +515,44 @@ long VSTPlugin::Master(AEffect *effect, long opcode, long index, long value, voi #ifdef FLEXT_DEBUG post("\taudioMasterCanDo PTR = %s",ptr); #endif + if(!strcmp((char *)ptr,"sendVstEvents")) + return 1; + else if(!strcmp((char *)ptr,"sendVstMidiEvent")) + return 1; + else if(!strcmp((char *)ptr,"sendVstTimeInfo")) + return 1; // NOT YET + else if(!strcmp((char *)ptr,"receiveVstEvents")) + return 1; + else if(!strcmp((char *)ptr,"receiveVstMidiEvent")) + return 1; + else if(!strcmp((char *)ptr,"receiveVstTimeInfo")) + return 1; // NOT YET + else if(!strcmp((char *)ptr,"reportConnectionChanges")) + return 0; // \TODO PD has hard times supporting that... + else if(!strcmp((char *)ptr,"acceptIOChanges")) + return 0; // \TODO what does this means exactly? + else if(!strcmp((char *)ptr,"supplyIdle")) + return 1; + else if(!strcmp((char *)ptr,"sizeWindow")) + return 1; + else if(!strcmp((char *)ptr,"supportShell")) + return 0; // NOT YET! + else if(!strcmp((char *)ptr,"offline")) + return 0; // not supported + else if(!strcmp((char *)ptr,"asyncProcessing")) + return 0; // not supported + return 0; // not supported case audioMasterGetLanguage: // 38 return kVstLangEnglish; case audioMasterGetDirectory: // 41 // return full path of plugin return 0; // not supported + case audioMasterUpdateDisplay: // 42 +#ifdef FLEXT_DEBUG + post("UPDATE DISPLAY"); +#endif + return 0; default: #ifdef FLEXT_DEBUG post("Unknown opcode %li",opcode); diff --git a/externals/grill/vst/src/VstHost.h b/externals/grill/vst/src/VstHost.h index 6fa2008b..f49bf959 100644 --- a/externals/grill/vst/src/VstHost.h +++ b/externals/grill/vst/src/VstHost.h @@ -113,7 +113,7 @@ public: void Visible(bool vis); bool IsVisible() const; -// void Paint(ERect &r) const { Dispatch(effEditDraw,0,0,&r); } + void Paint(ERect &r) const { Dispatch(effEditDraw,0,0,&r); } void processReplacing( float **inputs, float **outputs, long sampleframes ); void process( float **inputs, float **outputs, long sampleframes ); @@ -150,8 +150,8 @@ protected: inline long GetFlags() const { return _pEffect?_pEffect->flags:0; } inline bool HasFlags(long msk) const { return _pEffect && (_pEffect->flags&msk); } - char _sProductName[64]; - char _sVendorName[64]; + char _sProductName[300]; + char _sVendorName[300]; std::string _sDllName; // Contains dll name struct NameCmp: diff --git a/externals/grill/vst/src/main.cpp b/externals/grill/vst/src/main.cpp index fa405686..e2b6fb6e 100644 --- a/externals/grill/vst/src/main.cpp +++ b/externals/grill/vst/src/main.cpp @@ -19,7 +19,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include -#define VST_VERSION "0.1.0pre15" +#define VST_VERSION "0.1.0pre16" class vst: @@ -52,8 +52,8 @@ protected: V ms_winy(I y) { if(plug) plug->SetY(y); } V ms_wincaption(bool c) { if(plug) plug->SetCaption(c); } V mg_wincaption(bool &c) const { c = plug && plug->GetCaption(); } - V ms_wintitle(const t_symbol *t) { if(plug) plug->SetTitle(GetString(t)); } - V mg_wintitle(const t_symbol *&t) const { t = plug?MakeSymbol(plug->GetTitle()):sym__; } + V ms_wintitle(const AtomList &t); + V mg_wintitle(AtomList &t) const { if(plug) { t(1); SetString(t[0],plug->GetTitle()); } } V mg_chnsin(I &c) const { c = plug?plug->GetNumInputs():0; } V mg_chnsout(I &c) const { c = plug?plug->GetNumOutputs():0; } @@ -148,7 +148,7 @@ private: FLEXT_CALLVAR_I(mg_winx,ms_winx) FLEXT_CALLVAR_I(mg_winy,ms_winy) FLEXT_CALLVAR_B(mg_wincaption,ms_wincaption) - FLEXT_CALLVAR_S(mg_wintitle,ms_wintitle) + FLEXT_CALLVAR_V(mg_wintitle,ms_wintitle) FLEXT_CALLGET_I(mg_chnsin) FLEXT_CALLGET_I(mg_chnsout) @@ -632,6 +632,14 @@ V vst::m_ctrlchange(I control,I ctrl_value) if(plug) plug->AddControlChange(control,ctrl_value ); } +V vst::ms_wintitle(const AtomList &t) +{ + if(plug) { + char txt[256]; + t.Print(txt,sizeof txt); + plug->SetTitle(txt); + } +} /** * display the parameters names and values and some other bits and pieces that -- cgit v1.2.1