aboutsummaryrefslogtreecommitdiff
path: root/externals
diff options
context:
space:
mode:
Diffstat (limited to 'externals')
-rw-r--r--externals/grill/vst/config-pd-msvc.txt6
-rw-r--r--externals/grill/vst/make-files.txt5
-rw-r--r--externals/grill/vst/makefile.pd-msvc14
-rw-r--r--externals/grill/vst/pd/vst~.pd16
-rw-r--r--externals/grill/vst/readme.txt6
-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
-rw-r--r--externals/grill/vst/vst.vcproj112
13 files changed, 377 insertions, 296 deletions
diff --git a/externals/grill/vst/config-pd-msvc.txt b/externals/grill/vst/config-pd-msvc.txt
index 308bfcc3..ebd41e4b 100644
--- a/externals/grill/vst/config-pd-msvc.txt
+++ b/externals/grill/vst/config-pd-msvc.txt
@@ -23,4 +23,8 @@ OUTPATH=pd-msvc
# where should the external be installed?
# (leave blank to omit installation)
-INSTDIR=$(PDPATH)\extra
+INSTPATH=$(PDPATH)\extra
+
+
+# user defined compile flags
+UFLAGS=/G6 /Ox
diff --git a/externals/grill/vst/make-files.txt b/externals/grill/vst/make-files.txt
index 67823ba6..593054b9 100644
--- a/externals/grill/vst/make-files.txt
+++ b/externals/grill/vst/make-files.txt
@@ -1,7 +1,6 @@
# all the source files from the package
SRCS= main.cpp
-SRCS_WIN=EditorThread.cpp PopupWindow.cpp VstHost.cpp StdAfx.cpp
+SRCS_WIN=VstHost.cpp EditorWin.cpp
-HDRS= \
- main.h vst.h
+HDRS= main.h VstHost.h Editor.h
diff --git a/externals/grill/vst/makefile.pd-msvc b/externals/grill/vst/makefile.pd-msvc
index cbcb09c3..aaddf3e2 100644
--- a/externals/grill/vst/makefile.pd-msvc
+++ b/externals/grill/vst/makefile.pd-msvc
@@ -6,7 +6,7 @@
# WARRANTIES, see the file, "license.txt," in this distribution.
#
#
-# Makefile for MSVC++ 6
+# Makefile for MSVC++ 6 or 7
#
# usage:
# to build run "make -f makefile.pd-msvc"
@@ -15,15 +15,15 @@
!include config-pd-msvc.txt
# includes
-INCPATH=/I"$(MSVCPATH)\include" /I"$(MSVCPATH)\mfc\include" /I"$(PDPATH)\src" /I"$(FLEXTPATH)"
-LIBPATH=/LIBPATH:"$(PDPATH)\bin" /LIBPATH:"$(FLEXTPATH)" /LIBPATH:"$(MSVCPATH)\lib" /LIBPATH:"$(MSVCPATH)\mfc\lib"
-LIBS=pd.lib pthreadVC.lib flext_t-pdwin.lib # DelayImp.lib
+INCPATH=/I"$(MSVCPATH)\include" /I"$(PDPATH)\src" /I"$(FLEXTPATH)"
+LIBPATH=/LIBPATH:"$(PDPATH)\bin" /LIBPATH:"$(FLEXTPATH)" /LIBPATH:"$(MSVCPATH)\lib"
+LIBS=pd.lib pthreadVC.lib user32.lib flext_t-pdwin.lib
# compiler definitions and flags
-DEFS=/D_USRDLL /D_WINDLL /D_MBCS /DFLEXT_SYS=2 /DFLEXT_THREADS
+DEFS=/DFLEXT_SYS=2 /DFLEXT_THREADS
+
+CFLAGS=/MT /EHsc $(UFLAGS)
-CFLAGS=/G6 /Ox /MT /EHsc
-# LDFLAGS=/DELAYLOAD:OleAcc.dll
# the rest can stay untouched
# ----------------------------------------------
diff --git a/externals/grill/vst/pd/vst~.pd b/externals/grill/vst/pd/vst~.pd
index 6bbceff8..73ae8ae5 100644
--- a/externals/grill/vst/pd/vst~.pd
+++ b/externals/grill/vst/pd/vst~.pd
@@ -1,4 +1,4 @@
-#N canvas 108 26 874 656 12;
+#N canvas 105 26 856 641 12;
#X obj 26 190 dac~;
#X obj 26 94 noise~;
#X obj 444 172 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -225271
@@ -8,7 +8,7 @@
#X obj 27 451 tgl 15 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0 1
;
#X msg 26 473 vis \$1;
-#X obj 27 367 tgl 15 0 empty empty empty 0 -6 0 8 -225271 -1 -1 1 1
+#X obj 27 367 tgl 15 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0 1
;
#X msg 26 389 edit \$1;
#X msg 94 389 getedit;
@@ -125,7 +125,6 @@
#X text 469 496 set/get program (0-based);
#X text 487 254 NOT IMPLEMENTED;
#X text 484 315 NOT IMPLEMENTED;
-#X text 133 14 VST plugins for PD \, (C)2003 Thomas Grill;
#X msg 28 296 plug \$1;
#X obj 27 240 bng 25 250 50 0 empty empty empty 0 -6 0 8 -225271 -1
-1;
@@ -156,9 +155,10 @@
#X text 93 582 midi messages for vst synths;
#X msg 414 442 getprogcats;
#X text 509 439 get number of program categories;
-#X obj 26 140 vst~ 1 2 SIR;
#X text 134 33 based on the work of Jarno Seppanen and Mark Williamson
;
+#X obj 26 140 vst~ 1 2;
+#X text 133 14 VST plugins for PD \, (C)2003-04 Thomas Grill;
#X connect 1 0 55 0;
#X connect 2 0 3 0;
#X connect 3 0 17 0;
@@ -180,10 +180,10 @@
#X connect 39 0 17 0;
#X connect 40 0 17 0;
#X connect 42 0 17 0;
-#X connect 48 0 27 0;
-#X connect 49 0 50 0;
-#X connect 50 0 48 0;
-#X connect 53 0 18 0;
+#X connect 47 0 27 0;
+#X connect 48 0 49 0;
+#X connect 49 0 47 0;
+#X connect 52 0 18 0;
#X connect 55 0 0 0;
#X connect 55 1 0 1;
#X connect 55 2 4 0;
diff --git a/externals/grill/vst/readme.txt b/externals/grill/vst/readme.txt
index f5842a32..c33c56e3 100644
--- a/externals/grill/vst/readme.txt
+++ b/externals/grill/vst/readme.txt
@@ -1,7 +1,7 @@
vst~ - VST plugin external for PD
based on the work of Jarno Seppänen and Mark Williamson
-Copyright (c)2003 Thomas Grill (xovo@gmx.net)
+Copyright (c)2003-04 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.
@@ -22,8 +22,7 @@ BUILDING:
pd - Windows:
-------------
-o Microsoft Visual C++ 6: edit the project file "vst.dsp" & build
-
+o Microsoft Visual C++ 6 or 7 (.NET): edit "config-pd-msvc.txt" & run "build-pd-msvc.bat"
NOT YET:
@@ -49,6 +48,7 @@ Version history:
- make editor window closable by patch
- plugin can be changed with plug attribute
- fixed crash on destroying vst~ with open editor window
+- stripped all MFC code
0.0.0:
- version of mark@junklight.com
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"
diff --git a/externals/grill/vst/vst.vcproj b/externals/grill/vst/vst.vcproj
index 5a0fcac4..f67fca04 100644
--- a/externals/grill/vst/vst.vcproj
+++ b/externals/grill/vst/vst.vcproj
@@ -18,7 +18,7 @@
OutputDirectory=".\pd-msvc/r"
IntermediateDirectory=".\pd-msvc/r"
ConfigurationType="2"
- UseOfMFC="1"
+ UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
@@ -29,7 +29,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="f:\prog\pd\pd-cvs\src,f:\prog\packs\pthreads,f:\prog\max\flext\source"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;WINVER=0x0501;_USRDLL;FLEXT_SYS=2;FLEXT_THREADS;FLEXT_NOGLOBALNEW"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;WINVER=0x0501;_USRDLL;FLEXT_SYS=2;FLEXT_THREADS"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
@@ -84,7 +84,7 @@
OutputDirectory=".\pd-msvc/d"
IntermediateDirectory=".\pd-msvc/d"
ConfigurationType="2"
- UseOfMFC="1"
+ UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
@@ -148,7 +148,7 @@
OutputDirectory=".\pd-msvc/s"
IntermediateDirectory=".\pd-msvc/s"
ConfigurationType="2"
- UseOfMFC="2"
+ UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
@@ -323,110 +323,13 @@
</File>
</Filter>
<Filter
- Name="mfc"
- Filter="">
- <File
- RelativePath="src\Resource.h">
- </File>
- <File
- RelativePath="src\StdAfx.cpp">
- <FileConfiguration
- Name="PD Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- <FileConfiguration
- Name="PD Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"
- BrowseInformation="1"/>
- </FileConfiguration>
- <FileConfiguration
- Name="PD Shared Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="src\StdAfx.h">
- </File>
- </Filter>
- <Filter
Name="host"
Filter="">
<File
- RelativePath="src\EditorThread.cpp">
- <FileConfiguration
- Name="PD Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- <FileConfiguration
- Name="PD Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"
- BrowseInformation="1"/>
- </FileConfiguration>
- <FileConfiguration
- Name="PD Shared Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="src\EditorThread.h">
- </File>
- <File
- RelativePath="src\PopupWindow.cpp">
- <FileConfiguration
- Name="PD Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- <FileConfiguration
- Name="PD Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"
- BrowseInformation="1"/>
- </FileConfiguration>
- <FileConfiguration
- Name="PD Shared Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
+ RelativePath=".\src\Editor.h">
</File>
<File
- RelativePath="src\PopupWindow.h">
+ RelativePath=".\src\EditorWin.cpp">
</File>
<File
RelativePath="src\vst.rc">
@@ -530,9 +433,6 @@
<File
RelativePath="src\main.h">
</File>
- <File
- RelativePath="src\vst.h">
- </File>
</Files>
<Globals>
</Globals>