Skip to content

Commit

Permalink
Don't apply config options to uninitialized synths
Browse files Browse the repository at this point in the history
Fixes crash when mt32emu options are non-default and ROMs are not
present.
  • Loading branch information
dwhinham committed Aug 11, 2021
1 parent ebfed6f commit 34c6dec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- MIDI and UART related warnings are now hidden unless verbose mode is enabled in the configuration file. This is a preventative measure against false bug reports stemming from buggy games/user equipment, and to improve aesthetics (real synthesizers tend to silently ignore harmless stray MIDI bytes).

### Fixed

- Guru Meditation that could occur if non-default mt32emu options were specified but the synth was unavailable due to missing ROMs.

## [0.10.1] - 2021-08-01

### Changed
Expand Down
6 changes: 4 additions & 2 deletions src/mt32pi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ bool CMT32Pi::InitMT32Synth()
m_pLogger->Write(MT32PiName, LogWarning, "mt32emu init failed; no ROMs present?");
delete m_pMT32Synth;
m_pMT32Synth = nullptr;
return false;
}

// Set initial MT-32 channel assignment from config
Expand All @@ -378,7 +379,7 @@ bool CMT32Pi::InitMT32Synth()

m_pMT32Synth->SetUserInterface(&m_UserInterface);

return m_pMT32Synth != nullptr;
return true;
}

bool CMT32Pi::InitSoundFontSynth()
Expand All @@ -391,11 +392,12 @@ bool CMT32Pi::InitSoundFontSynth()
m_pLogger->Write(MT32PiName, LogWarning, "FluidSynth init failed; no SoundFonts present?");
delete m_pSoundFontSynth;
m_pSoundFontSynth = nullptr;
return false;
}

m_pSoundFontSynth->SetUserInterface(&m_UserInterface);

return m_pSoundFontSynth != nullptr;
return true;
}

void CMT32Pi::MainTask()
Expand Down

0 comments on commit 34c6dec

Please sign in to comment.