aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/vst/src
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2004-01-23 04:20:44 +0000
committerThomas Grill <xovo@users.sourceforge.net>2004-01-23 04:20:44 +0000
commitc33a0852fc4da4c0739a089018411854719ec1e2 (patch)
treed29f57de33e930a7331cc84d3741e7f2919d27dc /externals/grill/vst/src
parent207ff3824e76c37ae513a8b4e53f04fd169c4334 (diff)
""
svn path=/trunk/; revision=1290
Diffstat (limited to 'externals/grill/vst/src')
-rw-r--r--externals/grill/vst/src/Editor.h20
-rw-r--r--externals/grill/vst/src/EditorWin.cpp180
-rw-r--r--externals/grill/vst/src/VstHost.cpp110
-rw-r--r--externals/grill/vst/src/VstHost.h42
-rw-r--r--externals/grill/vst/src/main.cpp120
-rw-r--r--externals/grill/vst/src/main.h12
-rw-r--r--externals/grill/vst/src/vst.rc30
7 files changed, 346 insertions, 168 deletions
diff --git a/externals/grill/vst/src/Editor.h b/externals/grill/vst/src/Editor.h
new file mode 100644
index 00000000..b77d8916
--- /dev/null
+++ b/externals/grill/vst/src/Editor.h
@@ -0,0 +1,20 @@
+/*
+vst~ - VST plugin object for PD
+based on the work of Jarno Seppänen and Mark Williamson
+
+Copyright (c)2003-2004 Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
+#ifndef __EDITOR_H
+#define __EDITOR_H
+
+class VSTPlugin;
+
+void SetupEditor();
+void StartEditor(VSTPlugin *p);
+void StopEditor(VSTPlugin *p);
+void ShowEditor(VSTPlugin *p,bool show);
+
+#endif // __EDITOR_H
diff --git a/externals/grill/vst/src/EditorWin.cpp b/externals/grill/vst/src/EditorWin.cpp
new file mode 100644
index 00000000..c41f02e3
--- /dev/null
+++ b/externals/grill/vst/src/EditorWin.cpp
@@ -0,0 +1,180 @@
+/*
+vst~ - VST plugin object for PD
+based on the work of Jarno Seppänen and Mark Williamson
+
+Copyright (c)2003-2004 Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
+#include "Editor.h"
+#include "VstHost.h"
+#include <flext.h>
+
+#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 WCLNAME "vst~-class"
+
+
+static LRESULT CALLBACK wndproc(HWND hwnd,UINT msg,WPARAM wp,LPARAM lp)
+{
+ mapmutex.Lock();
+ VSTPlugin *plug = wndmap[flext::GetThreadId()];
+ mapmutex.Unlock();
+ FLEXT_ASSERT(plug != NULL);
+
+ LRESULT res = 0;
+
+// post("Message %x",msg);
+ switch(msg) {
+// case WM_NCREATE: res = TRUE; break;
+ case WM_CREATE:
+ // Initialize the window.
+ plug->SetEditWindow(hwnd);
+ break;
+ case WM_CLOSE:
+ plug->StopEditing();
+ DestroyWindow(hwnd);
+ break;
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ break;
+ case WM_TIMER:
+// plug->Dispatch(effEditIdle, 0, 0, NULL, 0.0f);
+ // break;
+ case WM_ENTERIDLE:
+ plug->EditorIdle();
+ break;
+ case WM_MOVE:
+ plug->setPos(LOWORD(lp),HIWORD(lp));
+ break;
+/*
+ case WM_PAINT:
+ // Paint the window's client area.
+ break;
+ case WM_SIZE:
+ // Set the size and position of the window.
+ break;
+*/
+ default:
+ res = DefWindowProc(hwnd,msg,wp,lp);
+ }
+ return res;
+}
+
+static void threadfun(flext::thr_params *p)
+{
+ flext::RelPriority(-2);
+
+ VSTPlugin *plug = (VSTPlugin *)p;
+ HINSTANCE hinstance = (HINSTANCE)GetModuleHandle(NULL);
+ flext::thrid_t thrid = flext::GetThreadId();
+
+ mapmutex.Lock();
+ wndmap[thrid] = plug;
+ mapmutex.Unlock();
+
+
+ char tmp[256];
+ sprintf(tmp,"vst~ - %s",plug->GetName());
+
+ HWND wnd = CreateWindow(
+ WCLNAME,tmp,
+ WS_BORDER|WS_CAPTION|/*WS_THICKFRAME|*/WS_POPUP|WS_SYSMENU|WS_MINIMIZEBOX,
+ CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
+ NULL,NULL,
+ hinstance,NULL
+ );
+
+ if(!wnd)
+ FLEXT_LOG1("wnd == NULL: %i",GetLastError());
+ else {
+// plug->Dispatch(effEditOpen , 0 , 0 , wnd, 0.0f ); // Done in WNDPROC!!
+ /*
+ CString str = theApp->GetProfileString( "VSTPos" , plug->GetName() , "10,10");
+ int idx = str.Find(",");
+ CString x = str.Left( idx );
+ CString y = str.Right( idx );
+ printf(" index is %d left is %s and right is %s" , idx , x , y);
+ */
+
+// plug->Dispatch(effEditTop,0,0, 0,0.0f);
+ // printf("Dispatched to the top\n");
+
+ SetTimer(wnd,0,25,NULL);
+
+ RECT r = plug->GetEditorRect();
+ SetWindowPos(wnd,HWND_TOPMOST,plug->getX(),plug->getY(),(r.right - r.left) + 6 , r.bottom - r.top + 26 , SWP_SHOWWINDOW);
+ // ShowWindow( SW_SHOW );
+ // BringWindowToTop(wnd);
+ // SetFocus();
+
+ // Message pump
+ MSG msg;
+ BOOL bRet;
+ while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0) {
+ if (bRet == -1) {
+ // handle the error and possibly exit
+ FLEXT_LOG1("GetMessage error: %i",GetLastError());
+ }
+ else {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+ }
+
+// UnregisterClass(wcx.lpszClassName,hinstance);
+
+ mapmutex.Lock();
+ wndmap.erase(thrid);
+ mapmutex.Unlock();
+}
+
+void SetupEditor()
+{
+ HINSTANCE hinstance = (HINSTANCE)GetModuleHandle(NULL);
+
+ // Fill in the window class structure with parameters that describe the main window.
+ WNDCLASS wcx;
+ wcx.style = CS_DBLCLKS; // | CS_HREDRAW | CS_VREDRAW; // redraw if size changes
+ wcx.lpfnWndProc = wndproc; // points to window procedure
+ wcx.cbClsExtra = 0; // no extra class memory
+ wcx.cbWndExtra = 0; // no extra window memory
+ wcx.hInstance = hinstance; // handle to instance
+ wcx.hIcon = NULL; //LoadIcon(NULL, IDI_APPLICATION); // predefined app. icon
+ wcx.hCursor = LoadCursor(NULL, IDC_ARROW); // predefined arrow
+ wcx.hbrBackground = NULL; //GetStockObject(WHITE_BRUSH); // white background brush
+ wcx.lpszMenuName = NULL; // name of menu resource
+ wcx.lpszClassName = WCLNAME; // name of window class
+
+ ATOM at = RegisterClass(&wcx);
+ FLEXT_ASSERT(at);
+}
+
+void StartEditor(VSTPlugin *p)
+{
+ flext::LaunchThread(threadfun,reinterpret_cast<flext::thr_params *>(p));
+}
+
+void StopEditor(VSTPlugin *p)
+{
+ PostMessage(p->EditorHandle(),WM_CLOSE,0,0);
+ flext::StopThread(threadfun,reinterpret_cast<flext::thr_params *>(p));
+}
+
+void ShowEditor(VSTPlugin *p,bool show)
+{
+ ShowWindow(p->EditorHandle(),show);
+}
+
+#endif // FLEXT_OS_WIN
diff --git a/externals/grill/vst/src/VstHost.cpp b/externals/grill/vst/src/VstHost.cpp
index ee775cfc..830da33c 100644
--- a/externals/grill/vst/src/VstHost.cpp
+++ b/externals/grill/vst/src/VstHost.cpp
@@ -1,10 +1,18 @@
-#include "stdafx.h"
-#include "EditorThread.h"
+/*
+vst~ - VST plugin object for PD
+based on the work of Jarno Seppänen and Mark Williamson
+
+Copyright (c)2003-2004 Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
+#include "Editor.h"
#include "VstHost.h"
-#include "PopupWindow.h"
#include "vst\aeffeditor.h"
#include "vst\aeffectx.h"
-#include <flext.h>
+
+using namespace std;
VstTimeInfo VSTPlugin::_timeInfo;
@@ -16,6 +24,7 @@ float VSTPlugin::sample_rate = 44100;
/////////////////////
VSTPlugin::VSTPlugin():
posx(0),posy(0),
+ hwnd(NULL),
_editor(false)
{
queue_size=0;
@@ -24,10 +33,8 @@ VSTPlugin::VSTPlugin():
instantiated=false; // Constructin' with no instance
overwrite = false;
// wantidle = false;
- w = GetForegroundWindow();
// show_params = false;
_midichannel = 0;
- edited = false;
}
VSTPlugin::~VSTPlugin()
@@ -38,16 +45,15 @@ VSTPlugin::~VSTPlugin()
int VSTPlugin::Instance( const char *dllname)
{
- h_dll=LoadLibrary(dllname);
+ h_dll = LoadLibrary(dllname);
- if(h_dll==NULL)
- {
+ if(!h_dll) {
return VSTINSTANCE_ERR_NO_VALID_FILE;
}
+
// post("Loaded library %s" , dllname);
PVSTMAIN main = (PVSTMAIN)GetProcAddress(h_dll,"main");
- if(!main)
- {
+ if(!main) {
FreeLibrary(h_dll);
_pEffect=NULL;
instantiated=false;
@@ -57,8 +63,7 @@ int VSTPlugin::Instance( const char *dllname)
//This calls the "main" function and receives the pointer to the AEffect structure.
_pEffect = main((audioMasterCallback)&(this->Master));
- if(!_pEffect)
- {
+ if(!_pEffect) {
post("VST plugin : unable to create effect");
FreeLibrary(h_dll);
_pEffect=NULL;
@@ -66,8 +71,7 @@ int VSTPlugin::Instance( const char *dllname)
return VSTINSTANCE_ERR_REJECTED;
}
- if( _pEffect->magic!=kEffectMagic)
- {
+ if( _pEffect->magic!=kEffectMagic) {
post("VST plugin : Instance query rejected by 0x%.8X\n",(int)_pEffect);
FreeLibrary(h_dll);
_pEffect=NULL;
@@ -90,27 +94,21 @@ int VSTPlugin::Instance( const char *dllname)
// Dispatch( effSetBlockSize, 0, STREAM_SIZE, NULL, 0.0f);
- if (!Dispatch( effGetProductString, 0, 0, &_sProductName, 0.0f))
- {
- CString str1(dllname);
- CString str2 = str1.Mid(str1.ReverseFind('\\')+1);
- int snip = str2.Find('.');
- if ( snip != -1 )
- {
- str1 = str2.Left( snip );
- }
+ if (!Dispatch( effGetProductString, 0, 0, &_sProductName, 0.0f)) {
+ string str1(dllname);
+ string str2 = str1.substr(str1.rfind('\\')+1);
+ int snip = str2.find('.');
+ if( snip != string::npos )
+ str1 = str2.substr(0,snip);
else
- {
str1 = str2;
- }
- strcpy(_sProductName,str1);
-
+ strcpy(_sProductName,str1.c_str());
}
- if (!_pEffect->dispatcher(_pEffect, effGetVendorString, 0, 0, &_sVendorName, 0.0f))
- {
+ if (!_pEffect->dispatcher(_pEffect, effGetVendorString, 0, 0, &_sVendorName, 0.0f)) {
strcpy(_sVendorName, "Unknown vendor");
}
+
_version = _pEffect->version;
_isSynth = (_pEffect->flags & effFlagsIsSynth)?true:false;
overwrite = (_pEffect->flags & effFlagsCanReplacing)?true:false;
@@ -121,8 +119,6 @@ int VSTPlugin::Instance( const char *dllname)
sprintf(_sDllName,dllname);
-
-
//keep plugin name
instantiated=true;
@@ -164,8 +160,9 @@ void VSTPlugin::Create(VSTPlugin *plug)
void VSTPlugin::Free() // Called also in destruction
{
- if(instantiated)
- {
+ if(IsEdited()) StopEditor(this);
+
+ if(instantiated) {
instantiated=false;
post("VST plugin : Free query 0x%.8X\n",(int)_pEffect);
_pEffect->user = NULL;
@@ -304,7 +301,14 @@ 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 //def FLEXT_DEBUG
+#if 0
+ if(!effect) {
+ FLEXT_LOG("effect = NULL");
+ return 0;
+ }
+#endif
+
+#ifdef FLEXT_DEBUG
if(opcode != audioMasterGetTime)
post("VST plugin call to host dispatcher: Eff: 0x%.8X, Opcode = %d, Index = %d, Value = %d, PTR = %.8X, OPT = %.3f\n",(int)effect, opcode,index,value,(int)ptr,opt);
//st( "audioMasterWantMidi %d " , audioMasterWantMidi);
@@ -456,27 +460,23 @@ void VSTPlugin::edit(bool open)
{
if(instantiated) {
if(open) {
- if ( HasEditor() && !edited) {
- edited = true;
- b = new CEditorThread();
- b->SetPlugin( this);
- b->CreateThread();
- }
- }
- else {
- if (HasEditor() && edited) b->Close();
+ if(HasEditor() && !IsEdited())
+ StartEditor(this);
}
+ else if(IsEdited())
+ StopEditor(this);
}
}
void VSTPlugin::visible(bool vis)
{
- if(instantiated && edited) b->Show(vis);
+ if(instantiated && IsEdited()) ShowEditor(this,vis);
}
void VSTPlugin::EditorIdle()
{
- Dispatch(effEditIdle,0,0, w,0.0f);
+ FLEXT_ASSERT(hwnd != NULL);
+ Dispatch(effEditIdle,0,0, hwnd,0.0f);
}
RECT VSTPlugin::GetEditorRect()
@@ -493,13 +493,20 @@ RECT VSTPlugin::GetEditorRect()
void VSTPlugin::SetEditWindow(HWND h)
{
- w = h;
- Dispatch(effEditOpen,0,0, w,0.0f);
+ hwnd = h;
+ FLEXT_ASSERT(hwnd != NULL);
+ Dispatch(effEditOpen,0,0, hwnd,0.0f);
}
void VSTPlugin::OnEditorClose()
{
- Dispatch(effEditClose,0,0, w,0.0f);
+ FLEXT_ASSERT(hwnd != NULL);
+ Dispatch(effEditClose,0,0, hwnd,0.0f);
+}
+
+void VSTPlugin::StopEditing()
+{
+ hwnd = NULL;
}
/*
@@ -560,8 +567,3 @@ int VSTPlugin::GetNumCategories()
else
return 0;
}
-
-void VSTPlugin::StopEditing()
-{
- edited = false;
-}
diff --git a/externals/grill/vst/src/VstHost.h b/externals/grill/vst/src/VstHost.h
index 8b272e97..b6246e7d 100644
--- a/externals/grill/vst/src/VstHost.h
+++ b/externals/grill/vst/src/VstHost.h
@@ -1,8 +1,24 @@
+/*
+vst~ - VST plugin object for PD
+based on the work of Jarno Seppänen and Mark Williamson
+
+Copyright (c)2003-2004 Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
#ifndef _VSTPLUGIN_HOST
#define _VSTPLUGIN_HOST
#include "Vst\AEffectx.h"
-#include <afxcoll.h>
+#include <flext.h>
+
+#if FLEXT_OS == FLEXT_OS_WIN
+#include <windows.h>
+#else
+#error Platform not supported!
+#endif
+
#define MAX_EVENTS 64
#define MAX_INOUTS 8
@@ -23,10 +39,10 @@ typedef AEffect* (*PVSTMAIN)(audioMasterCallback audioMaster);
typedef HWND (*POPWIN)(void);
typedef HWND (*GETWIN)(void);
-class VSTPlugin
+class VSTPlugin:
+ public flext
{
public:
- void StopEditing();
int GetNumCategories();
bool GetProgramName( int cat, int p , char* buf);
void AddControlChange( int control , int value );
@@ -35,9 +51,12 @@ public:
void AddAftertouch( int value );
bool ShowParams();
void SetShowParameters( bool s);
- void OnEditorClose();
+
void SetEditWindow( HWND h );
- CEditorThread* b;
+ void StopEditing();
+ void OnEditorClose();
+ HWND EditorHandle() { return hwnd; }
+
RECT GetEditorRect();
void EditorIdle();
@@ -113,21 +132,20 @@ public:
bool instantiated;
int _instance; // Remove when Changing the FileFormat.
- HWND w;
-
-
void setPos(int x,int y) { posx = x; posy = y; }
void setX(int x) { posx = x; }
void setY(int y) { posy = y; }
int getX() const { return posx; }
int getY() const { return posy; }
- bool Edited() const { return edited; }
+ bool IsEdited() const { return hwnd != NULL; }
protected:
HMODULE h_dll;
HMODULE h_winddll;
+ HWND hwnd;
+
char _sProductName[64];
char _sVendorName[64];
@@ -145,14 +163,10 @@ protected:
int queue_size;
bool overwrite;
-
-
private:
int posx,posy;
- bool edited; //,wantidle;
bool show_params;
static float sample_rate;
};
-
-#endif // _VSTPLUGIN_HOST \ No newline at end of file
+#endif // _VSTPLUGIN_HOST
diff --git a/externals/grill/vst/src/main.cpp b/externals/grill/vst/src/main.cpp
index 243511f3..a3566897 100644
--- a/externals/grill/vst/src/main.cpp
+++ b/externals/grill/vst/src/main.cpp
@@ -1,42 +1,27 @@
/*
-
-vst - VST plugin object for PD
+vst~ - VST plugin object for PD
based on the work of Jarno Seppänen and Mark Williamson
-Copyright (c)2003 Thomas Grill (xovo@gmx.net)
+Copyright (c)2003-2004 Thomas Grill (xovo@gmx.net)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
-
*/
#include "main.h"
-#include "vst.h"
-#include "EditorThread.h"
+#include "Editor.h"
#include "VstHost.h"
#include <stdlib.h>
#include <direct.h>
#include <io.h>
-#define VST_VERSION "0.1.0pre7"
-
-#if 0
-/* ----- MFC stuff ------------- */
-
-BEGIN_MESSAGE_MAP(CVstApp, CWinApp)
- //{{AFX_MSG_MAP(CVstApp)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- // DO NOT EDIT what you see in these blocks of generated code!
- //}}AFX_MSG_MAP
-END_MESSAGE_MAP()
+#include <string>
+using namespace std;
-CVstApp::CVstApp() {}
-CVstApp theApp;
+#define VST_VERSION "0.1.0pre8"
-/* ----- MFC stuff ------------- */
-#endif
class vst:
public flext_dsp
@@ -53,12 +38,12 @@ protected:
BL ms_plug(I argc,const A *argv);
BL ms_plug(const AtomList &args) { return ms_plug(args.Count(),args.Atoms()); }
- V mg_plug(AtomList &sym) const { sym(1); SetString(sym[0],plugname); }
+ V mg_plug(AtomList &sym) const { sym(1); SetString(sym[0],plugname.c_str()); }
- V ms_edit(BL on);
- V mg_edit(BL &ed) { ed = plug && plug->Edited(); }
+ V ms_edit(BL on) { if(plug) plug->edit(on); }
+ V mg_edit(BL &ed) { ed = plug && plug->IsEdited(); }
V mg_editor(BL &ed) { ed = plug && plug->HasEditor(); }
- V ms_vis(BL vis);
+ V ms_vis(BL vis) { if(plug) plug->visible(vis); }
V mg_winx(I &x) const { x = plug?plug->getX():0; }
V mg_winy(I &y) const { y = plug?plug->getY():0; }
@@ -98,7 +83,7 @@ private:
V display_parameter(I param,BL showparams);
VSTPlugin *plug;
- CString plugname;
+ string plugname;
BL echoparam,visible;
I blsz;
@@ -158,13 +143,8 @@ FLEXT_NEW_DSP_V("vst~",vst);
V vst::Setup(t_classid c)
{
-#if FLEXT_OS == FLEXT_OS_WIN
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
- AfxOleInit( );
-#endif
-
post("");
- post("vst~ %s - VST plugin object, (C)2003 Thomas Grill",VST_VERSION);
+ post("vst~ %s - VST plugin object, (C)2003-04 Thomas Grill",VST_VERSION);
post("based on the work of Jarno Seppänen and Mark Williamson");
post("");
@@ -203,6 +183,8 @@ V vst::Setup(t_classid c)
FLEXT_CADDATTR_GET(c,"dll",mg_plugdll);
FLEXT_CADDATTR_GET(c,"version",mg_plugversion);
FLEXT_CADDATTR_GET(c,"synth",mg_issynth);
+
+ SetupEditor();
}
@@ -279,11 +261,19 @@ V vst::InitBuf()
for(i = 0; i < plug->getNumOutputs(); ++i) vstout[i] = new R[Blocksize()];
}
-static const C *findFilePath(const C *path,const C *dllname)
+static string findFilePath(const string &path,const string &dllname)
{
+ _chdir( path.c_str() );
+#if FLEXT_OS == FLEXT_OS_WIN
+ WIN32_FIND_DATA data;
+ HANDLE fh = FindFirstFile(dllname.c_str(),&data);
+ if(fh != INVALID_HANDLE_VALUE) {
+ FindClose(fh);
+ return path;
+ }
+#endif
+/*
CFileFind finder;
- _chdir( path );
-
if(finder.FindFile( dllname ))
return path;
else {
@@ -301,7 +291,9 @@ static const C *findFilePath(const C *path,const C *dllname)
}
}
}
- return NULL;
+*/
+
+ return string();
}
@@ -309,15 +301,16 @@ BL vst::ms_plug(I argc,const A *argv)
{
ClearPlug();
- plugname.Empty();
+ plugname.clear();
C buf[255];
for(I i = 0; i < argc; i++) {
if(i > 0) plugname += ' ';
GetAString(argv[i],buf,sizeof buf);
+ strlwr(buf);
plugname += buf;
}
- plugname.MakeLower();
- if(!plugname.GetLength()) return false;
+
+ if(!plugname.length()) return false;
plug = new VSTPlugin;
@@ -329,14 +322,14 @@ BL vst::ms_plug(I argc,const A *argv)
int loaderr = VSTINSTANCE_NO_ERROR;
// try loading the dll from the raw filename
- if ((loaderr = plug->Instance(plugname)) == VSTINSTANCE_NO_ERROR) {
+ if ((loaderr = plug->Instance(plugname.c_str())) == VSTINSTANCE_NO_ERROR) {
FLEXT_LOG("raw filename loaded fine");
lf = true;
}
if(!lf) { // try finding it on the PD path
C *name,dir[1024];
- I fd = open_via_path("",plugname,".dll",dir,&name,sizeof(dir)-1,0);
+ I fd = open_via_path("",plugname.c_str(),".dll",dir,&name,sizeof(dir)-1,0);
if(fd > 0) close(fd);
else name = NULL;
@@ -345,19 +338,19 @@ BL vst::ms_plug(I argc,const A *argv)
// if dir is current working directory... name points to dir
if(dir == name) strcpy(dir,".");
- CString dllname(dir);
+ string dllname(dir);
dllname += "\\";
dllname += name;
- lf = (loaderr = plug->Instance(dllname)) == VSTINSTANCE_NO_ERROR;
+ lf = (loaderr = plug->Instance(dllname.c_str())) == VSTINSTANCE_NO_ERROR;
}
}
if(!lf) { // try finding it on the VST path
C *vst_path = getenv ("VST_PATH");
- CString dllname(plugname);
- if(dllname.Find(".dll") == -1) dllname += ".dll";
+ string dllname(plugname);
+ if(dllname.find(".dll") == -1) dllname += ".dll";
if(vst_path) {
FLEXT_LOG("found VST_PATH env variable");
@@ -365,18 +358,17 @@ BL vst::ms_plug(I argc,const A *argv)
strcpy( tok_path , vst_path);
char *tok = strtok( tok_path , ";" );
while( tok != NULL ) {
- CString abpath( tok );
- if( abpath.Right( 1 ) != _T("\\") ) abpath += "\\";
+ string abpath( tok );
+ if( abpath[abpath.length()-1] != '\\' ) abpath += "\\";
- FLEXT_LOG1("trying VST_PATH %s",(const C *)abpath);
+ FLEXT_LOG1("trying VST_PATH %s",(const C *)abpath.c_str());
- const char * realpath = findFilePath( abpath , dllname );
+ string realpath = findFilePath( abpath , dllname );
//post( "findFilePath( %s , %s ) = %s\n" , abpath , dllname , realpath );
- if ( realpath != NULL ) {
- CString rpath( realpath );
- rpath += plugname;
- FLEXT_LOG1("trying %s",(const C *)rpath);
- if((loaderr = plug->Instance( rpath )) == VSTINSTANCE_NO_ERROR ) {
+ if ( realpath.length() ) {
+ realpath += plugname;
+ FLEXT_LOG1("trying %s",(const C *)realpath.c_str());
+ if((loaderr = plug->Instance( realpath.c_str() )) == VSTINSTANCE_NO_ERROR ) {
FLEXT_LOG("plugin loaded via VST_PATH");
lf = true;
break;
@@ -601,26 +593,6 @@ V vst::m_print(I ac,const A *av)
}
-//! display an editor
-V vst::ms_edit(BL on)
-{
-#if FLEXT_OS == FLEXT_OS_WIN
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-#endif
-
- if(plug) plug->edit(on);
-}
-
-V vst::ms_vis(BL vis)
-{
-#if FLEXT_OS == FLEXT_OS_WIN
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-#endif
-
- if(plug) plug->visible(vis);
-}
-
-
V vst::display_parameter(I param,BL showparams)
{
int j = param;
diff --git a/externals/grill/vst/src/main.h b/externals/grill/vst/src/main.h
index a55e9410..4e6ed877 100644
--- a/externals/grill/vst/src/main.h
+++ b/externals/grill/vst/src/main.h
@@ -1,12 +1,10 @@
/*
-
-vst - VST plugin object for PD
+vst~ - VST plugin object for PD
based on the work of Jarno Seppänen and Mark Williamson
-Copyright (c) 2003 Thomas Grill (xovo@gmx.net)
+Copyright (c)2003-2004 Thomas Grill (xovo@gmx.net)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
-
*/
#ifndef __VST_H
@@ -16,12 +14,12 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <flext.h>
-#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 402)
-#error You need at least flext version 0.4.2
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 405)
+#error You need at least flext version 0.4.5
#endif
#if FLEXT_OS == FLEXT_OS_WIN
-#include "stdafx.h"
+//
#else
#error Platform not supported!
#endif
diff --git a/externals/grill/vst/src/vst.rc b/externals/grill/vst/src/vst.rc
index c32b58d9..bc1a1b94 100644
--- a/externals/grill/vst/src/vst.rc
+++ b/externals/grill/vst/src/vst.rc
@@ -1,4 +1,4 @@
-//Microsoft Developer Studio generated resource script.
+// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
@@ -21,7 +21,6 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
-#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
@@ -44,18 +43,13 @@ BEGIN
BEGIN
BLOCK "040904b0"
BEGIN
- VALUE "Comments", "\0"
- VALUE "CompanyName", "\0"
- VALUE "FileDescription", "vst~ external\0"
- VALUE "FileVersion", "1, 0, 0, 1\0"
- VALUE "InternalName", "vst~\0"
- VALUE "LegalCopyright", "Copyright (C) 2003\0"
- VALUE "LegalTrademarks", "\0"
- VALUE "OriginalFilename", "vst~.DLL\0"
- VALUE "PrivateBuild", "\0"
- VALUE "ProductName", "VST plugin object\0"
- VALUE "ProductVersion", "1, 0, 0, 1\0"
- VALUE "SpecialBuild", "\0"
+ VALUE "FileDescription", "vst~ external"
+ VALUE "FileVersion", "0,1, 0, 8"
+ VALUE "InternalName", "vst~"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2004 Thomas Grill"
+ VALUE "OriginalFilename", "vst~.DLL"
+ VALUE "ProductName", "VST plugin object"
+ VALUE "ProductVersion", "0, 1, 0, 8"
END
END
BLOCK "VarFileInfo"
@@ -64,8 +58,6 @@ BEGIN
END
END
-#endif // !_MAC
-
#endif // Englisch (USA) resources
/////////////////////////////////////////////////////////////////////////////
@@ -85,18 +77,18 @@ LANGUAGE LANG_GERMAN, SUBLANG_GERMAN_AUSTRIAN
// TEXTINCLUDE
//
-1 TEXTINCLUDE DISCARDABLE
+1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
-2 TEXTINCLUDE DISCARDABLE
+2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
-3 TEXTINCLUDE DISCARDABLE
+3 TEXTINCLUDE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"