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/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 +++++++--- 4 files changed, 81 insertions(+), 22 deletions(-) (limited to 'externals/grill/vst/src') 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