diff options
author | Norbert Lange | 2009-06-19 22:13:43 +0000 |
---|---|---|
committer | Norbert Lange | 2009-06-19 22:13:43 +0000 |
commit | 115c276d4c0e34e73af14a16abd1a7fe0df63051 (patch) | |
tree | 3beaa354cb51c2016eed7f64e9db5f8925625987 /sound | |
parent | 3ef2279c343d9bc671a8173c33051d99d9d47e09 (diff) | |
download | scummvm-rg350-115c276d4c0e34e73af14a16abd1a7fe0df63051.tar.gz scummvm-rg350-115c276d4c0e34e73af14a16abd1a7fe0df63051.tar.bz2 scummvm-rg350-115c276d4c0e34e73af14a16abd1a7fe0df63051.zip |
modified doSong so you can start a new Song without killing running macros
svn-id: r41693
Diffstat (limited to 'sound')
-rw-r--r-- | sound/mods/tfmx.cpp | 21 | ||||
-rw-r--r-- | sound/mods/tfmx.h | 4 |
2 files changed, 17 insertions, 8 deletions
diff --git a/sound/mods/tfmx.cpp b/sound/mods/tfmx.cpp index 60c2833f45..da91fe43a9 100644 --- a/sound/mods/tfmx.cpp +++ b/sound/mods/tfmx.cpp @@ -890,11 +890,20 @@ void Tfmx::doMacro(int note, int macro, int relVol, int finetune, int channelNo) startPaula(); } -void Tfmx::doSong(int songPos) { +void Tfmx::stopSong(bool stopAudio) { + Common::StackLock lock(_mutex); + _playerCtx.song = -1; + if (stopAudio) + stopMacroChannels(); +} + +void Tfmx::doSong(int songPos, bool stopAudio) { assert(0 <= songPos && songPos < kNumSubsongs); Common::StackLock lock(_mutex); - // bool stopCurSong = false; - int prevSong = _playerCtx.song; + + stopPatternChannels(); + if (stopAudio) + stopMacroChannels(); _playerCtx.song = (int8)songPos; @@ -902,20 +911,18 @@ void Tfmx::doSong(int songPos) { _trackCtx.startInd = _trackCtx.posInd = _subsong[songPos].songstart; _trackCtx.stopInd = _subsong[songPos].songend; + const bool palFlag = (_resource.headerFlags & 2); const uint16 tempo = _subsong[songPos].tempo; uint16 ciaIntervall; if (tempo >= 0x10) { ciaIntervall = (uint16)(kCiaBaseInterval / tempo); _playerCtx.patternSkip = 0; } else { - ciaIntervall = kPalDefaultCiaVal; + ciaIntervall = palFlag ? kPalDefaultCiaVal : kNtscDefaultCiaVal; _playerCtx.patternSkip = tempo; } - setTimerBaseValue(kPalCiaClock); setInterruptFreqUnscaled(ciaIntervall); - stopPatternChannels(); - stopMacroChannels(); _playerCtx.patternCount = 0; while (trackStep()) ; diff --git a/sound/mods/tfmx.h b/sound/mods/tfmx.h index aa89361da8..5ca6f3cbda 100644 --- a/sound/mods/tfmx.h +++ b/sound/mods/tfmx.h @@ -46,7 +46,8 @@ public: virtual ~Tfmx(); void interrupt(); - void doSong(int songPos); + void stopSong(bool stopAudio = true); + void doSong(int songPos, bool stopAudio = false); void doSfx(int sfxIndex); void doMacro(int note, int macro, int relVol = 0, int finetune = 0, int channelNo = 0); bool load(Common::SeekableReadStream &musicData, Common::SeekableReadStream &sampleData); @@ -261,6 +262,7 @@ public: unlockMacroChannel(_channelCtx[i]); clearMacroProgramm(_channelCtx[i]); _channelCtx[i].note = 0; + _channelCtx[i].volume = 0; } } |