diff options
author | Florian Kagerer | 2010-10-10 16:44:09 +0000 |
---|---|---|
committer | Florian Kagerer | 2010-10-10 16:44:09 +0000 |
commit | 67c68afa6dd2fe1fdc300b72a7cf1d867ab38f27 (patch) | |
tree | eb1234ce3ef028e0cabd718ea58ba8a6493f63b6 /sound/softsynth/fmtowns_pc98 | |
parent | 1f6bc7e3095bcf8cac4daba79859fa1c23deea52 (diff) | |
download | scummvm-rg350-67c68afa6dd2fe1fdc300b72a7cf1d867ab38f27.tar.gz scummvm-rg350-67c68afa6dd2fe1fdc300b72a7cf1d867ab38f27.tar.bz2 scummvm-rg350-67c68afa6dd2fe1fdc300b72a7cf1d867ab38f27.zip |
FM-TOWNS AUDIO: improve thread safety
svn-id: r53126
Diffstat (limited to 'sound/softsynth/fmtowns_pc98')
-rw-r--r-- | sound/softsynth/fmtowns_pc98/towns_audio.cpp | 2 | ||||
-rw-r--r-- | sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp | 2 | ||||
-rw-r--r-- | sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp | 11 |
3 files changed, 7 insertions, 8 deletions
diff --git a/sound/softsynth/fmtowns_pc98/towns_audio.cpp b/sound/softsynth/fmtowns_pc98/towns_audio.cpp index f9c9529214..9823015a2d 100644 --- a/sound/softsynth/fmtowns_pc98/towns_audio.cpp +++ b/sound/softsynth/fmtowns_pc98/towns_audio.cpp @@ -227,8 +227,8 @@ TownsAudioInterface::TownsAudioInterface(Audio::Mixer *mixer, TownsAudioInterfac TownsAudioInterface::~TownsAudioInterface() { reset(); - deinit(); _ready = false; + deinit(); delete[] _fmSaveReg[0]; delete[] _fmSaveReg[1]; diff --git a/sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp b/sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp index b711eccbe1..4676ed774a 100644 --- a/sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp +++ b/sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp @@ -1054,8 +1054,8 @@ TownsPC98_AudioDriver::TownsPC98_AudioDriver(Audio::Mixer *mixer, EmuType type) TownsPC98_AudioDriver::~TownsPC98_AudioDriver() { reset(); - deinit(); _ready = false; + deinit(); if (_channels) { for (int i = 0; i < _numChan; i++) diff --git a/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp b/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp index dbd8e37cb7..541d582c1c 100644 --- a/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp +++ b/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp @@ -844,8 +844,7 @@ TownsPC98_FmSynth::TownsPC98_FmSynth(Audio::Mixer *mixer, EmuType type) : memset(&_timers[0], 0, sizeof(ChipTimer)); memset(&_timers[1], 0, sizeof(ChipTimer)); - _timers[0].cb = &TownsPC98_FmSynth::timerCallbackA; - _timers[1].cb = &TownsPC98_FmSynth::timerCallbackB; + _timers[0].cb = _timers[1].cb = &TownsPC98_FmSynth::idleTimerCallback; _timerbase = (uint32)(_baserate * 1000000.0f); } @@ -1125,7 +1124,7 @@ int TownsPC98_FmSynth::readBuffer(int16 *buffer, const int numSamples) { memset(tmp, 0, sizeof(int32) * numSamples); int32 samplesLeft = numSamples >> 1; - while (samplesLeft) { + while (_ready && samplesLeft) { int32 render = samplesLeft; for (int i = 0; i < 2; i++) { @@ -1179,10 +1178,10 @@ int TownsPC98_FmSynth::readBuffer(int16 *buffer, const int numSamples) { } void TownsPC98_FmSynth::deinit() { - _mixer->stopHandle(_soundHandle); - _timers[0].cb = &TownsPC98_FmSynth::idleTimerCallback; - _timers[1].cb = &TownsPC98_FmSynth::idleTimerCallback; _ready = false; + _mixer->stopHandle(_soundHandle); + Common::StackLock lock(_mutex); + _timers[0].cb = _timers[1].cb = &TownsPC98_FmSynth::idleTimerCallback; } uint8 TownsPC98_FmSynth::readSSGStatus() { |