diff options
Diffstat (limited to 'externals/grill/vst')
-rw-r--r-- | externals/grill/vst/src/editorwin.hpp | 5 | ||||
-rw-r--r-- | externals/grill/vst/src/main.cpp | 21 | ||||
-rw-r--r-- | externals/grill/vst/src/vsthost.cpp | 3 | ||||
-rw-r--r-- | externals/grill/vst/src/vsthost.h | 14 | ||||
-rw-r--r-- | externals/grill/vst/src/vstmaster.cpp | 29 | ||||
-rw-r--r-- | externals/grill/vst/vst.vcproj | 4 |
6 files changed, 37 insertions, 39 deletions
diff --git a/externals/grill/vst/src/editorwin.hpp b/externals/grill/vst/src/editorwin.hpp index 9d97771b..cbdd807f 100644 --- a/externals/grill/vst/src/editorwin.hpp +++ b/externals/grill/vst/src/editorwin.hpp @@ -56,7 +56,7 @@ static LRESULT CALLBACK wndproc(HWND hwnd,UINT msg,WPARAM wp,LPARAM lp) case WM_TIMER: // fall through case WM_ENTERIDLE: - plug->EditorIdle(); +// plug->EditorIdle(); break; #if 0 case WM_WINDOWPOSCHANGED: { @@ -225,7 +225,10 @@ static void threadfun(flext::thr_params *p) } else { TranslateMessage(&msg); +// double tm1 = flext::GetOSTime(); DispatchMessage(&msg); +// double tm2 = flext::GetOSTime(); +// if(tm2-tm1 > 0.01) FLEXT_LOG1("halt %lf",(tm2-tm1)*1000); } } diff --git a/externals/grill/vst/src/main.cpp b/externals/grill/vst/src/main.cpp index d90cac4a..d0e5a6c0 100644 --- a/externals/grill/vst/src/main.cpp +++ b/externals/grill/vst/src/main.cpp @@ -12,8 +12,8 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "main.h" -#include "Editor.h" -#include "VstHost.h" +#include "editor.h" +#include "vsthost.h" #include <stdlib.h> #include <string.h> @@ -26,7 +26,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. #endif -#define VST_VERSION "0.1.0pre24" +#define VST_VERSION "0.1.0pre26" class vst @@ -157,7 +157,7 @@ private: int paramnames; int blsz; - void (VSTPlugin::*vstfun)(t_sample **insigs,t_sample **outsigs,long n); + bool (VSTPlugin::*vstfun)(t_sample **insigs,t_sample **outsigs,long n); bool sigmatch; t_sample **vstin,**vstout,**tmpin,**tmpout; @@ -651,8 +651,12 @@ void vst::CbSignal() for(; i < CntOutSig(); ++i) ZeroSamples(outsigs[i],n); } - else if(sigmatch) - (plug->*vstfun)(const_cast<t_sample **>(InSig()),const_cast<t_sample **>(OutSig()),Blocksize()); + else if(sigmatch) { + if(!(plug->*vstfun)(const_cast<t_sample **>(InSig()),const_cast<t_sample **>(OutSig()),Blocksize())) { + for(int i = 0; i < CntOutSig(); ++i) + ZeroSamples(OutSig()[i],Blocksize()); + } + } else { const int inputs = plug->GetNumInputs(),outputs = plug->GetNumOutputs(); const int cntin = CntInSig(),cntout = CntOutSig(); @@ -686,7 +690,10 @@ void vst::CbSignal() } // call plugin DSP function - (plug->*vstfun)(inv,outv,n); + if(!(plug->*vstfun)(inv,outv,n)) { + for(int i = 0; i < outputs; ++i) + ZeroSamples(outsigs[i],n); + } if(more) { // according to mode set dangling output vectors diff --git a/externals/grill/vst/src/vsthost.cpp b/externals/grill/vst/src/vsthost.cpp index 384fca28..9553f38d 100644 --- a/externals/grill/vst/src/vsthost.cpp +++ b/externals/grill/vst/src/vsthost.cpp @@ -169,8 +169,7 @@ bool VSTPlugin::NewPlugin(const char *plugname) dllname = plugname; #if FLEXT_OS == FLEXT_OS_WIN - FLEXT_ASSERT(!hdll); - hdll = LoadLibrary(dllname.c_str()); + hdll = LoadLibraryEx(dllname.c_str(),NULL,0 /*DONT_RESOLVE_DLL_REFERENCES*/); if(hdll) pluginmain = (PVSTMAIN)GetProcAddress(hdll,"main"); audiomaster = Master; diff --git a/externals/grill/vst/src/vsthost.h b/externals/grill/vst/src/vsthost.h index 0b055d40..00225b62 100644 --- a/externals/grill/vst/src/vsthost.h +++ b/externals/grill/vst/src/vsthost.h @@ -216,7 +216,7 @@ public: void AddPitchBend(int value) { - AddMIDI(MIDI_PITCHBEND+midichannel,((value>>7)&127),(value&127)); + AddMIDI(MIDI_PITCHBEND+midichannel,(value&127),((value>>7)&127)); } void AddAftertouch(int value) @@ -291,21 +291,23 @@ private: ////////////////////////////////////////////////////////////////////////////// public: - void processReplacing(float **inputs,float **outputs,long sampleframes ) + bool processReplacing(float **inputs,float **outputs,long sampleframes ) { FLEXT_ASSERT(effect); - effect->processReplacing(effect,inputs,outputs,sampleframes); + effect->processReplacing(effect,inputs,outputs,sampleframes); if(playing) updatepos(sampleframes); + return true; } - void process(float **inputs,float **outputs,long sampleframes ) + bool process(float **inputs,float **outputs,long sampleframes ) { FLEXT_ASSERT(effect); - effect->process(effect,inputs,outputs,sampleframes); - if(playing) updatepos(sampleframes); + effect->process(effect,inputs,outputs,sampleframes); + return true; } private: + void updatepos(long frames); ////////////////////////////////////////////////////////////////////////////// diff --git a/externals/grill/vst/src/vstmaster.cpp b/externals/grill/vst/src/vstmaster.cpp index 00a93c80..03457f82 100644 --- a/externals/grill/vst/src/vstmaster.cpp +++ b/externals/grill/vst/src/vstmaster.cpp @@ -70,9 +70,8 @@ void VSTPlugin::ProcessEvent(const VstEvent &ev) // Host callback dispatcher
long VSTPlugin::Master(AEffect *effect, long opcode, long index, long value, void *ptr, float opt)
{
-#ifdef FLEXT_LOGGING
- 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
+ if(opcode != audioMasterGetTime)
+ FLEXT_LOG6("VST -> host: Eff = 0x%.8X, Opcode = %d, Index = %d, Value = %d, PTR = %.8X, OPT = %.3f\n",(int)effect, opcode,index,value,(int)ptr,opt);
VSTPlugin *th = effect?(VSTPlugin *)effect->user:NULL;
@@ -101,15 +100,11 @@ 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_LOGGING
- post("Pin connected pin=%li conn=%li",index,value);
-#endif
+ FLEXT_LOG2("Pin connected pin=%li conn=%li",index,value);
return 0; // 0 means connected
case audioMasterWantMidi: // 6
-#ifdef FLEXT_LOGGING
- post("Want MIDI = %li",value);
-#endif
+ FLEXT_LOG1("Want MIDI = %li",value);
return 0; // VST header says: "currently ignored"
case audioMasterGetTime: { // 7
@@ -166,9 +161,7 @@ long VSTPlugin::Master(AEffect *effect, long opcode, long index, long value, voi 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
+ FLEXT_LOG3("TimeInfo pos=%lf rate=%lf filter=%li",tminfo->samplePos,tminfo->sampleRate,value);
return 0; // not supported
}
@@ -206,9 +199,7 @@ long VSTPlugin::Master(AEffect *effect, long opcode, long index, long value, voi return VST_VERSION;
case audioMasterCanDo: // 37
-#ifdef FLEXT_LOGGING
- post("\taudioMasterCanDo PTR = %s",ptr);
-#endif
+ FLEXT_LOG1("\taudioMasterCanDo PTR = %s",ptr);
if(!strcmp((char *)ptr,"sendVstEvents"))
return 1;
else if(!strcmp((char *)ptr,"sendVstMidiEvent"))
@@ -259,15 +250,11 @@ long VSTPlugin::Master(AEffect *effect, long opcode, long index, long value, voi return (long)(th?th->dllname.c_str():dllloading.c_str());
case audioMasterUpdateDisplay: // 42
-#ifdef FLEXT_LOGGING
- post("UPDATE DISPLAY");
-#endif
+ FLEXT_LOG("UPDATE DISPLAY");
return 0;
default:
-#ifdef FLEXT_DEBUG
- post("Unknown opcode %li",opcode);
-#endif
+ FLEXT_LOG1("Unknown opcode %li",opcode);
return 0;
}
}
diff --git a/externals/grill/vst/vst.vcproj b/externals/grill/vst/vst.vcproj index aa447805..53803407 100644 --- a/externals/grill/vst/vst.vcproj +++ b/externals/grill/vst/vst.vcproj @@ -86,8 +86,8 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories=""c:\data\prog\pd\pd-cvs\src";..\flext\source;c:\data\prog\audio\vstsdk2.3\source\common" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_WIN32_WINNT=0x0501;WINVER=0x0501;_USRDLL;FLEXT_SYS=2;FLEXT_THREADS;xFLEXT_LOGGING" + AdditionalIncludeDirectories=""c:\data\pd\pd-cvs\src";..\flext\source;c:\data\prog\audio\vstsdk2.3\source\common" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_WIN32_WINNT=0x0501;WINVER=0x0501;_USRDLL;FLEXT_SYS=2;FLEXT_THREADS;FLEXT_LOGGING" BasicRuntimeChecks="3" RuntimeLibrary="1" UsePrecompiledHeader="2" |