diff options
Diffstat (limited to 'externals/grill/vst')
-rw-r--r-- | externals/grill/vst/pd/vst~.pd | 19 | ||||
-rw-r--r-- | externals/grill/vst/readme.txt | 115 | ||||
-rw-r--r-- | externals/grill/vst/src/VstHost.cpp | 1108 | ||||
-rw-r--r-- | externals/grill/vst/src/VstHost.h | 2 | ||||
-rw-r--r-- | externals/grill/vst/src/main.cpp | 1429 | ||||
-rw-r--r-- | externals/grill/vst/vst.dsp | 420 |
6 files changed, 1564 insertions, 1529 deletions
diff --git a/externals/grill/vst/pd/vst~.pd b/externals/grill/vst/pd/vst~.pd index 56b795ef..0900c359 100644 --- a/externals/grill/vst/pd/vst~.pd +++ b/externals/grill/vst/pd/vst~.pd @@ -1,4 +1,4 @@ -#N canvas 108 26 866 648 12;
+#N canvas 108 26 868 650 12;
#X obj 26 207 dac~;
#X obj 26 107 noise~;
#X obj 444 172 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -225271
@@ -13,7 +13,7 @@ #X msg 26 389 edit \$1;
#X msg 94 389 getedit;
#X msg 89 473 getvis;
-#N canvas 367 122 542 449 info 0;
+#N canvas 367 122 544 451 info 0;
#X msg 94 130 getversion;
#X msg 94 75 getname;
#X msg 95 153 getvendor;
@@ -51,16 +51,16 @@ #X connect 11 0 7 0;
#X connect 19 0 7 0;
#X connect 21 0 7 0;
-#X restore 414 537 pd info;
+#X restore 414 561 pd info;
#X obj 96 109 r \$0-vst;
#X obj 25 416 s \$0-vst;
#X obj 25 499 s \$0-vst;
#X text 52 366 display edit window;
#X text 50 449 make edit window (in)visible;
#X obj 413 353 s \$0-vst;
-#X obj 414 493 s \$0-vst;
-#X msg 443 447 program 2;
-#X msg 529 446 getprogram;
+#X obj 414 517 s \$0-vst;
+#X msg 443 471 program 2;
+#X msg 529 470 getprogram;
#X msg 413 109 getparams;
#X text 498 108 get number of parameters;
#X text 509 414 get number of programs;
@@ -69,7 +69,7 @@ #X msg 105 295 getplug;
#X obj 26 323 s \$0-vst;
#X text 175 294 set/get plugin;
-#X text 480 537 further information;
+#X text 480 561 further information;
#X obj 23 15 cnv 15 550 58 empty empty vst~ 10 32 0 24 -260818 -1 0
;
#X text 134 53 http://www.parasitaere-kapazitaeten.net;
@@ -123,7 +123,7 @@ #X text 455 310 get value in textual representation;
#X msg 440 283 getptext 2;
#X text 466 211 set/get parameter (0-based);
-#X text 469 472 set/get program (0-based);
+#X text 469 496 set/get program (0-based);
#X text 487 251 NOT IMPLEMENTED;
#X text 544 270 NOT IMPLEMENTED;
#X obj 26 153 vst~ 1 2 reson;
@@ -156,6 +156,8 @@ #X connect 12 0 0 0;
#X restore 25 581 pd midi;
#X text 93 582 midi messages for vst synths;
+#X msg 414 442 getprogcats;
+#X text 509 439 get number of program categories;
#X connect 1 0 48 0;
#X connect 2 0 3 0;
#X connect 3 0 17 0;
@@ -183,3 +185,4 @@ #X connect 50 0 27 0;
#X connect 51 0 52 0;
#X connect 52 0 50 0;
+#X connect 55 0 18 0;
diff --git a/externals/grill/vst/readme.txt b/externals/grill/vst/readme.txt index 3918a7b2..6af5edc3 100644 --- a/externals/grill/vst/readme.txt +++ b/externals/grill/vst/readme.txt @@ -1,56 +1,59 @@ -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)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-Donations for further development of the package are highly appreciated.
-
-----------------------------------------------------------------------------
-
-You will need the flext C++ layer for PD and Max/MSP externals to compile this.
-see http://www.parasitaere-kapazitaeten.net/ext
-
-----------------------------------------------------------------------------
-
-
-BUILDING:
-=========
-
-
-pd - Windows:
--------------
-o Microsoft Visual C++ 6: edit the project file "vst.dsp" & build
-
-pd - darwin (MacOSX):
----------------------
-o GCC: edit "config-pd-darwin.txt" & run "sh build-pd-darwin.sh"
-
-Max/MSP - MacOS9/X:
--------------------
-o CodeWarrior: edit "vst.cw" and build
-
-
-----------------------------------------------------------------------------
-
-Version history:
-
-0.1.0:
-- fixed crash when there's no "VST_PATH" environment string found
-- included pd path into VST search path
-- made thread of editor window low priority
-- introduced A LOT of attributes to get info about the plugin
-- make editor window closable by patch
-- plugin can be changed with plug attribute
-
-0.0.0:
-- version of mark@junklight.com
-
----------------------------------------------------------------------------
-
-features:
-- allow various window styles and window moving & titling
-- include necessary Steinberg license stuff
-
-
+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) +For information on usage and redistribution, and for a DISCLAIMER OF ALL +WARRANTIES, see the file, "license.txt," in this distribution. + +Donations for further development of the package are highly appreciated. + +---------------------------------------------------------------------------- + +You will need the flext C++ layer for PD and Max/MSP externals to compile this. +see http://www.parasitaere-kapazitaeten.net/ext + +---------------------------------------------------------------------------- + + +BUILDING: +========= + + +pd - Windows: +------------- +o Microsoft Visual C++ 6: edit the project file "vst.dsp" & build + +pd - darwin (MacOSX): +--------------------- +o GCC: edit "config-pd-darwin.txt" & run "sh build-pd-darwin.sh" + +Max/MSP - MacOS9/X: +------------------- +o CodeWarrior: edit "vst.cw" and build + + +---------------------------------------------------------------------------- + +Version history: + +0.1.0: +- fixed crash when there's no "VST_PATH" environment string found +- included pd path into VST search path +- made thread of editor window low priority +- introduced A LOT of attributes to get info about the plugin +- make editor window closable by patch +- plugin can be changed with plug attribute + +0.0.0: +- version of mark@junklight.com + +--------------------------------------------------------------------------- + +features: +- allow various window styles and window moving & titling +- include necessary Steinberg license stuff + +BUGS: +- strange: GRM reson stutters when GUI is edited with the mouse (mousedown) + -> plug sends (a lot of) idle messages + -> no stuttering when a message is posted to the console... ähem diff --git a/externals/grill/vst/src/VstHost.cpp b/externals/grill/vst/src/VstHost.cpp index 8e6f2eb4..57a67c52 100644 --- a/externals/grill/vst/src/VstHost.cpp +++ b/externals/grill/vst/src/VstHost.cpp @@ -1,541 +1,567 @@ -#include "stdafx.h"
-#include "EditorThread.h"
-#include "VstHost.h"
-#include "PopupWindow.h"
-#include "vst\aeffeditor.h"
-#include "vst\aeffectx.h"
-
-
-VstTimeInfo VSTPlugin::_timeInfo;
-
-float VSTPlugin::sample_rate = 44100;
-
-
-extern "C" void post(char *fmt, ...);
-
-////////////////////
-//
-/////////////////////
-VSTPlugin::VSTPlugin():
- posx(0),posy(0),
- _editor(false)
-{
- queue_size=0;
- _sDllName = NULL;
- h_dll=NULL;
- instantiated=false; // Constructin' with no instance
- overwrite = false;
- w = GetForegroundWindow();
-// show_params = false;
- _midichannel = 0;
- edited = false;
-}
-
-VSTPlugin::~VSTPlugin()
-{
- Free(); // Call free
- delete _sDllName; // if _sDllName = NULL , the operation does nothing -> it's safe.
-}
-
-int VSTPlugin::Instance( const char *dllname)
-{
- h_dll=LoadLibrary(dllname);
-
- if(h_dll==NULL)
- {
- return VSTINSTANCE_ERR_NO_VALID_FILE;
- }
-// post("Loaded library %s" , dllname);
- PVSTMAIN main = (PVSTMAIN)GetProcAddress(h_dll,"main");
- if(!main)
- {
- FreeLibrary(h_dll);
- _pEffect=NULL;
- instantiated=false;
- return VSTINSTANCE_ERR_NO_VST_PLUGIN;
- }
- //post("Found main function - about to call it");
- //This calls the "main" function and receives the pointer to the AEffect structure.
- _pEffect = main((audioMasterCallback)&(this->Master));
-
- if(!_pEffect)
- {
- post("VST plugin : unable to create effect");
- FreeLibrary(h_dll);
- _pEffect=NULL;
- instantiated=false;
- return VSTINSTANCE_ERR_REJECTED;
- }
-
- if( _pEffect->magic!=kEffectMagic)
- {
- post("VST plugin : Instance query rejected by 0x%.8X\n",(int)_pEffect);
- FreeLibrary(h_dll);
- _pEffect=NULL;
- instantiated=false;
- return VSTINSTANCE_ERR_REJECTED;
- }
-
- //post("VST plugin : Instanced at (Effect*): %.8X\n",(int)_pEffect);
-
- //init plugin
- _pEffect->user = this;
- Dispatch( effOpen , 0, 0, NULL, 0.0f);
- Dispatch( effSetProgram , 0, 0, NULL, 0.0f);
-// Dispatch( effMainsChanged, 0, 1, NULL, 0.0f);
-
- //************************************set samplerate and stream size here
- // we get it when we init our DSP
-
-// Dispatch( effSetSampleRate, 0, 0, NULL, (float)Global::pConfig->_pOutputDriver->_samplesPerSec);
-// 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 );
- }
- else
- {
- str1 = str2;
- }
- strcpy(_sProductName,str1);
-
- }
-
- 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;
- _editor = (_pEffect->flags & effFlagsHasEditor)?true:false;
-
- if ( _sDllName != NULL ) delete _sDllName;
- _sDllName = new char[strlen(dllname)+1];
- sprintf(_sDllName,dllname);
-
-
-
-
- //keep plugin name
- instantiated=true;
-
- return VSTINSTANCE_NO_ERROR;
-}
-
-int VSTPlugin::getNumInputs( void )
-{
- return _pEffect->numInputs;
-}
-
-int VSTPlugin::getNumOutputs( void )
-{
- return _pEffect->numOutputs;
-}
-
-
-void VSTPlugin::Create(VSTPlugin *plug)
-{
- h_dll=plug->h_dll;
- _pEffect=plug->_pEffect;
- _pEffect->user=this;
- Dispatch( effMainsChanged, 0, 1, NULL, 0.0f);
-// strcpy(_editName,plug->_editName); On current implementation, this replaces the right one.
- strcpy(_sProductName,plug->_sProductName);
- strcpy(_sVendorName,plug->_sVendorName);
-
- _sDllName = new char[strlen(plug->_sDllName)+1];
- strcpy(_sDllName,plug->_sDllName);
-
- _isSynth=plug->_isSynth;
- _version=plug->_version;
-
- plug->instantiated=false; // We are "stoling" the plugin from the "plug" object so this
- // is just a "trick" so that when destructing the "plug", it
- // doesn't unload the Dll.
- instantiated=true;
-}
-
-void VSTPlugin::Free() // Called also in destruction
-{
- if(instantiated)
- {
- instantiated=false;
- post("VST plugin : Free query 0x%.8X\n",(int)_pEffect);
- _pEffect->user = NULL;
- Dispatch( effMainsChanged, 0, 0, NULL, 0.0f);
- Dispatch( effClose, 0, 0, NULL, 0.0f);
-// delete _pEffect; // <- Should check for the necessity of this command.
- _pEffect=NULL;
- FreeLibrary(h_dll);
- }
-}
-
-void VSTPlugin::Init( float samplerate , float blocksize )
-{
- sample_rate = samplerate;
- Dispatch(effOpen , 0, 0, NULL, 0.f);
- Dispatch(effMainsChanged, 0, 1, NULL, 0.f);
- Dispatch(effSetSampleRate, 0, 0, 0, (float) sample_rate );
- Dispatch(effSetBlockSize, 0, blocksize, NULL, 0.f );
-}
-
-
-bool VSTPlugin::DescribeValue(int p,char* psTxt)
-{
- int parameter = p;
- if(instantiated)
- {
- if(parameter<_pEffect->numParams)
- {
-// char par_name[64];
- char par_display[64];
- char par_label[64];
-
-// Dispatch(effGetParamName,parameter,0,par_name,0.0f);
- Dispatch(effGetParamDisplay,parameter,0,par_display,0.0f);
- Dispatch(effGetParamLabel,parameter,0,par_label,0.0f);
-// sprintf(psTxt,"%s:%s%s",par_name,par_display,par_label);
- sprintf(psTxt,"%s%s",par_display,par_label);
- return true;
- }
- else sprintf(psTxt,"NumParams Exeeded");
- }
- else sprintf(psTxt,"Not loaded");
-
- return false;
-}
-
-bool VSTPlugin::SetParameter(int parameter, float value)
-{
- if(instantiated)
- {
- if (( parameter >= 0 ) && (parameter<=_pEffect->numParams))
- {
- _pEffect->setParameter(_pEffect,parameter,value);
- return true;
- }
- }
-
- return false;
-}
-
-bool VSTPlugin::SetParameter(int parameter, int value)
-{
- return SetParameter(parameter,value/65535.0f);
-}
-
-int VSTPlugin::GetCurrentProgram()
-{
- if(instantiated)
- return Dispatch(effGetProgram,0,0,NULL,0.0f);
- else
- return 0;
-}
-
-void VSTPlugin::SetCurrentProgram(int prg)
-{
- if(instantiated)
- Dispatch(effSetProgram,0,prg,NULL,0.0f);
-}
-
-bool VSTPlugin::AddMIDI(unsigned char data0,unsigned char data1,unsigned char data2)
-{
- if (instantiated)
- {
- VstMidiEvent* pevent=&midievent[queue_size];
-
- pevent->type = kVstMidiType;
- pevent->byteSize = 24;
- pevent->deltaFrames = 0;
- pevent->flags = 0;
- pevent->detune = 0;
- pevent->noteLength = 0;
- pevent->noteOffset = 0;
- pevent->reserved1 = 0;
- pevent->reserved2 = 0;
- pevent->noteOffVelocity = 0;
- pevent->midiData[0] = data0;
- pevent->midiData[1] = data1;
- pevent->midiData[2] = data2;
- pevent->midiData[3] = 0;
-
- if ( queue_size < MAX_EVENTS ) queue_size++;
- SendMidi();
- return true;
- }
- else return false;
-}
-
-
-void VSTPlugin::SendMidi()
-{
- if(/*instantiated &&*/ queue_size>0)
- {
- // Prepare MIDI events and free queue dispatching all events
- events.numEvents = queue_size;
- events.reserved = 0;
- for(int q=0;q<queue_size;q++) events.events[q] = (VstEvent*)&midievent[q];
-
- Dispatch(effProcessEvents, 0, 0, &events, 0.0f);
- queue_size=0;
- }
-}
-
-
-void VSTPlugin::processReplacing( float **inputs, float **outputs, long sampleframes )
-{
- _pEffect->processReplacing( _pEffect , inputs , outputs , sampleframes );
-
-}
-
-void VSTPlugin::process( float **inputs, float **outputs, long sampleframes )
-{
- _pEffect->process( _pEffect , inputs , outputs , sampleframes );
-}
-
-
-// Host callback dispatcher
-long VSTPlugin::Master(AEffect *effect, long opcode, long index, long value, void *ptr, float opt)
-{
- 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);
-
- // Support opcodes
- switch(opcode)
- {
- case audioMasterAutomate:
- return 0; // index, value, returns 0
-
- case audioMasterVersion:
- return 9; // vst version, currently 7 (0 for older)
-
- case audioMasterCurrentId:
- return 'AASH'; // returns the unique id of a plug that's currently loading
-
- case audioMasterIdle:
- effect->dispatcher(effect, effEditIdle, 0, 0, NULL, 0.0f);
- return 0; // call application idle routine (this will call effEditIdle for all open editors too)
-
- case audioMasterPinConnected:
- return false; // inquire if an input or output is beeing connected;
-
- case audioMasterWantMidi:
- return 0;
-
- case audioMasterProcessEvents:
- return 0; // Support of vst events to host is not available
-
- case audioMasterGetTime:
- memset(&_timeInfo, 0, sizeof(_timeInfo));
- _timeInfo.samplePos = 0;
- _timeInfo.sampleRate = sample_rate;
- return (long)&_timeInfo;
-
-
- case audioMasterTempoAt:
- return 0;
-
- case audioMasterNeedIdle:
- effect->dispatcher(effect, effIdle, 0, 0, NULL, 0.0f);
- return 1;
-
- case audioMasterGetSampleRate:
- return sample_rate;
-
- case audioMasterGetVendorString: // Just fooling version string
- strcpy((char*)ptr,"Steinberg");
- return 0;
-
- case audioMasterGetVendorVersion:
- return 5000; // HOST version 5000
-
- case audioMasterGetProductString: // Just fooling product string
- strcpy((char*)ptr,"Cubase 5.0");
- return 0;
-
- case audioMasterVendorSpecific:
- {
- return 0;
- }
-
-
- case audioMasterGetLanguage:
- return kVstLangEnglish;
-
- case audioMasterUpdateDisplay:
- post("audioMasterUpdateDisplay");
- effect->dispatcher(effect, effEditIdle, 0, 0, NULL, 0.0f);
- return 0;
-
-
- case audioMasterSetTime: post("VST master dispatcher: Set Time");break;
- case audioMasterGetNumAutomatableParameters: post("VST master dispatcher: GetNumAutPar");break;
- case audioMasterGetParameterQuantization: post("VST master dispatcher: ParamQuant");break;
- case audioMasterIOChanged: post("VST master dispatcher: IOchanged");break;
- case audioMasterSizeWindow: post("VST master dispatcher: Size Window");break;
- case audioMasterGetBlockSize: post("VST master dispatcher: GetBlockSize");break;
- case audioMasterGetInputLatency: post("VST master dispatcher: GetInLatency");break;
- case audioMasterGetOutputLatency: post("VST master dispatcher: GetOutLatency");break;
- case audioMasterGetPreviousPlug: post("VST master dispatcher: PrevPlug");break;
- case audioMasterGetNextPlug: post("VST master dispatcher: NextPlug");break;
- case audioMasterWillReplaceOrAccumulate: post("VST master dispatcher: WillReplace"); break;
- case audioMasterGetCurrentProcessLevel: return 0; break;
- case audioMasterGetAutomationState: post("VST master dispatcher: GetAutState");break;
- case audioMasterOfflineStart: post("VST master dispatcher: Offlinestart");break;
- case audioMasterOfflineRead: post("VST master dispatcher: Offlineread");break;
- case audioMasterOfflineWrite: post("VST master dispatcher: Offlinewrite");break;
- case audioMasterOfflineGetCurrentPass: post("VST master dispatcher: OfflineGetcurrentpass");break;
- case audioMasterOfflineGetCurrentMetaPass: post("VST master dispatcher: GetGetCurrentMetapass");break;
- case audioMasterSetOutputSampleRate: post("VST master dispatcher: Setsamplerate");break;
- case audioMasterGetSpeakerArrangement: post("VST master dispatcher: Getspeaker");break;
- case audioMasterSetIcon: post("VST master dispatcher: seticon");break;
- case audioMasterCanDo: post("VST master dispatcher: Can Do");break;
- case audioMasterOpenWindow: post("VST master dispatcher: OpenWindow");break;
- case audioMasterCloseWindow: post("VST master dispatcher: CloseWindow");break;
- case audioMasterGetDirectory: post("VST master dispatcher: GetDirectory");break;
-// case audioMasterUpdateDisplay: post("VST master dispatcher: audioMasterUpdateDisplay");break;
-
- default: post("VST master dispatcher: undefed: %d , %d",opcode , effKeysRequired ) ;break;
- }
-
- return 0;
-}
-
-bool VSTPlugin::AddNoteOn( unsigned char note,unsigned char speed,unsigned char midichannel)
-{
- return AddMIDI((char)MIDI_NOTEON | midichannel,note,speed);
-}
-
-bool VSTPlugin::AddNoteOff( unsigned char note,unsigned char midichannel)
-{
- return AddMIDI((char)MIDI_NOTEOFF | midichannel,note,0);
-}
-
-
-bool VSTPlugin::replace()
-{
- return overwrite;
-}
-
-
-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();
- }
- }
-}
-
-void VSTPlugin::visible(bool vis)
-{
- if(instantiated && edited) b->Show(vis);
-}
-
-void VSTPlugin::EditorIdle()
-{
- Dispatch(effEditIdle,0,0, w,0.0f);
-}
-
-RECT VSTPlugin::GetEditorRect()
-{
- RECT ret;
- ERect *r;
- Dispatch(effEditGetRect,0,0, &r,0.0f);
- ret.top = r->top;
- ret.bottom = r->bottom;
- ret.left = r->left;
- ret.right = r->right;
- return ret;
-}
-
-void VSTPlugin::SetEditWindow(HWND h)
-{
- w = h;
- Dispatch(effEditOpen,0,0, w,0.0f);
-}
-
-void VSTPlugin::OnEditorClose()
-{
- Dispatch(effEditClose,0,0, w,0.0f);
-}
-
-/*
-void VSTPlugin::SetShowParameters(bool s)
-{
- show_params = s;
-}
-
-bool VSTPlugin::ShowParams()
-{
- return show_params;
-}
-*/
-
-void VSTPlugin::AddAftertouch(int value)
-{
- if (value < 0) value = 0; else if (value > 127) value = 127;
- AddMIDI( (char)MIDI_NOTEOFF | _midichannel , value );
-}
-
-void VSTPlugin::AddPitchBend(int value)
-{
- AddMIDI( MIDI_PITCHBEND + (_midichannel & 0xf) , ((value>>7) & 127), (value & 127));
-}
-
-void VSTPlugin::AddProgramChange(int value)
-{
- if (value < 0) value = 0; else if (value > 127) value = 127;
- AddMIDI( MIDI_PROGRAMCHANGE + (_midichannel & 0xf), value, 0);
-}
-
-void VSTPlugin::AddControlChange(int control, int value)
-{
- if (control < 0) control = 0; else if (control > 127) control = 127;
- if (value < 0) value = 0; else if (value > 127) value = 127;
- AddMIDI( MIDI_CONTROLCHANGE + (_midichannel & 0xf), control, value);
-}
-
-
-bool VSTPlugin::GetProgramName( int cat , int p, char *buf)
-{
- int parameter = p;
- if(instantiated)
- {
- if(parameter<NumPrograms())
- {
- Dispatch(effGetProgramNameIndexed,parameter,cat,buf,0.0f);
- return true;
- }
- }
- return false;
-}
-
-int VSTPlugin::GetNumCategories()
-{
- if(instantiated)
- return Dispatch(effGetNumProgramCategories,0,0,NULL,0.0f);
- else
- return 0;
-}
-
-void VSTPlugin::StopEditing()
-{
- edited = false;
-}
+#include "stdafx.h" +#include "EditorThread.h" +#include "VstHost.h" +#include "PopupWindow.h" +#include "vst\aeffeditor.h" +#include "vst\aeffectx.h" +#include <flext.h> + +VstTimeInfo VSTPlugin::_timeInfo; + +float VSTPlugin::sample_rate = 44100; + + +//////////////////// +// +///////////////////// +VSTPlugin::VSTPlugin(): + posx(0),posy(0), + _editor(false) +{ + queue_size=0; + _sDllName = NULL; + h_dll=NULL; + instantiated=false; // Constructin' with no instance + overwrite = false; +// wantidle = false; + w = GetForegroundWindow(); +// show_params = false; + _midichannel = 0; + edited = false; +} + +VSTPlugin::~VSTPlugin() +{ + Free(); // Call free + delete _sDllName; // if _sDllName = NULL , the operation does nothing -> it's safe. +} + +int VSTPlugin::Instance( const char *dllname) +{ + h_dll=LoadLibrary(dllname); + + if(h_dll==NULL) + { + return VSTINSTANCE_ERR_NO_VALID_FILE; + } +// post("Loaded library %s" , dllname); + PVSTMAIN main = (PVSTMAIN)GetProcAddress(h_dll,"main"); + if(!main) + { + FreeLibrary(h_dll); + _pEffect=NULL; + instantiated=false; + return VSTINSTANCE_ERR_NO_VST_PLUGIN; + } + //post("Found main function - about to call it"); + //This calls the "main" function and receives the pointer to the AEffect structure. + _pEffect = main((audioMasterCallback)&(this->Master)); + + if(!_pEffect) + { + post("VST plugin : unable to create effect"); + FreeLibrary(h_dll); + _pEffect=NULL; + instantiated=false; + return VSTINSTANCE_ERR_REJECTED; + } + + if( _pEffect->magic!=kEffectMagic) + { + post("VST plugin : Instance query rejected by 0x%.8X\n",(int)_pEffect); + FreeLibrary(h_dll); + _pEffect=NULL; + instantiated=false; + return VSTINSTANCE_ERR_REJECTED; + } + + //post("VST plugin : Instanced at (Effect*): %.8X\n",(int)_pEffect); + + //init plugin + _pEffect->user = this; + Dispatch( effOpen , 0, 0, NULL, 0.0f); + Dispatch( effSetProgram , 0, 0, NULL, 0.0f); +// Dispatch( effMainsChanged, 0, 1, NULL, 0.0f); + + //************************************set samplerate and stream size here + // we get it when we init our DSP + +// Dispatch( effSetSampleRate, 0, 0, NULL, (float)Global::pConfig->_pOutputDriver->_samplesPerSec); +// 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 ); + } + else + { + str1 = str2; + } + strcpy(_sProductName,str1); + + } + + 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; + _editor = (_pEffect->flags & effFlagsHasEditor)?true:false; + + if ( _sDllName != NULL ) delete _sDllName; + _sDllName = new char[strlen(dllname)+1]; + sprintf(_sDllName,dllname); + + + + + //keep plugin name + instantiated=true; + + return VSTINSTANCE_NO_ERROR; +} + +int VSTPlugin::getNumInputs( void ) +{ + return _pEffect->numInputs; +} + +int VSTPlugin::getNumOutputs( void ) +{ + return _pEffect->numOutputs; +} + + +void VSTPlugin::Create(VSTPlugin *plug) +{ + h_dll=plug->h_dll; + _pEffect=plug->_pEffect; + _pEffect->user=this; + Dispatch( effMainsChanged, 0, 1, NULL, 0.0f); +// strcpy(_editName,plug->_editName); On current implementation, this replaces the right one. + strcpy(_sProductName,plug->_sProductName); + strcpy(_sVendorName,plug->_sVendorName); + + _sDllName = new char[strlen(plug->_sDllName)+1]; + strcpy(_sDllName,plug->_sDllName); + + _isSynth=plug->_isSynth; + _version=plug->_version; + + plug->instantiated=false; // We are "stoling" the plugin from the "plug" object so this + // is just a "trick" so that when destructing the "plug", it + // doesn't unload the Dll. + instantiated=true; +} + +void VSTPlugin::Free() // Called also in destruction +{ + if(instantiated) + { + instantiated=false; + post("VST plugin : Free query 0x%.8X\n",(int)_pEffect); + _pEffect->user = NULL; + Dispatch( effMainsChanged, 0, 0, NULL, 0.0f); + Dispatch( effClose, 0, 0, NULL, 0.0f); +// delete _pEffect; // <- Should check for the necessity of this command. + _pEffect=NULL; + FreeLibrary(h_dll); + } +} + +void VSTPlugin::Init( float samplerate , float blocksize ) +{ + sample_rate = samplerate; + Dispatch(effOpen , 0, 0, NULL, 0.f); + Dispatch(effMainsChanged, 0, 1, NULL, 0.f); + Dispatch(effSetSampleRate, 0, 0, 0, (float) sample_rate ); + Dispatch(effSetBlockSize, 0, blocksize, NULL, 0.f ); +} + + +bool VSTPlugin::DescribeValue(int p,char* psTxt) +{ + int parameter = p; + if(instantiated) + { + if(parameter<_pEffect->numParams) + { +// char par_name[64]; + char par_display[64]; + char par_label[64]; + +// Dispatch(effGetParamName,parameter,0,par_name,0.0f); + Dispatch(effGetParamDisplay,parameter,0,par_display,0.0f); + Dispatch(effGetParamLabel,parameter,0,par_label,0.0f); +// sprintf(psTxt,"%s:%s%s",par_name,par_display,par_label); + sprintf(psTxt,"%s%s",par_display,par_label); + return true; + } + else sprintf(psTxt,"NumParams Exeeded"); + } + else sprintf(psTxt,"Not loaded"); + + return false; +} + +bool VSTPlugin::SetParameter(int parameter, float value) +{ + if(instantiated) + { + if (( parameter >= 0 ) && (parameter<=_pEffect->numParams)) + { + _pEffect->setParameter(_pEffect,parameter,value); + return true; + } + } + + return false; +} + +bool VSTPlugin::SetParameter(int parameter, int value) +{ + return SetParameter(parameter,value/65535.0f); +} + +int VSTPlugin::GetCurrentProgram() +{ + if(instantiated) + return Dispatch(effGetProgram,0,0,NULL,0.0f); + else + return 0; +} + +void VSTPlugin::SetCurrentProgram(int prg) +{ + if(instantiated) + Dispatch(effSetProgram,0,prg,NULL,0.0f); +} + +bool VSTPlugin::AddMIDI(unsigned char data0,unsigned char data1,unsigned char data2) +{ + if (instantiated) + { + VstMidiEvent* pevent=&midievent[queue_size]; + + pevent->type = kVstMidiType; + pevent->byteSize = 24; + pevent->deltaFrames = 0; + pevent->flags = 0; + pevent->detune = 0; + pevent->noteLength = 0; + pevent->noteOffset = 0; + pevent->reserved1 = 0; + pevent->reserved2 = 0; + pevent->noteOffVelocity = 0; + pevent->midiData[0] = data0; + pevent->midiData[1] = data1; + pevent->midiData[2] = data2; + pevent->midiData[3] = 0; + + if ( queue_size < MAX_EVENTS ) queue_size++; + SendMidi(); + return true; + } + else return false; +} + + +void VSTPlugin::SendMidi() +{ + if(/*instantiated &&*/ queue_size>0) + { + // Prepare MIDI events and free queue dispatching all events + events.numEvents = queue_size; + events.reserved = 0; + for(int q=0;q<queue_size;q++) events.events[q] = (VstEvent*)&midievent[q]; + + Dispatch(effProcessEvents, 0, 0, &events, 0.0f); + queue_size=0; + } +} + + +void VSTPlugin::processReplacing( float **inputs, float **outputs, long sampleframes ) +{ + _pEffect->processReplacing( _pEffect , inputs , outputs , sampleframes ); + +} + +void VSTPlugin::process( float **inputs, float **outputs, long sampleframes ) +{ + _pEffect->process( _pEffect , inputs , outputs , 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(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); +#endif + + // Support opcodes + switch(opcode) + { + case audioMasterAutomate: + return 0; // index, value, returns 0 + + case audioMasterVersion: + return 2; // vst version, currently 7 (0 for older) + + case audioMasterCurrentId: + return 'AASH'; // returns the unique id of a plug that's currently loading + + case audioMasterIdle: + effect->dispatcher(effect, effEditIdle, 0, 0, NULL, 0.0f); + return 0; // call application idle routine (this will call effEditIdle for all open editors too) + + case audioMasterPinConnected: + if (value == 0) //input + { + if ( index < 2) return 0; + else return 1; + } + else //output + { + if ( index < 2) return 0; + else return 1; + } + return 0; // inquire if an input or output is beeing connected; + + case audioMasterWantMidi: + return 0; + + case audioMasterProcessEvents: + return 0; // Support of vst events to host is not available + + case audioMasterGetTime: + memset(&_timeInfo, 0, sizeof(_timeInfo)); + _timeInfo.samplePos = 0; + _timeInfo.sampleRate = sample_rate; + return (long)&_timeInfo; + + + case audioMasterTempoAt: + return 0; + + case audioMasterNeedIdle: +// effect->dispatcher(effect, effIdle, 0, 0, NULL, 0.0f); + return 1; + + case audioMasterGetSampleRate: + return sample_rate; + + case audioMasterGetVendorString: // Just fooling version string + strcpy((char*)ptr,"Steinberg"); + return 0; + + case audioMasterGetVendorVersion: + return 5000; // HOST version 5000 + + case audioMasterGetProductString: // Just fooling product string + strcpy((char*)ptr,"Cubase 5.0"); + return 0; + + case audioMasterVendorSpecific: + { + return 0; + } + + + case audioMasterGetLanguage: + return kVstLangEnglish; + + case audioMasterUpdateDisplay: +#ifdef FLEXT_DEBUG + post("audioMasterUpdateDisplay"); +#endif + effect->dispatcher(effect, effEditIdle, 0, 0, NULL, 0.0f); + return 0; + + case audioMasterCanDo: + if (!strcmp((char*)ptr,"sendVstEvents")) return 1; + if (!strcmp((char*)ptr,"sendVstMidiEvent")) return 1; + if (!strcmp((char*)ptr,"sendVstTimeInfo")) return 1; +// "receiveVstEvents", +// "receiveVstMidiEvent", +// "receiveVstTimeInfo", + +// "reportConnectionChanges", +// "acceptIOChanges", + if (!strcmp((char*)ptr,"sizeWindow")) return 1; + if (!strcmp((char*)ptr,"supplyIdle")) return 1; + return -1; + + case audioMasterSetTime: FLEXT_LOG("VST master dispatcher: Set Time");break; + case audioMasterGetNumAutomatableParameters: FLEXT_LOG("VST master dispatcher: GetNumAutPar");break; + case audioMasterGetParameterQuantization: FLEXT_LOG("VST master dispatcher: ParamQuant");break; + case audioMasterIOChanged: FLEXT_LOG("VST master dispatcher: IOchanged");break; + case audioMasterSizeWindow: FLEXT_LOG("VST master dispatcher: Size Window");break; + case audioMasterGetBlockSize: FLEXT_LOG("VST master dispatcher: GetBlockSize");break; + case audioMasterGetInputLatency: FLEXT_LOG("VST master dispatcher: GetInLatency");break; + case audioMasterGetOutputLatency: FLEXT_LOG("VST master dispatcher: GetOutLatency");break; + case audioMasterGetPreviousPlug: FLEXT_LOG("VST master dispatcher: PrevPlug");break; + case audioMasterGetNextPlug: FLEXT_LOG("VST master dispatcher: NextPlug");break; + case audioMasterWillReplaceOrAccumulate: FLEXT_LOG("VST master dispatcher: WillReplace"); break; + case audioMasterGetCurrentProcessLevel: return 0; break; + case audioMasterGetAutomationState: FLEXT_LOG("VST master dispatcher: GetAutState");break; + case audioMasterOfflineStart: FLEXT_LOG("VST master dispatcher: Offlinestart");break; + case audioMasterOfflineRead: FLEXT_LOG("VST master dispatcher: Offlineread");break; + case audioMasterOfflineWrite: FLEXT_LOG("VST master dispatcher: Offlinewrite");break; + case audioMasterOfflineGetCurrentPass: FLEXT_LOG("VST master dispatcher: OfflineGetcurrentpass");break; + case audioMasterOfflineGetCurrentMetaPass: FLEXT_LOG("VST master dispatcher: GetGetCurrentMetapass");break; + case audioMasterSetOutputSampleRate: FLEXT_LOG("VST master dispatcher: Setsamplerate");break; + case audioMasterGetSpeakerArrangement: FLEXT_LOG("VST master dispatcher: Getspeaker");break; + case audioMasterSetIcon: FLEXT_LOG("VST master dispatcher: seticon");break; + case audioMasterOpenWindow: FLEXT_LOG("VST master dispatcher: OpenWindow");break; + case audioMasterCloseWindow: FLEXT_LOG("VST master dispatcher: CloseWindow");break; + case audioMasterGetDirectory: FLEXT_LOG("VST master dispatcher: GetDirectory");break; +// case audioMasterUpdateDisplay: post("VST master dispatcher: audioMasterUpdateDisplay");break; + + default: post("VST master dispatcher: undefed: %d , %d",opcode , effKeysRequired ) ;break; + } + + return 0; +} + +bool VSTPlugin::AddNoteOn( unsigned char note,unsigned char speed,unsigned char midichannel) +{ + return AddMIDI((char)MIDI_NOTEON | midichannel,note,speed); +} + +bool VSTPlugin::AddNoteOff( unsigned char note,unsigned char midichannel) +{ + return AddMIDI((char)MIDI_NOTEOFF | midichannel,note,0); +} + + +bool VSTPlugin::replace() +{ + return overwrite; +} + + +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(); + } + } +} + +void VSTPlugin::visible(bool vis) +{ + if(instantiated && edited) b->Show(vis); +} + +void VSTPlugin::EditorIdle() +{ + Dispatch(effEditIdle,0,0, w,0.0f); +} + +RECT VSTPlugin::GetEditorRect() +{ + RECT ret; + ERect *r; + Dispatch(effEditGetRect,0,0, &r,0.0f); + ret.top = r->top; + ret.bottom = r->bottom; + ret.left = r->left; + ret.right = r->right; + return ret; +} + +void VSTPlugin::SetEditWindow(HWND h) +{ + w = h; + Dispatch(effEditOpen,0,0, w,0.0f); +} + +void VSTPlugin::OnEditorClose() +{ + Dispatch(effEditClose,0,0, w,0.0f); +} + +/* +void VSTPlugin::SetShowParameters(bool s) +{ + show_params = s; +} + +bool VSTPlugin::ShowParams() +{ + return show_params; +} +*/ + +void VSTPlugin::AddAftertouch(int value) +{ + if (value < 0) value = 0; else if (value > 127) value = 127; + AddMIDI( (char)MIDI_NOTEOFF | _midichannel , value ); +} + +void VSTPlugin::AddPitchBend(int value) +{ + AddMIDI( MIDI_PITCHBEND + (_midichannel & 0xf) , ((value>>7) & 127), (value & 127)); +} + +void VSTPlugin::AddProgramChange(int value) +{ + if (value < 0) value = 0; else if (value > 127) value = 127; + AddMIDI( MIDI_PROGRAMCHANGE + (_midichannel & 0xf), value, 0); +} + +void VSTPlugin::AddControlChange(int control, int value) +{ + if (control < 0) control = 0; else if (control > 127) control = 127; + if (value < 0) value = 0; else if (value > 127) value = 127; + AddMIDI( MIDI_CONTROLCHANGE + (_midichannel & 0xf), control, value); +} + + +bool VSTPlugin::GetProgramName( int cat , int p, char *buf) +{ + int parameter = p; + if(instantiated) + { + if(parameter<NumPrograms()) + { + Dispatch(effGetProgramNameIndexed,parameter,cat,buf,0.0f); + return true; + } + } + return false; +} + +int VSTPlugin::GetNumCategories() +{ + if(instantiated) + return Dispatch(effGetNumProgramCategories,0,0,NULL,0.0f); + 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 1ad9cede..8b272e97 100644 --- a/externals/grill/vst/src/VstHost.h +++ b/externals/grill/vst/src/VstHost.h @@ -149,7 +149,7 @@ protected: private: int posx,posy; - bool edited; + bool edited; //,wantidle; bool show_params; static float sample_rate; }; diff --git a/externals/grill/vst/src/main.cpp b/externals/grill/vst/src/main.cpp index 7854aa8f..328f318a 100644 --- a/externals/grill/vst/src/main.cpp +++ b/externals/grill/vst/src/main.cpp @@ -1,713 +1,716 @@ -/*
-
-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)
-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 "VstHost.h"
-
-#include <stdlib.h>
-#include <direct.h>
-#include <io.h>
-
-#define VST_VERSION "0.1.0pre5"
-
-#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()
-
-CVstApp::CVstApp() {}
-
-CVstApp theApp;
-
-/* ----- MFC stuff ------------- */
-#endif
-
-
-class vst:
- public flext_dsp
-{
- FLEXT_HEADER_S(vst,flext_dsp,Setup)
-
-public:
- vst(I argc,const A *argv);
- ~vst();
-
-protected:
- virtual V m_dsp(I n,t_signalvec const *insigs,t_signalvec const *outsigs);
- virtual V m_signal(I n,R *const *insigs,R *const *outsigs);
-
- 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 ms_edit(BL on);
- V mg_edit(BL &ed) { ed = plug && plug->Edited(); }
- V mg_editor(BL &ed) { ed = plug && plug->HasEditor(); }
- V ms_vis(BL vis);
-
- V mg_winx(I &x) const { x = plug?plug->getX():0; }
- V mg_winy(I &y) const { y = plug?plug->getY():0; }
- V ms_winx(I x) { if(plug) plug->setX(x); }
- V ms_winy(I y) { if(plug) plug->setY(y); }
-
- V mg_chnsin(I &c) const { c = plug?plug->getNumInputs():0; }
- V mg_chnsout(I &c) const { c = plug?plug->getNumOutputs():0; }
- V mg_params(I &p) const { p = plug?plug->GetNumParams():0; }
- V mg_programs(I &p) const { p = plug?plug->NumPrograms():0; }
- V mg_plugname(const S *&s) const { s = MakeSymbol(plug?plug->GetName():""); }
- V mg_plugvendor(const S *&s) const { s = MakeSymbol(plug?plug->GetVendorName():""); }
- V mg_plugdll(const S *&s) const { s = MakeSymbol(plug?plug->GetDllName():""); }
- V mg_plugversion(I &v) const { v = plug?plug->GetVersion():0; }
- V mg_issynth(BL &s) const { s = plug && plug->IsSynth(); }
-
- V m_print(I ac,const A *av);
-
- V ms_program(I p);
- V mg_program(I &p) const { p = plug?plug->GetCurrentProgram():0; }
-
-// V m_control(const S *ctrl_name,I ctrl_value);
- V m_pitchbend(I ctrl_value);
- V m_programchange(I ctrl_value);
- V m_aftertouch(I ctrl_value);
- V m_ctrlchange(I control,I ctrl_value);
- V m_note(I note,I vel);
- inline V m_noteoff(I note) { m_note(note,0); }
-
- V ms_param(I pnum,F val);
- V mg_param(I pnum);
- V m_pname(I pnum);
- V m_ptext(I pnum);
-
-private:
- V display_parameter(I param,BL showparams);
-
- VSTPlugin *plug;
- CString plugname;
- BL echoparam,visible;
-
- I blsz;
- V (VSTPlugin::*vstfun)(R **insigs,R **outsigs,L n);
- BL sigmatch;
- R **vstin,**vstout,**tmpin,**tmpout;
-
- V InitPlug();
- V ClearPlug();
- V InitBuf();
- V ClearBuf();
- static V Setup(t_classid);
-
-
- FLEXT_CALLBACK_V(m_print)
-
- FLEXT_CALLVAR_V(mg_plug,ms_plug)
-
- FLEXT_CALLVAR_B(mg_edit,ms_edit)
- FLEXT_CALLGET_B(mg_editor)
- FLEXT_CALLSET_B(ms_vis)
- FLEXT_ATTRGET_B(visible)
-
-// FLEXT_CALLBACK_2(m_control,t_symptr,int)
- FLEXT_CALLBACK_I(m_pitchbend)
- FLEXT_CALLBACK_I(m_aftertouch)
- FLEXT_CALLBACK_I(m_programchange)
- FLEXT_CALLBACK_II(m_ctrlchange)
-
- FLEXT_CALLVAR_I(mg_program,ms_program)
- FLEXT_CALLBACK_2(ms_param,int,float)
- FLEXT_CALLBACK_I(mg_param)
- FLEXT_CALLBACK_I(m_pname)
- FLEXT_CALLBACK_I(m_ptext)
-
- FLEXT_CALLBACK_II(m_note)
- FLEXT_CALLBACK_I(m_noteoff)
-
- FLEXT_ATTRVAR_B(echoparam)
- FLEXT_CALLVAR_I(mg_winx,ms_winx)
- FLEXT_CALLVAR_I(mg_winy,ms_winy)
-
- FLEXT_CALLGET_I(mg_chnsin)
- FLEXT_CALLGET_I(mg_chnsout)
- FLEXT_CALLGET_I(mg_params)
- FLEXT_CALLGET_I(mg_programs)
- FLEXT_CALLGET_S(mg_plugname)
- FLEXT_CALLGET_S(mg_plugvendor)
- FLEXT_CALLGET_S(mg_plugdll)
- FLEXT_CALLGET_I(mg_plugversion)
- FLEXT_CALLGET_B(mg_issynth)
-};
-
-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("based on the work of Jarno Seppänen and Mark Williamson");
- post("");
-
- FLEXT_CADDATTR_VAR(c,"plug",mg_plug,ms_plug);
- FLEXT_CADDATTR_VAR(c,"edit",mg_edit,ms_edit);
- FLEXT_CADDATTR_GET(c,"editor",mg_editor);
- FLEXT_CADDATTR_VAR(c,"vis",visible,ms_vis);
- FLEXT_CADDMETHOD_(c,0,"print",m_print);
-
- FLEXT_CADDMETHOD_II(c,0,"note",m_note);
- FLEXT_CADDMETHOD_I(c,0,"noteoff",m_noteoff);
-// FLEXT_CADDMETHOD_2(c,0,"control",m_control,t_symptr,int);
- FLEXT_CADDMETHOD_(c,0,"pbend",m_pitchbend);
- FLEXT_CADDMETHOD_(c,0,"atouch",m_aftertouch);
- FLEXT_CADDMETHOD_II(c,0,"ctlchg",m_ctrlchange);
-
- FLEXT_CADDMETHOD_(c,0,"progchg",m_programchange);
- FLEXT_CADDATTR_VAR(c,"program",mg_program,ms_program);
-
- FLEXT_CADDMETHOD_2(c,0,"param",ms_param,int,float);
- FLEXT_CADDMETHOD_(c,0,"getparam",mg_param);
- FLEXT_CADDMETHOD_I(c,0,"getpname",m_pname);
- FLEXT_CADDMETHOD_I(c,0,"getptext",m_ptext);
-
- FLEXT_CADDATTR_VAR1(c,"echo",echoparam);
- FLEXT_CADDATTR_VAR(c,"x",mg_winx,ms_winx);
- FLEXT_CADDATTR_VAR(c,"y",mg_winy,ms_winy);
-
- FLEXT_CADDATTR_GET(c,"ins",mg_chnsin);
- FLEXT_CADDATTR_GET(c,"outs",mg_chnsout);
- FLEXT_CADDATTR_GET(c,"params",mg_params);
- FLEXT_CADDATTR_GET(c,"programs",mg_programs);
- FLEXT_CADDATTR_GET(c,"name",mg_plugname);
- FLEXT_CADDATTR_GET(c,"vendor",mg_plugvendor);
- FLEXT_CADDATTR_GET(c,"dll",mg_plugdll);
- FLEXT_CADDATTR_GET(c,"version",mg_plugversion);
- FLEXT_CADDATTR_GET(c,"synth",mg_issynth);
-}
-
-
-vst::vst(I argc,const A *argv):
- plug(NULL),visible(false),
- blsz(0),
- vstfun(NULL),vstin(NULL),vstout(NULL),tmpin(NULL),tmpout(NULL),
- echoparam(false)
-{
- if(argc >= 2 && CanbeInt(argv[0]) && CanbeInt(argv[1])) {
- AddInSignal(GetAInt(argv[0]));
- AddOutSignal(GetAInt(argv[1]));
-
- if(!ms_plug(argc-2,argv+2)) InitProblem();
- }
- else {
- post("%s - syntax: vst~ inputs outputs [plug]",thisName());
- InitProblem();
- }
-}
-
-vst::~vst()
-{
- ClearPlug();
-}
-
-V vst::ClearPlug()
-{
- if(plug) {
- ClearBuf();
- delete plug; plug = NULL;
- }
-}
-
-V vst::InitPlug()
-{
- FLEXT_ASSERT(plug);
-
- vstfun = plug->replace()?plug->processReplacing:plug->process;
- sigmatch = plug->getNumInputs() == CntInSig() && plug->getNumOutputs() == CntOutSig();
-
- InitBuf();
-}
-
-V vst::ClearBuf()
-{
- if(!plug) return;
-
- if(vstin) {
- for(I i = 0; i < plug->getNumInputs(); ++i) delete[] vstin[i];
- delete[] vstin; vstin = NULL;
- delete[] tmpin; tmpin = NULL;
- }
- if(vstout) {
- for(I i = 0; i < plug->getNumOutputs(); ++i) delete[] vstout[i];
- delete[] vstout; vstout = NULL;
- delete[] tmpout; tmpout = NULL;
- }
-}
-
-V vst::InitBuf()
-{
- FLEXT_ASSERT(!vstin && !tmpin && !vstout && !tmpout);
-
- I i;
-
- vstin = new R *[plug->getNumInputs()];
- tmpin = new R *[plug->getNumInputs()];
- for(i = 0; i < plug->getNumInputs(); ++i) vstin[i] = new R[Blocksize()];
-
- vstout = new R *[plug->getNumOutputs()];
- tmpout = new R *[plug->getNumOutputs()];
- for(i = 0; i < plug->getNumOutputs(); ++i) vstout[i] = new R[Blocksize()];
-}
-
-static const C *findFilePath(const C *path,const C *dllname)
-{
- CFileFind finder;
- _chdir( path );
-
- if(finder.FindFile( dllname ))
- return path;
- else {
- finder.FindFile();
- while(finder.FindNextFile()) {
- if(finder.IsDirectory()) {
- if(!finder.IsDots()) {
- CString *npath = new CString( finder.GetFilePath());
- const C *ret = findFilePath( *npath , dllname );
- if(ret) {
- CString *retstr = new CString(ret);
- return *retstr;
- }
- }
- }
- }
- }
- return NULL;
-}
-
-
-BL vst::ms_plug(I argc,const A *argv)
-{
- ClearPlug();
-
- plugname.Empty();
- C buf[255];
- for(I i = 0; i < argc; i++) {
- if(i > 0) plugname += ' ';
- GetAString(argv[i],buf,sizeof buf);
- plugname += buf;
- }
- plugname.MakeLower();
- if(!plugname.GetLength()) return false;
-
- plug = new VSTPlugin;
-
- // now try to load plugin
-
- // to help deal with spaces we assume ALL of the args make
- // up the filename
- bool lf = false;
- int loaderr = VSTINSTANCE_NO_ERROR;
-
- // try loading the dll from the raw filename
- if ((loaderr = plug->Instance(plugname)) == 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);
- if(fd > 0) close(fd);
- else name = NULL;
-
- if(name) {
- FLEXT_LOG("found VST dll on the PD path");
- // if dir is current working directory... name points to dir
- if(dir == name) strcpy(dir,".");
-
- CString dllname(dir);
- dllname += "\\";
- dllname += name;
-
- lf = (loaderr = plug->Instance(dllname)) == 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";
-
- if(vst_path) {
- FLEXT_LOG("found VST_PATH env variable");
- char* tok_path = new C[strlen( vst_path)+1];
- strcpy( tok_path , vst_path);
- char *tok = strtok( tok_path , ";" );
- while( tok != NULL ) {
- CString abpath( tok );
- if( abpath.Right( 1 ) != _T("\\") ) abpath += "\\";
-
- FLEXT_LOG1("trying VST_PATH %s",(const C *)abpath);
-
- const char * 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 ) {
- FLEXT_LOG("plugin loaded via VST_PATH");
- lf = true;
- break;
- }
- }
-
- tok = strtok( NULL , ";" );
- if(!tok) post("%s - couldn't find plugin",thisName());
- }
-
- delete[] tok_path;
- }
- }
-
- if(!lf) { // failed - don't make any ins or outs
- post("%s - unable to load plugin '%s', load error %i",thisName(),plugname,loaderr);
- ClearPlug();
- }
-
- // re-init dsp stuff
- if(plug) InitPlug();
-
- return lf;
-}
-
-V vst::m_dsp(I n,t_signalvec const *,t_signalvec const *)
-{
- if(plug) {
- plug->Init(Samplerate(),(F)Blocksize());
- FLEXT_ASSERT(vstfun);
-
- if(blsz != Blocksize()) {
- blsz = Blocksize();
- ClearBuf();
- InitBuf();
- }
- }
-}
-
-V vst::m_signal(I n,R *const *insigs,R *const *outsigs)
-{
- if(plug) {
- if(sigmatch)
- (plug->*vstfun)(const_cast<R **>(insigs),const_cast<R **>(outsigs),n);
- else {
- R **inv,**outv;
-
- if(plug->getNumInputs() <= CntInSig())
- inv = const_cast<R **>(insigs);
- else { // more plug inputs than inlets
- I i;
- for(i = 0; i < CntInSig(); ++i) tmpin[i] = const_cast<R *>(insigs[i]);
-
- // set dangling inputs to zero
- // according to mode... (e.g. set zero)
- for(; i < plug->getNumInputs(); ++i) ZeroSamples(tmpin[i] = vstin[i],n);
-
- inv = tmpin;
- }
-
- const BL more = plug->getNumOutputs() <= CntOutSig();
- if(more) // more outlets than plug outputs
- outv = const_cast<R **>(outsigs);
- else {
- I i;
- for(i = 0; i < CntOutSig(); ++i) tmpout[i] = outsigs[i];
- for(; i < plug->getNumOutputs(); ++i) tmpout[i] = vstout[i];
-
- outv = tmpout;
- }
-
- (plug->*vstfun)(inv,outv,n);
-
- if(more) {
- // according to mode set dangling output vectors
- }
- }
- }
- else
- flext_dsp::m_signal(n,insigs,outsigs);
-}
-
-
-#if 0
-
-V vst::m_control(const S *ctrl_name,I ctrl_value)
-{
- if(!plug) return;
-
- I parm_num = 0;
-
- if (!*GetString(ctrl_name) || !strlen(GetString(ctrl_name))) {
- error ("plugin~: control messages must have a name and a value");
- return;
- }
- //parm_num = vst_tilde_get_parm_number (x, ctrl_name->s_name);
- //if (parm_num)
- //{
- //vst_tilde_set_control_input_by_index (x, parm_num - 1, ctrl_value);
- //}
- //else
- //{
- //vst_tilde_set_control_input_by_name (x, ctrl_name->s_name, ctrl_value);
- //}
-}
-
-#endif
-
-V vst::m_pitchbend(I ctrl_value)
-{
- if(plug) plug->AddPitchBend(ctrl_value );
-}
-
-V vst::m_aftertouch(I ctrl_value)
-{
- if(plug) plug->AddAftertouch(ctrl_value );
-}
-
-V vst::m_programchange(I ctrl_value)
-{
- if(plug) plug->AddProgramChange(ctrl_value );
-}
-
-V vst::ms_program(I p)
-{
- if(plug && p >= 0) plug->SetCurrentProgram(p);
-}
-
-V vst::m_ctrlchange(I control,I ctrl_value)
-{
- if(plug) plug->AddControlChange(control,ctrl_value );
-}
-
-
- /**
- * display the parameters names and values and some other bits and pieces that
- * may be of use
- */
-
-V vst::m_print(I ac,const A *av)
-{
- if(!plug) return;
-
- int i;
- bool params = false;
- bool header = true;
- bool programs = false;
- bool parameters = true;
- int specific = -1;
- if( ac > 0 ) {
- for( i = 0 ; i < ac ; i++) {
- if(IsString(av[i])) {
- const C *buf = GetString(av[i]);
- if ( strcmp( buf , "-params" ) == 0 ) {
- params = true;
- }
- else if ( strcmp( buf , "-noheader" ) == 0 ) {
- header = false;
- }
- else if ( strcmp( buf , "-programs" ) == 0 ) {
- programs = true;
- parameters = false;
- }
- else if ( strcmp( buf , "-parameters" ) == 0 ) {
- parameters = false;
- }
- else if ( strcmp( buf , "-help" ) == 0 ) {
- post("print options:");
- post("-help \t\tprint this");
- post("-programs \tshow the programs");
- post("-parameters \tshow the parameters");
- post("-params \tshow the parameter display values");
- post("-noheader \tdo not display the header");
- return;
- }
- }
- else if(CanbeInt(av[i])) {
- int p = GetAInt(av[i]);
- if (( p > 0 ) && ( p <= plug->GetNumParams())) {
- specific = p - 1;
- }
- }
- }
- }
-
- if ( header ) {
- post("VST~ plugin: %s " , plug->GetName() );
- post("made by: %s " , plug->GetVendorName() );
- post("parameterss %d\naudio: %d in(s)/%d out(s) \nLoaded from library \"%s\".\n",
- plug->GetNumParams(),
- CntInSig(),
- CntOutSig(),
- plug->GetDllName());
-
- post("Flags");
- if ( plug->_pEffect->flags & effFlagsHasEditor ) {
- post("Has editor");
- }
- if ( plug->_pEffect->flags & effFlagsCanReplacing ) {
- post("Can do replacing");
- }
- }
-
- if ( parameters ) {
- if ( specific == -1) {
- for (i = 0; i < plug->GetNumParams(); i++)
- display_parameter( i , params );
- }
- else
- display_parameter( specific , params);
- }
-
- if( programs ) {
- for( int j = 0; j < plug->GetNumCategories() ; j++ ) {
- for( i = 0 ; i < plug->GetNumParams() ; i++ ) {
- char buf[64];
- plug->GetProgramName( j , i , buf );
- post("Program %d: %s ", i , buf );
- }
- }
- }
-}
-
-
-//! 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;
- /* the Steinberg(tm) way... */
- char name[109];
- char display[164];
- float val;
-
-// if(j == 0) post ("Control input/output(s):");
-
- memset (name, 0, sizeof(name));
- memset( display, 0 ,sizeof(display));
- plug->GetParamName( j , name );
-
- if(*name) {
- if (showparams) {
- plug->DescribeValue( j , display );
- val = plug->GetParamValue( j );
- post ("parameter[#%d], \"%s\" value=%f (%s) ", j, name, val,display);
- }
- else {
- val = plug->GetParamValue( j );
- post ("parameter[#%d], \"%s\" value=%f ", j, name, val);
- }
- }
-}
-
-
-// set the value of a parameter
-V vst::ms_param(I pnum,F val)
-{
- if(!plug || pnum < 0 || pnum >= plug->GetNumParams()) return;
-
- F xval = plug->GetParamValue( pnum );
-// if(xval <= 1.0f) // What's that????
- if(true)
- {
- plug->SetParameter( pnum, val );
- if(echoparam) display_parameter(pnum , true );
- }
- else
- FLEXT_ASSERT(false);
-}
-
-V vst::mg_param(I pnum)
-{
- if(!plug || pnum < 0 || pnum >= plug->GetNumParams()) return;
-
- A at[2];
- SetInt(at[0],pnum);
- SetFloat(at[1],plug->GetParamValue(pnum));
- ToOutAnything(GetOutAttr(),MakeSymbol("param"),2,at);
-}
-
-V vst::m_pname(I pnum)
-{
- if(!plug || pnum < 0 || pnum >= plug->GetNumParams()) return;
-
- C name[109]; /* the Steinberg(tm) way... */
-
- memset(name,0,sizeof(name));
- plug->GetParamName(pnum,name);
-
- A at[2];
- SetInt(at[0],pnum);
- SetString(at[1],name);
- ToOutAnything(GetOutAttr(),MakeSymbol("pname"),2,at);
-}
-
-V vst::m_ptext(I pnum)
-{
- if(!plug || pnum < 0 || pnum >= plug->GetNumParams()) return;
-
- C display[164]; /* the Steinberg(tm) way... */
-
- memset(display,0,sizeof(display));
- plug->DescribeValue(pnum,display);
-
- A at[2];
- SetInt(at[0],pnum);
- SetString(at[1],display);
- ToOutAnything(GetOutAttr(),MakeSymbol("ptext"),2,at);
-}
-
-V vst::m_note(I note,I velocity)
-{
- if(!plug) return;
-
- if(velocity > 0)
- plug->AddNoteOn(note,velocity);
- else
- plug->AddNoteOff(note);
-}
+/* + +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) +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 "VstHost.h" + +#include <stdlib.h> +#include <direct.h> +#include <io.h> + +#define VST_VERSION "0.1.0pre5" + +#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() + +CVstApp::CVstApp() {} + +CVstApp theApp; + +/* ----- MFC stuff ------------- */ +#endif + + +class vst: + public flext_dsp +{ + FLEXT_HEADER_S(vst,flext_dsp,Setup) + +public: + vst(I argc,const A *argv); + ~vst(); + +protected: + virtual V m_dsp(I n,t_signalvec const *insigs,t_signalvec const *outsigs); + virtual V m_signal(I n,R *const *insigs,R *const *outsigs); + + 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 ms_edit(BL on); + V mg_edit(BL &ed) { ed = plug && plug->Edited(); } + V mg_editor(BL &ed) { ed = plug && plug->HasEditor(); } + V ms_vis(BL vis); + + V mg_winx(I &x) const { x = plug?plug->getX():0; } + V mg_winy(I &y) const { y = plug?plug->getY():0; } + V ms_winx(I x) { if(plug) plug->setX(x); } + V ms_winy(I y) { if(plug) plug->setY(y); } + + V mg_chnsin(I &c) const { c = plug?plug->getNumInputs():0; } + V mg_chnsout(I &c) const { c = plug?plug->getNumOutputs():0; } + V mg_params(I &p) const { p = plug?plug->GetNumParams():0; } + V mg_programs(I &p) const { p = plug?plug->NumPrograms():0; } + V mg_progcats(I &p) const { p = plug?plug->GetNumCategories():0; } + V mg_plugname(const S *&s) const { s = MakeSymbol(plug?plug->GetName():""); } + V mg_plugvendor(const S *&s) const { s = MakeSymbol(plug?plug->GetVendorName():""); } + V mg_plugdll(const S *&s) const { s = MakeSymbol(plug?plug->GetDllName():""); } + V mg_plugversion(I &v) const { v = plug?plug->GetVersion():0; } + V mg_issynth(BL &s) const { s = plug && plug->IsSynth(); } + + V m_print(I ac,const A *av); + + V ms_program(I p); + V mg_program(I &p) const { p = plug?plug->GetCurrentProgram():0; } + +// V m_control(const S *ctrl_name,I ctrl_value); + V m_pitchbend(I ctrl_value); + V m_programchange(I ctrl_value); + V m_aftertouch(I ctrl_value); + V m_ctrlchange(I control,I ctrl_value); + V m_note(I note,I vel); + inline V m_noteoff(I note) { m_note(note,0); } + + V ms_param(I pnum,F val); + V mg_param(I pnum); + V m_pname(I pnum); + V m_ptext(I pnum); + +private: + V display_parameter(I param,BL showparams); + + VSTPlugin *plug; + CString plugname; + BL echoparam,visible; + + I blsz; + V (VSTPlugin::*vstfun)(R **insigs,R **outsigs,L n); + BL sigmatch; + R **vstin,**vstout,**tmpin,**tmpout; + + V InitPlug(); + V ClearPlug(); + V InitBuf(); + V ClearBuf(); + static V Setup(t_classid); + + + FLEXT_CALLBACK_V(m_print) + + FLEXT_CALLVAR_V(mg_plug,ms_plug) + + FLEXT_CALLVAR_B(mg_edit,ms_edit) + FLEXT_CALLGET_B(mg_editor) + FLEXT_CALLSET_B(ms_vis) + FLEXT_ATTRGET_B(visible) + +// FLEXT_CALLBACK_2(m_control,t_symptr,int) + FLEXT_CALLBACK_I(m_pitchbend) + FLEXT_CALLBACK_I(m_aftertouch) + FLEXT_CALLBACK_I(m_programchange) + FLEXT_CALLBACK_II(m_ctrlchange) + + FLEXT_CALLVAR_I(mg_program,ms_program) + FLEXT_CALLBACK_2(ms_param,int,float) + FLEXT_CALLBACK_I(mg_param) + FLEXT_CALLBACK_I(m_pname) + FLEXT_CALLBACK_I(m_ptext) + + FLEXT_CALLBACK_II(m_note) + FLEXT_CALLBACK_I(m_noteoff) + + FLEXT_ATTRVAR_B(echoparam) + FLEXT_CALLVAR_I(mg_winx,ms_winx) + FLEXT_CALLVAR_I(mg_winy,ms_winy) + + FLEXT_CALLGET_I(mg_chnsin) + FLEXT_CALLGET_I(mg_chnsout) + FLEXT_CALLGET_I(mg_params) + FLEXT_CALLGET_I(mg_programs) + FLEXT_CALLGET_I(mg_progcats) + FLEXT_CALLGET_S(mg_plugname) + FLEXT_CALLGET_S(mg_plugvendor) + FLEXT_CALLGET_S(mg_plugdll) + FLEXT_CALLGET_I(mg_plugversion) + FLEXT_CALLGET_B(mg_issynth) +}; + +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("based on the work of Jarno Seppänen and Mark Williamson"); + post(""); + + FLEXT_CADDATTR_VAR(c,"plug",mg_plug,ms_plug); + FLEXT_CADDATTR_VAR(c,"edit",mg_edit,ms_edit); + FLEXT_CADDATTR_GET(c,"editor",mg_editor); + FLEXT_CADDATTR_VAR(c,"vis",visible,ms_vis); + FLEXT_CADDMETHOD_(c,0,"print",m_print); + + FLEXT_CADDMETHOD_II(c,0,"note",m_note); + FLEXT_CADDMETHOD_I(c,0,"noteoff",m_noteoff); +// FLEXT_CADDMETHOD_2(c,0,"control",m_control,t_symptr,int); + FLEXT_CADDMETHOD_(c,0,"pbend",m_pitchbend); + FLEXT_CADDMETHOD_(c,0,"atouch",m_aftertouch); + FLEXT_CADDMETHOD_II(c,0,"ctlchg",m_ctrlchange); + + FLEXT_CADDMETHOD_(c,0,"progchg",m_programchange); + FLEXT_CADDATTR_VAR(c,"program",mg_program,ms_program); + + FLEXT_CADDMETHOD_2(c,0,"param",ms_param,int,float); + FLEXT_CADDMETHOD_(c,0,"getparam",mg_param); + FLEXT_CADDMETHOD_I(c,0,"getpname",m_pname); + FLEXT_CADDMETHOD_I(c,0,"getptext",m_ptext); + + FLEXT_CADDATTR_VAR1(c,"echo",echoparam); + FLEXT_CADDATTR_VAR(c,"x",mg_winx,ms_winx); + FLEXT_CADDATTR_VAR(c,"y",mg_winy,ms_winy); + + FLEXT_CADDATTR_GET(c,"ins",mg_chnsin); + FLEXT_CADDATTR_GET(c,"outs",mg_chnsout); + FLEXT_CADDATTR_GET(c,"params",mg_params); + FLEXT_CADDATTR_GET(c,"programs",mg_programs); + FLEXT_CADDATTR_GET(c,"progcats",mg_progcats); + FLEXT_CADDATTR_GET(c,"name",mg_plugname); + FLEXT_CADDATTR_GET(c,"vendor",mg_plugvendor); + FLEXT_CADDATTR_GET(c,"dll",mg_plugdll); + FLEXT_CADDATTR_GET(c,"version",mg_plugversion); + FLEXT_CADDATTR_GET(c,"synth",mg_issynth); +} + + +vst::vst(I argc,const A *argv): + plug(NULL),visible(false), + blsz(0), + vstfun(NULL),vstin(NULL),vstout(NULL),tmpin(NULL),tmpout(NULL), + echoparam(false) +{ + if(argc >= 2 && CanbeInt(argv[0]) && CanbeInt(argv[1])) { + AddInSignal(GetAInt(argv[0])); + AddOutSignal(GetAInt(argv[1])); + + if(!ms_plug(argc-2,argv+2)) InitProblem(); + } + else { + post("%s - syntax: vst~ inputs outputs [plug]",thisName()); + InitProblem(); + } +} + +vst::~vst() +{ + ClearPlug(); +} + +V vst::ClearPlug() +{ + if(plug) { + ClearBuf(); + delete plug; plug = NULL; + } +} + +V vst::InitPlug() +{ + FLEXT_ASSERT(plug); + + vstfun = plug->replace()?plug->processReplacing:plug->process; + sigmatch = plug->getNumInputs() == CntInSig() && plug->getNumOutputs() == CntOutSig(); + + InitBuf(); +} + +V vst::ClearBuf() +{ + if(!plug) return; + + if(vstin) { + for(I i = 0; i < plug->getNumInputs(); ++i) delete[] vstin[i]; + delete[] vstin; vstin = NULL; + delete[] tmpin; tmpin = NULL; + } + if(vstout) { + for(I i = 0; i < plug->getNumOutputs(); ++i) delete[] vstout[i]; + delete[] vstout; vstout = NULL; + delete[] tmpout; tmpout = NULL; + } +} + +V vst::InitBuf() +{ + FLEXT_ASSERT(!vstin && !tmpin && !vstout && !tmpout); + + I i; + + vstin = new R *[plug->getNumInputs()]; + tmpin = new R *[plug->getNumInputs()]; + for(i = 0; i < plug->getNumInputs(); ++i) vstin[i] = new R[Blocksize()]; + + vstout = new R *[plug->getNumOutputs()]; + tmpout = new R *[plug->getNumOutputs()]; + for(i = 0; i < plug->getNumOutputs(); ++i) vstout[i] = new R[Blocksize()]; +} + +static const C *findFilePath(const C *path,const C *dllname) +{ + CFileFind finder; + _chdir( path ); + + if(finder.FindFile( dllname )) + return path; + else { + finder.FindFile(); + while(finder.FindNextFile()) { + if(finder.IsDirectory()) { + if(!finder.IsDots()) { + CString *npath = new CString( finder.GetFilePath()); + const C *ret = findFilePath( *npath , dllname ); + if(ret) { + CString *retstr = new CString(ret); + return *retstr; + } + } + } + } + } + return NULL; +} + + +BL vst::ms_plug(I argc,const A *argv) +{ + ClearPlug(); + + plugname.Empty(); + C buf[255]; + for(I i = 0; i < argc; i++) { + if(i > 0) plugname += ' '; + GetAString(argv[i],buf,sizeof buf); + plugname += buf; + } + plugname.MakeLower(); + if(!plugname.GetLength()) return false; + + plug = new VSTPlugin; + + // now try to load plugin + + // to help deal with spaces we assume ALL of the args make + // up the filename + bool lf = false; + int loaderr = VSTINSTANCE_NO_ERROR; + + // try loading the dll from the raw filename + if ((loaderr = plug->Instance(plugname)) == 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); + if(fd > 0) close(fd); + else name = NULL; + + if(name) { + FLEXT_LOG("found VST dll on the PD path"); + // if dir is current working directory... name points to dir + if(dir == name) strcpy(dir,"."); + + CString dllname(dir); + dllname += "\\"; + dllname += name; + + lf = (loaderr = plug->Instance(dllname)) == 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"; + + if(vst_path) { + FLEXT_LOG("found VST_PATH env variable"); + char* tok_path = new C[strlen( vst_path)+1]; + strcpy( tok_path , vst_path); + char *tok = strtok( tok_path , ";" ); + while( tok != NULL ) { + CString abpath( tok ); + if( abpath.Right( 1 ) != _T("\\") ) abpath += "\\"; + + FLEXT_LOG1("trying VST_PATH %s",(const C *)abpath); + + const char * 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 ) { + FLEXT_LOG("plugin loaded via VST_PATH"); + lf = true; + break; + } + } + + tok = strtok( NULL , ";" ); + if(!tok) post("%s - couldn't find plugin",thisName()); + } + + delete[] tok_path; + } + } + + if(!lf) { // failed - don't make any ins or outs + post("%s - unable to load plugin '%s', load error %i",thisName(),plugname,loaderr); + ClearPlug(); + } + + // re-init dsp stuff + if(plug) InitPlug(); + + return lf; +} + +V vst::m_dsp(I n,t_signalvec const *,t_signalvec const *) +{ + if(plug) { + plug->Init(Samplerate(),(F)Blocksize()); + FLEXT_ASSERT(vstfun); + + if(blsz != Blocksize()) { + blsz = Blocksize(); + ClearBuf(); + InitBuf(); + } + } +} + +V vst::m_signal(I n,R *const *insigs,R *const *outsigs) +{ + if(plug) { + if(sigmatch) + (plug->*vstfun)(const_cast<R **>(insigs),const_cast<R **>(outsigs),n); + else { + R **inv,**outv; + + if(plug->getNumInputs() <= CntInSig()) + inv = const_cast<R **>(insigs); + else { // more plug inputs than inlets + I i; + for(i = 0; i < CntInSig(); ++i) tmpin[i] = const_cast<R *>(insigs[i]); + + // set dangling inputs to zero + // according to mode... (e.g. set zero) + for(; i < plug->getNumInputs(); ++i) ZeroSamples(tmpin[i] = vstin[i],n); + + inv = tmpin; + } + + const BL more = plug->getNumOutputs() <= CntOutSig(); + if(more) // more outlets than plug outputs + outv = const_cast<R **>(outsigs); + else { + I i; + for(i = 0; i < CntOutSig(); ++i) tmpout[i] = outsigs[i]; + for(; i < plug->getNumOutputs(); ++i) tmpout[i] = vstout[i]; + + outv = tmpout; + } + + (plug->*vstfun)(inv,outv,n); + + if(more) { + // according to mode set dangling output vectors + } + } + } + else + flext_dsp::m_signal(n,insigs,outsigs); +} + + +#if 0 + +V vst::m_control(const S *ctrl_name,I ctrl_value) +{ + if(!plug) return; + + I parm_num = 0; + + if (!*GetString(ctrl_name) || !strlen(GetString(ctrl_name))) { + error ("plugin~: control messages must have a name and a value"); + return; + } + //parm_num = vst_tilde_get_parm_number (x, ctrl_name->s_name); + //if (parm_num) + //{ + //vst_tilde_set_control_input_by_index (x, parm_num - 1, ctrl_value); + //} + //else + //{ + //vst_tilde_set_control_input_by_name (x, ctrl_name->s_name, ctrl_value); + //} +} + +#endif + +V vst::m_pitchbend(I ctrl_value) +{ + if(plug) plug->AddPitchBend(ctrl_value ); +} + +V vst::m_aftertouch(I ctrl_value) +{ + if(plug) plug->AddAftertouch(ctrl_value ); +} + +V vst::m_programchange(I ctrl_value) +{ + if(plug) plug->AddProgramChange(ctrl_value ); +} + +V vst::ms_program(I p) +{ + if(plug && p >= 0) plug->SetCurrentProgram(p); +} + +V vst::m_ctrlchange(I control,I ctrl_value) +{ + if(plug) plug->AddControlChange(control,ctrl_value ); +} + + + /** + * display the parameters names and values and some other bits and pieces that + * may be of use + */ + +V vst::m_print(I ac,const A *av) +{ + if(!plug) return; + + int i; + bool params = false; + bool header = true; + bool programs = false; + bool parameters = true; + int specific = -1; + if( ac > 0 ) { + for( i = 0 ; i < ac ; i++) { + if(IsString(av[i])) { + const C *buf = GetString(av[i]); + if ( strcmp( buf , "-params" ) == 0 ) { + params = true; + } + else if ( strcmp( buf , "-noheader" ) == 0 ) { + header = false; + } + else if ( strcmp( buf , "-programs" ) == 0 ) { + programs = true; + parameters = false; + } + else if ( strcmp( buf , "-parameters" ) == 0 ) { + parameters = false; + } + else if ( strcmp( buf , "-help" ) == 0 ) { + post("print options:"); + post("-help \t\tprint this"); + post("-programs \tshow the programs"); + post("-parameters \tshow the parameters"); + post("-params \tshow the parameter display values"); + post("-noheader \tdo not display the header"); + return; + } + } + else if(CanbeInt(av[i])) { + int p = GetAInt(av[i]); + if (( p > 0 ) && ( p <= plug->GetNumParams())) { + specific = p - 1; + } + } + } + } + + if ( header ) { + post("VST~ plugin: %s " , plug->GetName() ); + post("made by: %s " , plug->GetVendorName() ); + post("parameterss %d\naudio: %d in(s)/%d out(s) \nLoaded from library \"%s\".\n", + plug->GetNumParams(), + CntInSig(), + CntOutSig(), + plug->GetDllName()); + + post("Flags"); + if ( plug->_pEffect->flags & effFlagsHasEditor ) { + post("Has editor"); + } + if ( plug->_pEffect->flags & effFlagsCanReplacing ) { + post("Can do replacing"); + } + } + + if ( parameters ) { + if ( specific == -1) { + for (i = 0; i < plug->GetNumParams(); i++) + display_parameter( i , params ); + } + else + display_parameter( specific , params); + } + + if( programs ) { + for( int j = 0; j < plug->GetNumCategories() ; j++ ) { + for( i = 0 ; i < plug->GetNumParams() ; i++ ) { + char buf[64]; + plug->GetProgramName( j , i , buf ); + post("Program %d: %s ", i , buf ); + } + } + } +} + + +//! 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; + /* the Steinberg(tm) way... */ + char name[109]; + char display[164]; + float val; + +// if(j == 0) post ("Control input/output(s):"); + + memset (name, 0, sizeof(name)); + memset( display, 0 ,sizeof(display)); + plug->GetParamName( j , name ); + + if(*name) { + if (showparams) { + plug->DescribeValue( j , display ); + val = plug->GetParamValue( j ); + post ("parameter[#%d], \"%s\" value=%f (%s) ", j, name, val,display); + } + else { + val = plug->GetParamValue( j ); + post ("parameter[#%d], \"%s\" value=%f ", j, name, val); + } + } +} + + +// set the value of a parameter +V vst::ms_param(I pnum,F val) +{ + if(!plug || pnum < 0 || pnum >= plug->GetNumParams()) return; + + F xval = plug->GetParamValue( pnum ); +// if(xval <= 1.0f) // What's that???? + if(true) + { + plug->SetParameter( pnum, val ); + if(echoparam) display_parameter(pnum , true ); + } + else + FLEXT_ASSERT(false); +} + +V vst::mg_param(I pnum) +{ + if(!plug || pnum < 0 || pnum >= plug->GetNumParams()) return; + + A at[2]; + SetInt(at[0],pnum); + SetFloat(at[1],plug->GetParamValue(pnum)); + ToOutAnything(GetOutAttr(),MakeSymbol("param"),2,at); +} + +V vst::m_pname(I pnum) +{ + if(!plug || pnum < 0 || pnum >= plug->GetNumParams()) return; + + C name[109]; /* the Steinberg(tm) way... */ + + memset(name,0,sizeof(name)); + plug->GetParamName(pnum,name); + + A at[2]; + SetInt(at[0],pnum); + SetString(at[1],name); + ToOutAnything(GetOutAttr(),MakeSymbol("pname"),2,at); +} + +V vst::m_ptext(I pnum) +{ + if(!plug || pnum < 0 || pnum >= plug->GetNumParams()) return; + + C display[164]; /* the Steinberg(tm) way... */ + + memset(display,0,sizeof(display)); + plug->DescribeValue(pnum,display); + + A at[2]; + SetInt(at[0],pnum); + SetString(at[1],display); + ToOutAnything(GetOutAttr(),MakeSymbol("ptext"),2,at); +} + +V vst::m_note(I note,I velocity) +{ + if(!plug) return; + + if(velocity > 0) + plug->AddNoteOn(note,velocity); + else + plug->AddNoteOff(note); +} diff --git a/externals/grill/vst/vst.dsp b/externals/grill/vst/vst.dsp index 180f9542..db4d1633 100644 --- a/externals/grill/vst/vst.dsp +++ b/externals/grill/vst/vst.dsp @@ -1,210 +1,210 @@ -# Microsoft Developer Studio Project File - Name="vst" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** NICHT BEARBEITEN ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=vst - Win32 Debug -!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE -!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl -!MESSAGE -!MESSAGE NMAKE /f "vst.mak". -!MESSAGE -!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben -!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: -!MESSAGE -!MESSAGE NMAKE /f "vst.mak" CFG="vst - Win32 Debug" -!MESSAGE -!MESSAGE Für die Konfiguration stehen zur Auswahl: -!MESSAGE -!MESSAGE "vst - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library") -!MESSAGE "vst - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "max/vst" -# PROP Scc_LocalPath "." -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "vst - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 1 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "pd-msvc/r" -# PROP Intermediate_Dir "pd-msvc/r" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "c:\programme\audio\pd\src" /I "f:\prog\max\flext\source" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D FLEXT_SYS=2 /D "FLEXT_THREADS" /D "_WINDLL" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0xc07 /d "NDEBUG" -# ADD RSC /l 0xc07 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 pd.lib flext_t-pdwin.lib pthreadVC.lib /nologo /dll /machine:I386 /out:"pd-msvc/vst~.dll" /libpath:"c:\programme\audio\pd\bin" /libpath:"f:\prog\max\flext\pd-msvc" - -!ELSEIF "$(CFG)" == "vst - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 2 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "pd-msvc/d" -# PROP Intermediate_Dir "pd-msvc/d" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "c:\programme\audio\pd\src" /I "f:\prog\max\flext\source" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D FLEXT_SYS=2 /D "FLEXT_THREADS" /D "_WINDLL" /D "_AFXDLL" /D "FLEXT_LOGGING" /FR /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0xc07 /d "_DEBUG" -# ADD RSC /l 0xc07 /d "_DEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 pd.lib flext_td-pdwin.lib pthreadVC.lib /nologo /dll /debug /machine:I386 /out:"pd-msvc/d/vst~.dll" /pdbtype:sept /libpath:"c:\programme\audio\pd\bin" /libpath:"f:\prog\max\flext\pd-msvc" - -!ENDIF - -# Begin Target - -# Name "vst - Win32 Release" -# Name "vst - Win32 Debug" -# Begin Group "vst" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\src\vst\AEffect.h -# End Source File -# Begin Source File - -SOURCE=.\src\vst\AEffectx.h -# End Source File -# Begin Source File - -SOURCE=.\src\vst\AEffEditor.h -# End Source File -# Begin Source File - -SOURCE=.\src\vst\AudioEffect.hpp -# End Source File -# Begin Source File - -SOURCE=.\src\vst\audioeffectx.h -# End Source File -# End Group -# Begin Group "alt" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\src\vst.cpp -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=.\src\vst~.cpp -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=.\src\vst~.h -# PROP Exclude_From_Build 1 -# End Source File -# End Group -# Begin Group "mfc" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\src\Resource.h -# End Source File -# Begin Source File - -SOURCE=.\src\StdAfx.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\StdAfx.h -# End Source File -# End Group -# Begin Group "host" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\src\EditorThread.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\EditorThread.h -# End Source File -# Begin Source File - -SOURCE=.\src\PopupWindow.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\PopupWindow.h -# End Source File -# Begin Source File - -SOURCE=.\src\vst.rc -# End Source File -# Begin Source File - -SOURCE=.\src\VstHost.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\VstHost.h -# End Source File -# End Group -# Begin Group "doc" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\gpl.txt -# End Source File -# Begin Source File - -SOURCE=.\license.txt -# End Source File -# Begin Source File - -SOURCE=.\readme.txt -# End Source File -# End Group -# Begin Source File - -SOURCE=.\src\main.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\main.h -# End Source File -# Begin Source File - -SOURCE=.\src\vst.h -# End Source File -# End Target -# End Project +# Microsoft Developer Studio Project File - Name="vst" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** NICHT BEARBEITEN **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=vst - Win32 Debug
+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl
+!MESSAGE
+!MESSAGE NMAKE /f "vst.mak".
+!MESSAGE
+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben
+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
+!MESSAGE
+!MESSAGE NMAKE /f "vst.mak" CFG="vst - Win32 Debug"
+!MESSAGE
+!MESSAGE Für die Konfiguration stehen zur Auswahl:
+!MESSAGE
+!MESSAGE "vst - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "vst - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName "max/vst"
+# PROP Scc_LocalPath "."
+CPP=xicl6.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "vst - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 1
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "pd-msvc/r"
+# PROP Intermediate_Dir "pd-msvc/r"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "c:\programme\audio\pd\src" /I "f:\prog\max\flext\source" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D FLEXT_SYS=2 /D "FLEXT_THREADS" /D "_WINDLL" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0xc07 /d "NDEBUG"
+# ADD RSC /l 0xc07 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=xilink6.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 pd.lib flext_t-pdwin.lib pthreadVC.lib /nologo /dll /machine:I386 /out:"pd-msvc/vst~.dll" /libpath:"c:\programme\audio\pd\bin" /libpath:"f:\prog\max\flext\pd-msvc"
+
+!ELSEIF "$(CFG)" == "vst - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 2
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "pd-msvc/d"
+# PROP Intermediate_Dir "pd-msvc/d"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "c:\programme\audio\pd\src" /I "f:\prog\max\flext\source" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D FLEXT_SYS=2 /D "FLEXT_THREADS" /D "_WINDLL" /D "_AFXDLL" /D "FLEXT_LOGGING" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0xc07 /d "_DEBUG"
+# ADD RSC /l 0xc07 /d "_DEBUG" /d "_AFXDLL"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=xilink6.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 pd.lib flext_td-pdwin.lib pthreadVC.lib /nologo /dll /debug /machine:I386 /out:"pd-msvc/d/vst~.dll" /pdbtype:sept /libpath:"c:\programme\audio\pd\bin" /libpath:"f:\prog\max\flext\pd-msvc"
+
+!ENDIF
+
+# Begin Target
+
+# Name "vst - Win32 Release"
+# Name "vst - Win32 Debug"
+# Begin Group "vst"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\src\vst\AEffect.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\vst\AEffectx.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\vst\AEffEditor.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\vst\AudioEffect.hpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\vst\audioeffectx.h
+# End Source File
+# End Group
+# Begin Group "alt"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\src\vst.cpp
+# PROP Exclude_From_Build 1
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\vst~.cpp
+# PROP Exclude_From_Build 1
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\vst~.h
+# PROP Exclude_From_Build 1
+# End Source File
+# End Group
+# Begin Group "mfc"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\src\Resource.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\StdAfx.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\StdAfx.h
+# End Source File
+# End Group
+# Begin Group "host"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\src\EditorThread.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\EditorThread.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\PopupWindow.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\PopupWindow.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\vst.rc
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\VstHost.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\VstHost.h
+# End Source File
+# End Group
+# Begin Group "doc"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\gpl.txt
+# End Source File
+# Begin Source File
+
+SOURCE=.\license.txt
+# End Source File
+# Begin Source File
+
+SOURCE=.\readme.txt
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\src\main.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\main.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\vst.h
+# End Source File
+# End Target
+# End Project
|