[Scummvm-cvs-logs] SF.net SVN: scummvm:[53126] scummvm/trunk/sound/softsynth/fmtowns_pc98

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Sun Oct 10 18:44:09 CEST 2010


Revision: 53126
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53126&view=rev
Author:   athrxx
Date:     2010-10-10 16:44:09 +0000 (Sun, 10 Oct 2010)

Log Message:
-----------
FM-TOWNS AUDIO: improve thread safety

Modified Paths:
--------------
    scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_audio.cpp
    scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp
    scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp

Modified: scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_audio.cpp
===================================================================
--- scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_audio.cpp	2010-10-10 16:13:55 UTC (rev 53125)
+++ scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_audio.cpp	2010-10-10 16:44:09 UTC (rev 53126)
@@ -227,8 +227,8 @@
 
 TownsAudioInterface::~TownsAudioInterface() {
 	reset();
-	deinit();
 	_ready = false;
+	deinit();	
 
 	delete[] _fmSaveReg[0];
 	delete[] _fmSaveReg[1];

Modified: scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp
===================================================================
--- scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp	2010-10-10 16:13:55 UTC (rev 53125)
+++ scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp	2010-10-10 16:44:09 UTC (rev 53126)
@@ -1054,8 +1054,8 @@
 
 TownsPC98_AudioDriver::~TownsPC98_AudioDriver() {
 	reset();
-	deinit();
 	_ready = false;
+	deinit();	
 
 	if (_channels) {
 		for (int i = 0; i < _numChan; i++)

Modified: scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp
===================================================================
--- scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp	2010-10-10 16:13:55 UTC (rev 53125)
+++ scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp	2010-10-10 16:44:09 UTC (rev 53126)
@@ -844,8 +844,7 @@
 	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 @@
 	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 @@
 }
 
 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() {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list