f@0
|
1 #ifndef _IPLUGAPP_APP_MAIN_H_
|
f@0
|
2 #define _IPLUGAPP_APP_MAIN_H_
|
f@0
|
3
|
f@0
|
4 #include "IPlugOSDetect.h"
|
f@0
|
5
|
f@0
|
6 /*
|
f@0
|
7
|
f@0
|
8 Standalone osx/win app wrapper for iPlug, using SWELL
|
f@0
|
9 Oli Larkin 2012
|
f@0
|
10
|
f@0
|
11 Notes:
|
f@0
|
12
|
f@0
|
13 App settings are stored in a .ini file. The location is as follows:
|
f@0
|
14
|
f@0
|
15 Windows7: C:\Users\USERNAME\AppData\Local\AccessibleSpectrumAnalyser\settings.ini
|
f@0
|
16 Windows XP/Vista: C:\Documents and Settings\USERNAME\Local Settings\Application Data\AccessibleSpectrumAnalyser\settings.ini
|
f@0
|
17 OSX: /Users/USERNAME/Library/Application\ Support/AccessibleSpectrumAnalyser/settings.ini
|
f@0
|
18
|
f@0
|
19 */
|
f@0
|
20
|
f@0
|
21 #ifdef OS_WIN
|
f@0
|
22 #include <windows.h>
|
f@0
|
23 #include <commctrl.h>
|
f@0
|
24
|
f@0
|
25 #define DEFAULT_INPUT_DEV "Default Device"
|
f@0
|
26 #define DEFAULT_OUTPUT_DEV "Default Device"
|
f@0
|
27
|
f@0
|
28 #define DAC_DS 0
|
f@0
|
29 #define DAC_ASIO 1
|
f@0
|
30 #elif defined OS_OSX
|
f@0
|
31 #include "swell.h"
|
f@0
|
32 #define SLEEP( milliseconds ) usleep( (unsigned long) (milliseconds * 1000.0) )
|
f@0
|
33
|
f@0
|
34 #define DEFAULT_INPUT_DEV "Built-in Input"
|
f@0
|
35 #define DEFAULT_OUTPUT_DEV "Built-in Output"
|
f@0
|
36
|
f@0
|
37 #define DAC_COREAUDIO 0
|
f@0
|
38 // #define DAC_JACK 1
|
f@0
|
39 #endif
|
f@0
|
40
|
f@0
|
41 #include "wdltypes.h"
|
f@0
|
42 #include "RtAudio.h"
|
f@0
|
43 #include "RtMidi.h"
|
f@0
|
44 #include <string>
|
f@0
|
45 #include <vector>
|
f@0
|
46
|
f@0
|
47 #include "../AccessibleSpectrumAnalyser.h" // change this to match your iplug plugin .h file
|
f@0
|
48
|
f@0
|
49 typedef unsigned short UInt16;
|
f@0
|
50
|
f@0
|
51 struct AppState
|
f@0
|
52 {
|
f@0
|
53 // on osx core audio 0 or jack 1
|
f@0
|
54 // on windows DS 0 or ASIO 1
|
f@0
|
55 UInt16 mAudioDriverType;
|
f@0
|
56
|
f@0
|
57 // strings
|
f@0
|
58 char mAudioInDev[100];
|
f@0
|
59 char mAudioOutDev[100];
|
f@0
|
60 char mAudioSR[100];
|
f@0
|
61 char mAudioIOVS[100];
|
f@0
|
62 char mAudioSigVS[100];
|
f@0
|
63
|
f@0
|
64 UInt16 mAudioInChanL;
|
f@0
|
65 UInt16 mAudioInChanR;
|
f@0
|
66 UInt16 mAudioOutChanL;
|
f@0
|
67 UInt16 mAudioOutChanR;
|
f@0
|
68 UInt16 mAudioInIsMono;
|
f@0
|
69
|
f@0
|
70 // strings containing the names of the midi devices
|
f@0
|
71 char mMidiInDev[100];
|
f@0
|
72 char mMidiOutDev[100];
|
f@0
|
73
|
f@0
|
74 UInt16 mMidiInChan;
|
f@0
|
75 UInt16 mMidiOutChan;
|
f@0
|
76
|
f@0
|
77 AppState():
|
f@0
|
78 mAudioDriverType(0), // DS / CoreAudio by default
|
f@0
|
79 mAudioInChanL(1),
|
f@0
|
80 mAudioInChanR(2),
|
f@0
|
81 mAudioOutChanL(1),
|
f@0
|
82 mAudioOutChanR(2),
|
f@0
|
83 mMidiInChan(0),
|
f@0
|
84 mMidiOutChan(0)
|
f@0
|
85 {
|
f@0
|
86 strcpy(mAudioInDev, DEFAULT_INPUT_DEV);
|
f@0
|
87 strcpy(mAudioOutDev, DEFAULT_OUTPUT_DEV);
|
f@0
|
88 strcpy(mAudioSR, "44100");
|
f@0
|
89 strcpy(mAudioIOVS, "512");
|
f@0
|
90 strcpy(mAudioSigVS, "32");
|
f@0
|
91
|
f@0
|
92 strcpy(mMidiInDev, "off");
|
f@0
|
93 strcpy(mMidiOutDev, "off");
|
f@0
|
94 }
|
f@0
|
95 };
|
f@0
|
96
|
f@0
|
97 extern WDL_DLGRET MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
f@0
|
98 extern WDL_DLGRET PreferencesDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
f@0
|
99 extern HINSTANCE gHINST;
|
f@0
|
100 extern HWND gHWND;
|
f@0
|
101 extern UINT gScrollMessage;
|
f@0
|
102 extern IPlug* gPluginInstance; // The iplug plugin instance
|
f@0
|
103
|
f@0
|
104 extern std::string GetAudioDeviceName(int idx);
|
f@0
|
105 extern int GetAudioDeviceID(char* deviceNameToTest);
|
f@0
|
106
|
f@0
|
107 extern void ProbeAudioIO();
|
f@0
|
108 extern bool InitialiseAudio(unsigned int inId,
|
f@0
|
109 unsigned int outId,
|
f@0
|
110 unsigned int sr,
|
f@0
|
111 unsigned int iovs,
|
f@0
|
112 unsigned int chnls,
|
f@0
|
113 unsigned int inChanL,
|
f@0
|
114 unsigned int outChanL
|
f@0
|
115 );
|
f@0
|
116
|
f@0
|
117 extern bool AudioSettingsInStateAreEqual(AppState* os, AppState* ns);
|
f@0
|
118 extern bool MIDISettingsInStateAreEqual(AppState* os, AppState* ns);
|
f@0
|
119
|
f@0
|
120 extern bool TryToChangeAudioDriverType();
|
f@0
|
121 extern bool TryToChangeAudio();
|
f@0
|
122 extern bool ChooseMidiInput(const char* pPortName);
|
f@0
|
123 extern bool ChooseMidiOutput(const char* pPortName);
|
f@0
|
124
|
f@0
|
125 extern bool AttachGUI();
|
f@0
|
126
|
f@0
|
127 extern RtAudio* gDAC;
|
f@0
|
128 extern RtMidiIn *gMidiIn;
|
f@0
|
129 extern RtMidiOut *gMidiOut;
|
f@0
|
130
|
f@0
|
131 extern AppState *gState;
|
f@0
|
132 extern AppState *gTempState; // The state is copied here when the pref dialog is opened, and restored if cancel is pressed
|
f@0
|
133 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
|
134
|
f@0
|
135 extern unsigned int gSigVS;
|
f@0
|
136 extern unsigned int gBufIndex; // index for signal vector, loops from 0 to gSigVS
|
f@0
|
137
|
f@0
|
138 extern char *gINIPath; // path of ini file
|
f@0
|
139 extern void UpdateINI();
|
f@0
|
140
|
f@0
|
141 extern std::vector<unsigned int> gAudioInputDevs;
|
f@0
|
142 extern std::vector<unsigned int> gAudioOutputDevs;
|
f@0
|
143 extern std::vector<std::string> gMIDIInputDevNames;
|
f@0
|
144 extern std::vector<std::string> gMIDIOutputDevNames;
|
f@0
|
145
|
f@0
|
146 #endif //_IPLUGAPP_APP_MAIN_H_
|
f@0
|
147
|