| 180 | } |
| 181 | |
| 182 | void initialise() override |
| 183 | { |
| 184 | #ifdef JUCE_WINDOWS |
| 185 | // glewInit(); |
| 186 | #endif |
| 187 | |
| 188 | mVG = nvgCreateGLES2(NVG_ANTIALIAS | NVG_STENCIL_STROKES); |
| 189 | mFontBoundsVG = nvgCreateGLES2(NVG_ANTIALIAS | NVG_STENCIL_STROKES); |
| 190 | |
| 191 | if (mVG == nullptr) |
| 192 | printf("Could not init nanovg.\n"); |
| 193 | if (mFontBoundsVG == nullptr) |
| 194 | printf("Could not init font bounds nanovg.\n"); |
| 195 | |
| 196 | Push2Control::CreateStaticFramebuffer(); |
| 197 | |
| 198 | mSynth.LoadResources(mVG, mFontBoundsVG); |
| 199 | |
| 200 | /*for (auto deviceType : mGlobalManagers.mDeviceManager.getAvailableDeviceTypes()) |
| 201 | { |
| 202 | ofLog() << "inputs:"; |
| 203 | for (auto input : deviceType->getDeviceNames(true)) |
| 204 | ofLog() << input.toStdString(); |
| 205 | ofLog() << "outputs:"; |
| 206 | for (auto output : deviceType->getDeviceNames(false)) |
| 207 | ofLog() << output.toStdString(); |
| 208 | }*/ |
| 209 | |
| 210 | const std::string kAutoDevice = "auto"; |
| 211 | const std::string kNoneDevice = "none"; |
| 212 | |
| 213 | if (UserPrefs.devicetype.Get() != kAutoDevice) |
| 214 | mGlobalManagers.mDeviceManager.setCurrentAudioDeviceType(UserPrefs.devicetype.Get(), true); |
| 215 | |
| 216 | SetGlobalSampleRateAndBufferSize(UserPrefs.samplerate.Get(), UserPrefs.buffersize.Get()); |
| 217 | |
| 218 | mSynth.Setup(&mGlobalManagers.mDeviceManager, &mGlobalManagers.mAudioFormatManager, this, &openGLContext); |
| 219 | |
| 220 | std::string outputDevice = UserPrefs.audio_output_device.Get(); |
| 221 | std::string inputDevice = UserPrefs.audio_input_device.Get(); |
| 222 | if (!mGlobalManagers.mDeviceManager.getCurrentDeviceTypeObject()->hasSeparateInputsAndOutputs()) |
| 223 | inputDevice = outputDevice; //asio must have identical input and output |
| 224 | |
| 225 | AudioDeviceManager::AudioDeviceSetup preferredSetupOptions; |
| 226 | preferredSetupOptions.sampleRate = gSampleRate / UserPrefs.oversampling.Get(); |
| 227 | preferredSetupOptions.bufferSize = gBufferSize / UserPrefs.oversampling.Get(); |
| 228 | if (outputDevice != kAutoDevice && outputDevice != kNoneDevice) |
| 229 | preferredSetupOptions.outputDeviceName = outputDevice; |
| 230 | if (inputDevice != kAutoDevice && inputDevice != kNoneDevice) |
| 231 | preferredSetupOptions.inputDeviceName = inputDevice; |
| 232 | |
| 233 | #ifdef JUCE_WINDOWS |
| 234 | CoInitializeEx(0, COINIT_MULTITHREADED); |
| 235 | #endif |
| 236 | |
| 237 | int inputChannels = UserPrefs.max_input_channels.Get(); |
| 238 | int outputChannels = UserPrefs.max_output_channels.Get(); |
| 239 |
nothing calls this directly
no test coverage detected