mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-30 00:13:03 +00:00
Add button in midi settings to refresh midi devices
Deletes and creates a new RT midi instance allowing for midi devices to be plugged in without restarting
This commit is contained in:
parent
65b50f4acc
commit
c1c2b52ba7
5 changed files with 26 additions and 0 deletions
|
@ -59,3 +59,8 @@ void TAAudio::quitMidi() {
|
||||||
midiOut=NULL;
|
midiOut=NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TAAudio::reinitMidi(bool jack) {
|
||||||
|
quitMidi();
|
||||||
|
initMidi(jack);
|
||||||
|
}
|
|
@ -178,6 +178,8 @@ class TAAudio {
|
||||||
virtual std::vector<String> listAudioDevices();
|
virtual std::vector<String> listAudioDevices();
|
||||||
bool initMidi(bool jack);
|
bool initMidi(bool jack);
|
||||||
void quitMidi();
|
void quitMidi();
|
||||||
|
/** remove and reload midi to allow hotswaping midi devices */
|
||||||
|
bool reinitMidi(bool jack);
|
||||||
virtual bool init(TAAudioDesc& request, TAAudioDesc& response);
|
virtual bool init(TAAudioDesc& request, TAAudioDesc& response);
|
||||||
|
|
||||||
TAAudio():
|
TAAudio():
|
||||||
|
|
|
@ -3473,6 +3473,15 @@ void DivEngine::rescanAudioDevices() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DivEngine::rescanMidiDevices() {
|
||||||
|
if (output!=NULL) {
|
||||||
|
logV("reloading midi...");
|
||||||
|
output->reinitMidi(false);
|
||||||
|
rescanAudioDevices();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DivEngine::initDispatch(bool isRender) {
|
void DivEngine::initDispatch(bool isRender) {
|
||||||
BUSY_BEGIN;
|
BUSY_BEGIN;
|
||||||
logV("initializing dispatch...");
|
logV("initializing dispatch...");
|
||||||
|
|
|
@ -1077,6 +1077,9 @@ class DivEngine {
|
||||||
// rescan audio devices
|
// rescan audio devices
|
||||||
void rescanAudioDevices();
|
void rescanAudioDevices();
|
||||||
|
|
||||||
|
/** rescan midi devices */
|
||||||
|
void rescanMidiDevices();
|
||||||
|
|
||||||
// set the console mode.
|
// set the console mode.
|
||||||
void setConsoleMode(bool enable);
|
void setConsoleMode(bool enable);
|
||||||
|
|
||||||
|
|
|
@ -1129,6 +1129,13 @@ void FurnaceGUI::drawSettings() {
|
||||||
ImGui::EndCombo();
|
ImGui::EndCombo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("Reload MIDI devices")) {
|
||||||
|
e->rescanMidiDevices();
|
||||||
|
audioEngineChanged=true;
|
||||||
|
settingsChanged=false;
|
||||||
|
}
|
||||||
|
|
||||||
if (hasToReloadMidi) {
|
if (hasToReloadMidi) {
|
||||||
midiMap.read(e->getConfigPath()+DIR_SEPARATOR_STR+"midiIn_"+stripName(settings.midiInDevice)+".cfg");
|
midiMap.read(e->getConfigPath()+DIR_SEPARATOR_STR+"midiIn_"+stripName(settings.midiInDevice)+".cfg");
|
||||||
midiMap.compile();
|
midiMap.compile();
|
||||||
|
|
Loading…
Reference in a new issue