From 61af086e8e3131e7c32ad2ed3c12dc253f8b6191 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 24 Jun 2007 11:40:00 +0000 Subject: Mod code cleanup svn-id: r27690 --- sound/mods/infogrames.h | 19 ++++++++++--------- sound/mods/paula.h | 6 +++--- 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/mods/infogrames.h b/sound/mods/infogrames.h index 7220c2bf9a..bba43cbef2 100644 --- a/sound/mods/infogrames.h +++ b/sound/mods/infogrames.h @@ -80,14 +80,6 @@ public: Instruments *getInstruments(void) const { return _instruments; } bool getRepeating(void) const { return _repCount != 0; } void setRepeating (int32 repCount) { _repCount = repCount; } - virtual void startPlay(void) { _playing = true;} - virtual void stopPlay(void) - { - _mutex.lock(); - _playing = false; - _mutex.unlock(); - } - virtual void pausePlay(bool pause) { _playing = !pause; } bool load(Common::SeekableReadStream &dum); bool load(const char *dum) { @@ -98,7 +90,16 @@ public: return false; } void unload(void); - void restart(void) { if (_data) { stopPlay(); init(); startPlay(); } } + void restart(void) { + if (_data) { + // Use the mutex here to ensure we do not call init() + // while data is being read by the mixer thread. + _mutex.lock(); + init(); + _playing = true; + _mutex.unlock(); + } + } protected: Instruments *_instruments; diff --git a/sound/mods/paula.h b/sound/mods/paula.h index 0e89b78db6..4bf0b8cec2 100644 --- a/sound/mods/paula.h +++ b/sound/mods/paula.h @@ -51,9 +51,9 @@ public: } void clearVoice(byte voice); void clearVoices() { for (int i = 0; i < NUM_VOICES; ++i) clearVoice(i); } - virtual void startPlay(void) {} - virtual void stopPlay(void) {} - virtual void pausePlay(bool pause) {} + void startPlay(void) { _playing = true; } + void stopPlay(void) { _playing = false; } + void pausePlay(bool pause) { _playing = !pause; } // AudioStream API int readBuffer(int16 *buffer, const int numSamples); -- cgit v1.2.3