/********************************************************************** Audacity: A Digital Audio Editor LoadVSTMac.cpp Dominic Mazzoni **********************************************************************/ #include "../../Audacity.h" #if USE_VST #define __MOVIES__ /* Apple's Movies.h not compatible with Audacity */ /* #define __MACHELP__ */ #include #ifdef __MACOS9__ #include #include #include #include #endif #ifdef __MACOSX__ #include #endif #include "AEffect.h" #include "AudioEffect.hpp" // VST API #include "VSTEffect.h" #include "LoadVSTMac.h" #include "../../AudacityApp.h" #include "../../Internat.h" int audacityVSTID = 1; extern "C" { long audioMaster(AEffect * effect, long opcode, long index, long value, void *ptr, float opt) { switch (opcode) { case audioMasterVersion: return 2; case audioMasterCurrentId: return audacityVSTID; default: return 0; } } typedef AEffect *(*vstPluginMain)(audioMasterCallback audioMaster); void LoadVSTPlugins() { #ifdef __MACOSX__ audioMasterCallback audioMasterFPtr = (audioMasterCallback)NewCFMFromMachO(audioMaster); #else // What is the corrct way of creating an audioMasterCallback // in OS 9/Carbon??? // audioMasterCallback audioMasterFPtr = NULL; audioMasterCallback audioMasterFPtr = audioMaster; #endif wxArrayString audacityPathList = wxGetApp().audacityPathList; wxArrayString pathList; wxArrayString files; unsigned int i; for(i=0; imagic == kEffectMagic) { memcpy(fragNameCStr, &fragName[1], fragName[0]); fragNameCStr[fragName[0]] = 0; VSTEffect *vst = new VSTEffect(wxString(fragNameCStr), theEffect); Effect::RegisterEffect(vst); } #ifdef __MACOSX__ DisposeMachOFromCFM(pluginMain); #endif audacityVSTID++; } } CloseResFile(resFileID); } #ifdef __MACOSX__ DisposeCFMFromMachO(audioMasterFPtr); #endif // __MACOSX__ } }; // extern "C" #else extern "C" { void LoadVSTPlugins() {} } #endif // USE_VST