aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/vst/src
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2004-02-24 03:37:12 +0000
committerThomas Grill <xovo@users.sourceforge.net>2004-02-24 03:37:12 +0000
commit65092b7f63e129a416a32f0e0071547fba86d6d5 (patch)
tree20b5eb70dd1b0d6697e819747a4fb33a9bd56324 /externals/grill/vst/src
parentb5a276390c40729a9c78d8d3e8ae19a8a2239660 (diff)
""
svn path=/trunk/; revision=1355
Diffstat (limited to 'externals/grill/vst/src')
-rw-r--r--externals/grill/vst/src/EditorWin.cpp30
-rw-r--r--externals/grill/vst/src/VstHost.cpp50
-rw-r--r--externals/grill/vst/src/VstHost.h2
-rw-r--r--externals/grill/vst/src/main.cpp2
4 files changed, 65 insertions, 19 deletions
diff --git a/externals/grill/vst/src/EditorWin.cpp b/externals/grill/vst/src/EditorWin.cpp
index 5418ba80..9a79c391 100644
--- a/externals/grill/vst/src/EditorWin.cpp
+++ b/externals/grill/vst/src/EditorWin.cpp
@@ -11,17 +11,18 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "VstHost.h"
#include <flext.h>
+#include <map>
+
#if FLEXT_OS == FLEXT_OS_WIN
// only Windows code is situated in this file
#include <windows.h>
-#include <map>
-
typedef std::map<flext::thrid_t,VSTPlugin *> WndMap;
static WndMap wndmap;
static flext::ThrMutex mapmutex;
+#define TIMER_INTERVAL 25
#define WCLNAME "vst~-class"
@@ -118,16 +119,27 @@ static void threadfun(flext::thr_params *p)
// plug->Dispatch(effEditTop,0,0, 0,0.0f);
// printf("Dispatched to the top\n");
- SetTimer(wnd,0,25,NULL);
+ SetTimer(wnd,0,TIMER_INTERVAL,NULL);
+
+ WINDOWINFO winfo;
+ winfo.cbSize = sizeof(winfo);
+ GetWindowInfo(wnd,&winfo);
+ TITLEBARINFO tinfo;
+ tinfo.cbSize = sizeof(tinfo);
+ GetTitleBarInfo(wnd,&tinfo);
ERect r;
plug->GetEditorRect(r);
-// SetWindowPos(wnd,HWND_TOP,plug->getX(),plug->getY(),(r.right - r.left) + 6 , r.bottom - r.top + 26 , SWP_SHOWWINDOW);
- SetWindowPos(wnd,HWND_TOP,r.left,r.top,(r.right - r.left) + 6 , r.bottom - r.top + 26 , SWP_SHOWWINDOW);
-
- // ShowWindow( SW_SHOW );
- // BringWindowToTop(wnd);
- // SetFocus();
+ SetWindowPos(wnd,HWND_TOP,
+ r.left,
+ r.top,
+ (r.right-r.left)+winfo.cxWindowBorders*2,
+ (r.bottom-r.top)+(tinfo.rcTitleBar.bottom-tinfo.rcTitleBar.top)+winfo.cyWindowBorders*2,
+ SWP_SHOWWINDOW
+ );
+
+
+ // SetFocus();
// Message pump
MSG msg;
diff --git a/externals/grill/vst/src/VstHost.cpp b/externals/grill/vst/src/VstHost.cpp
index 75cd3d35..826827f6 100644
--- a/externals/grill/vst/src/VstHost.cpp
+++ b/externals/grill/vst/src/VstHost.cpp
@@ -15,7 +15,7 @@ using namespace std;
static VstTimeInfo _timeInfo;
-typedef AEffect *(*PVSTMAIN)(audioMasterCallback audioMaster);
+typedef AEffect *(VSTCALLBACK *PVSTMAIN)(audioMasterCallback audioMaster);
VSTPlugin::VSTPlugin():
@@ -55,12 +55,28 @@ int VSTPlugin::Instance(const char *dllname)
//init plugin
_pEffect->user = this;
- FLEXT_ASSERT(Dispatch( effOpen ));
-// Dispatch( effMainsChanged, 0, 1);
+
+ long ret = Dispatch( effOpen );
+ FLEXT_ASSERT(!ret);
+
+ ret = Dispatch( effIdentify);
+ FLEXT_ASSERT(ret == 'NvEf');
if (!Dispatch( effGetProductString, 0, 0, &_sProductName, 0.0f)) {
+ // no product name given by plugin -> extract it from the filename
+
string str1(dllname);
- string str2 = str1.substr(str1.rfind('\\')+1);
+ string::size_type slpos = str1.rfind('\\');
+ if(slpos == string::npos) {
+ slpos = str1.rfind('/');
+ if(slpos == string::npos)
+ slpos = 0;
+ else
+ ++slpos;
+ }
+ else
+ ++slpos;
+ string str2 = str1.substr(slpos);
int snip = str2.find('.');
if( snip != string::npos )
str1 = str2.substr(0,snip);
@@ -73,7 +89,12 @@ int VSTPlugin::Instance(const char *dllname)
strcpy(_sVendorName, "Unknown vendor");
_sDllName = dllname;
-
+
+/*
+ Dispatch( effMainsChanged, 0, 1);
+ Dispatch( effSetSampleRate, 0, 0,NULL,44100.);
+ Dispatch( effSetBlockSize, 0, 64);
+*/
return VSTINSTANCE_NO_ERROR;
}
@@ -324,10 +345,23 @@ void VSTPlugin::process( float **inputs, float **outputs, long sampleframes )
long VSTPlugin::Master(AEffect *effect, long opcode, long index, long value, void *ptr, float opt)
{
switch (opcode) {
- case audioMasterVersion:
+ case audioMasterAutomate: // 0
+ // index, value given
+ //! \todo set effect parameter
+ return 0;
+ case audioMasterVersion: // 1
return 2;
- case audioMasterCurrentId:
- return 'AASH';
+ case audioMasterCurrentId: // 2
+ return 0;
+ case audioMasterIdle: // 3
+// effect->dispatcher(effect, effEditIdle, 0, 0, NULL, 0.0f);
+ return 0;
+ case audioMasterPinConnected: // 4
+ //! \todo set connection state correctly (if possible..)
+ // index=pin, value=0..input, else..output
+ return 0; // 0 means connected
+ case audioMasterGetTime: // 7
+ return 0; // not supported
default:
#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);
diff --git a/externals/grill/vst/src/VstHost.h b/externals/grill/vst/src/VstHost.h
index 6b856956..397501c5 100644
--- a/externals/grill/vst/src/VstHost.h
+++ b/externals/grill/vst/src/VstHost.h
@@ -116,7 +116,7 @@ public:
return Is()?_pEffect->dispatcher(_pEffect, opCode, index, value, ptr, opt):0;
}
- static long Master(AEffect *effect, long opcode, long index, long value, void *ptr, float opt);
+ static long VSTCALLBACK Master(AEffect *effect, long opcode, long index, long value, void *ptr, float opt);
void SetPos(int x,int y,bool upd = true);
void SetX(int x,bool upd = true) { SetPos(x,posy,upd); }
diff --git a/externals/grill/vst/src/main.cpp b/externals/grill/vst/src/main.cpp
index 76de5c27..54450c77 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.0pre10"
+#define VST_VERSION "0.1.0pre11"
class vst: