Tip: Hardcode Your Dev Environment Audio Setup
-
If you move between setups or experience crashes, you're familiar with HISE's Audio & MIDI Setup page and see it more often than you'd like.
You can hardcode your setup preferences into a MIDI processor and have it run on every compile. So if you unplug your laptop from the dock and so lose the connection the audio interface and/or MIDI devices, and then come back again, you don't have to go into the HISE preferences every time to set things up.
// Default HISE Audio Setup if (Engine.isHISE() && Engine.isPlugin() == false) { // Set Default Audio Device for (x in Settings.getAvailableDeviceNames()) { if (x.contains("Babyface Pro") && Settings.getCurrentAudioDevice() != x) { Settings.setAudioDevice(x); Settings.setBufferSize(256); break; } } // Set Default MIDI Device for (x in Settings.getMidiInputDevices()) { if (x == "SL STUDIO Port 1") Settings.toggleMidiInput(x, true); if (x == "SL STUDIO Port 2") Settings.toggleMidiInput(x, false); } }
This is an example for clarity. It's probably a better idea to write this into a file in JSON, put it somewhere on your computer (probably the HISE folder) and read from that, so that the specific device list isn't something you have to change in your projects.
You can even put the code in a .js file, store it somewhere you know it'll always be at (probably the gobal script folder) and forget about it.
With this, you can then create any kind of fallback logic you desire as you move between systems and setups.
-