diff options
Diffstat (limited to 'engines/sky/music')
-rw-r--r-- | engines/sky/music/musicbase.cpp | 13 | ||||
-rw-r--r-- | engines/sky/music/musicbase.h | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/engines/sky/music/musicbase.cpp b/engines/sky/music/musicbase.cpp index 9d308ebc7f..e296c72827 100644 --- a/engines/sky/music/musicbase.cpp +++ b/engines/sky/music/musicbase.cpp @@ -47,7 +47,7 @@ void MusicBase::loadSection(uint8 pSection) { _mutex.lock(); if (_currentMusic) - stopMusic(); + stopMusicInternal(); if (_musicData) free(_musicData); _currentSection = pSection; @@ -82,6 +82,13 @@ void MusicBase::setVolume(uint16 param) { void MusicBase::stopMusic(void) { + _mutex.lock(); + stopMusicInternal(); + _mutex.unlock(); +} + +void MusicBase::stopMusicInternal(void) { + for (uint8 cnt = 0; cnt < _numberOfChannels; cnt++) { _channels[cnt]->stopNote(); delete _channels[cnt]; @@ -105,7 +112,7 @@ void MusicBase::loadNewMusic(void) { return; } if (_currentMusic != 0) - stopMusic(); + stopMusicInternal(); _currentMusic = _onNextPoll.musicToProcess; @@ -128,7 +135,7 @@ void MusicBase::pollMusic(void) { _mutex.lock(); uint8 newTempo; if (_onNextPoll.doReInit) startDriver(); - if (_onNextPoll.doStopMusic) stopMusic(); + if (_onNextPoll.doStopMusic) stopMusicInternal(); if (_onNextPoll.musicToProcess != _currentMusic) loadNewMusic(); diff --git a/engines/sky/music/musicbase.h b/engines/sky/music/musicbase.h index d9f3e22beb..108ee259c9 100644 --- a/engines/sky/music/musicbase.h +++ b/engines/sky/music/musicbase.h @@ -85,6 +85,8 @@ protected: void updateTempo(void); void loadNewMusic(void); void pollMusic(void); + + void stopMusicInternal(void); }; } // End of namespace Sky |