f@0: #ifndef _IPLUGAPP_APP_MAIN_H_ f@0: #define _IPLUGAPP_APP_MAIN_H_ f@0: f@0: #include "IPlugOSDetect.h" f@0: f@0: /* f@0: f@0: Standalone osx/win app wrapper for iPlug, using SWELL f@0: Oli Larkin 2012 f@0: f@0: Notes: f@0: f@0: App settings are stored in a .ini file. The location is as follows: f@0: f@0: Windows7: C:\Users\USERNAME\AppData\Local\AccessibleSpectrumAnalyser\settings.ini f@0: Windows XP/Vista: C:\Documents and Settings\USERNAME\Local Settings\Application Data\AccessibleSpectrumAnalyser\settings.ini f@0: OSX: /Users/USERNAME/Library/Application\ Support/AccessibleSpectrumAnalyser/settings.ini f@0: f@0: */ f@0: f@0: #ifdef OS_WIN f@0: #include f@0: #include f@0: f@0: #define DEFAULT_INPUT_DEV "Default Device" f@0: #define DEFAULT_OUTPUT_DEV "Default Device" f@0: f@0: #define DAC_DS 0 f@0: #define DAC_ASIO 1 f@0: #elif defined OS_OSX f@0: #include "swell.h" f@0: #define SLEEP( milliseconds ) usleep( (unsigned long) (milliseconds * 1000.0) ) f@0: f@0: #define DEFAULT_INPUT_DEV "Built-in Input" f@0: #define DEFAULT_OUTPUT_DEV "Built-in Output" f@0: f@0: #define DAC_COREAUDIO 0 f@0: // #define DAC_JACK 1 f@0: #endif f@0: f@0: #include "wdltypes.h" f@0: #include "RtAudio.h" f@0: #include "RtMidi.h" f@0: #include f@0: #include f@0: f@0: #include "../AccessibleSpectrumAnalyser.h" // change this to match your iplug plugin .h file f@0: f@0: typedef unsigned short UInt16; f@0: f@0: struct AppState f@0: { f@0: // on osx core audio 0 or jack 1 f@0: // on windows DS 0 or ASIO 1 f@0: UInt16 mAudioDriverType; f@0: f@0: // strings f@0: char mAudioInDev[100]; f@0: char mAudioOutDev[100]; f@0: char mAudioSR[100]; f@0: char mAudioIOVS[100]; f@0: char mAudioSigVS[100]; f@0: f@0: UInt16 mAudioInChanL; f@0: UInt16 mAudioInChanR; f@0: UInt16 mAudioOutChanL; f@0: UInt16 mAudioOutChanR; f@0: UInt16 mAudioInIsMono; f@0: f@0: // strings containing the names of the midi devices f@0: char mMidiInDev[100]; f@0: char mMidiOutDev[100]; f@0: f@0: UInt16 mMidiInChan; f@0: UInt16 mMidiOutChan; f@0: f@0: AppState(): f@0: mAudioDriverType(0), // DS / CoreAudio by default f@0: mAudioInChanL(1), f@0: mAudioInChanR(2), f@0: mAudioOutChanL(1), f@0: mAudioOutChanR(2), f@0: mMidiInChan(0), f@0: mMidiOutChan(0) f@0: { f@0: strcpy(mAudioInDev, DEFAULT_INPUT_DEV); f@0: strcpy(mAudioOutDev, DEFAULT_OUTPUT_DEV); f@0: strcpy(mAudioSR, "44100"); f@0: strcpy(mAudioIOVS, "512"); f@0: strcpy(mAudioSigVS, "32"); f@0: f@0: strcpy(mMidiInDev, "off"); f@0: strcpy(mMidiOutDev, "off"); f@0: } f@0: }; f@0: f@0: extern WDL_DLGRET MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); f@0: extern WDL_DLGRET PreferencesDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); f@0: extern HINSTANCE gHINST; f@0: extern HWND gHWND; f@0: extern UINT gScrollMessage; f@0: extern IPlug* gPluginInstance; // The iplug plugin instance f@0: f@0: extern std::string GetAudioDeviceName(int idx); f@0: extern int GetAudioDeviceID(char* deviceNameToTest); f@0: f@0: extern void ProbeAudioIO(); f@0: extern bool InitialiseAudio(unsigned int inId, f@0: unsigned int outId, f@0: unsigned int sr, f@0: unsigned int iovs, f@0: unsigned int chnls, f@0: unsigned int inChanL, f@0: unsigned int outChanL f@0: ); f@0: f@0: extern bool AudioSettingsInStateAreEqual(AppState* os, AppState* ns); f@0: extern bool MIDISettingsInStateAreEqual(AppState* os, AppState* ns); f@0: f@0: extern bool TryToChangeAudioDriverType(); f@0: extern bool TryToChangeAudio(); f@0: extern bool ChooseMidiInput(const char* pPortName); f@0: extern bool ChooseMidiOutput(const char* pPortName); f@0: f@0: extern bool AttachGUI(); f@0: f@0: extern RtAudio* gDAC; f@0: extern RtMidiIn *gMidiIn; f@0: extern RtMidiOut *gMidiOut; f@0: f@0: extern AppState *gState; f@0: extern AppState *gTempState; // The state is copied here when the pref dialog is opened, and restored if cancel is pressed f@0: extern AppState *gActiveState; // When the audio driver is started the current state is copied here so that if OK is pressed after APPLY nothing is changed f@0: f@0: extern unsigned int gSigVS; f@0: extern unsigned int gBufIndex; // index for signal vector, loops from 0 to gSigVS f@0: f@0: extern char *gINIPath; // path of ini file f@0: extern void UpdateINI(); f@0: f@0: extern std::vector gAudioInputDevs; f@0: extern std::vector gAudioOutputDevs; f@0: extern std::vector gMIDIInputDevNames; f@0: extern std::vector gMIDIOutputDevNames; f@0: f@0: #endif //_IPLUGAPP_APP_MAIN_H_ f@0: