re-initialize dispatch if core settings changed

This commit is contained in:
tildearrow 2022-12-14 17:18:19 -05:00
parent 7732031404
commit 332c6edbed
3 changed files with 16 additions and 3 deletions

View file

@ -3916,9 +3916,13 @@ void DivEngine::setConsoleMode(bool enable) {
consoleMode=enable;
}
bool DivEngine::switchMaster() {
bool DivEngine::switchMaster(bool full) {
logI("switching output...");
deinitAudioBackend(true);
if (full) {
quitDispatch();
initDispatch();
}
if (initAudioBackend()) {
for (int i=0; i<song.systemLen; i++) {
disCont[i].setRates(got.rate);

View file

@ -976,7 +976,7 @@ class DivEngine {
String getPlaybackDebugInfo();
// switch master
bool switchMaster();
bool switchMaster(bool full=false);
// set MIDI base channel
void setMidiBaseChan(int chan);

View file

@ -2594,6 +2594,15 @@ void FurnaceGUI::commitSettings() {
settings.tg100Path!=e->getConfString("tg100Path","") ||
settings.mu5Path!=e->getConfString("mu5Path","");
bool coresChanged=(
settings.arcadeCore!=e->getConfInt("arcadeCore",0) ||
settings.ym2612Core!=e->getConfInt("ym2612Core",0) ||
settings.snCore!=e->getConfInt("snCore",0) ||
settings.nesCore!=e->getConfInt("nesCore",0) ||
settings.fdsCore!=e->getConfInt("fdsCore",0) ||
settings.c64Core!=e->getConfInt("c64Core",1)
);
e->setConf("mainFontSize",settings.mainFontSize);
e->setConf("patFontSize",settings.patFontSize);
e->setConf("iconSize",settings.iconSize);
@ -2754,7 +2763,7 @@ void FurnaceGUI::commitSettings() {
}
}
if (!e->switchMaster()) {
if (!e->switchMaster(coresChanged)) {
showError("could not initialize audio!");
}