From 274d890f5b9430c44fdaa24a2c67faf54fd4cb18 Mon Sep 17 00:00:00 2001 From: Walter van Niftrik Date: Tue, 5 May 2009 01:51:39 +0000 Subject: SCI: Support for 0x4e control changes in new adlib driver, and some cleanup. svn-id: r40312 --- engines/sci/sfx/player/player.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'engines/sci/sfx/player/player.cpp') diff --git a/engines/sci/sfx/player/player.cpp b/engines/sci/sfx/player/player.cpp index 90d99c8092..e2ad9e5213 100644 --- a/engines/sci/sfx/player/player.cpp +++ b/engines/sci/sfx/player/player.cpp @@ -156,8 +156,12 @@ static int player_add_iterator(SongIterator *it, uint32 start_time) { SIMSG_SEND(it, SIMSG_SET_PLAYMASK(mididrv->getPlayMask())); SIMSG_SEND(it, SIMSG_SET_RHYTHM(mididrv->hasRhythmChannel())); - current_time = Audio::Timestamp(g_system->getMillis(), 1000000 / tempo); - wakeup_time = Audio::Timestamp(start_time, SFX_TICKS_PER_SEC); + if (play_it == NULL) { + // Resync with clock + current_time = Audio::Timestamp(g_system->getMillis(), 1000000 / tempo); + wakeup_time = Audio::Timestamp(start_time, SFX_TICKS_PER_SEC); + } + play_it = sfx_iterator_combine(play_it, it); play_it_done = 0; mutex->unlock(); @@ -171,9 +175,12 @@ static int player_fade_out(void) { } static int player_stop(void) { + debug(3, "Player: Stopping song iterator %p", (void *)play_it); mutex->lock(); delete play_it; play_it = NULL; + for (int i = 0; i < MIDI_CHANNELS; i++) + static_cast(mididrv)->send(0xb0 + i, SCI_MIDI_CHANNEL_NOTES_OFF, 0); mutex->unlock(); return SFX_OK; -- cgit v1.2.3