From 76ff84a62fcbec28b58ab14a157ec9fc74dd05d6 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 27 Jan 2010 21:11:24 +0000 Subject: Fixed the demo version of Longbow - speech was not played at all with the new sound code svn-id: r47610 --- engines/sci/sound/music.cpp | 16 ++++++++-------- engines/sci/sound/soundcmd.cpp | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'engines') diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp index 3bb3f5e8df..85088a882b 100644 --- a/engines/sci/sound/music.cpp +++ b/engines/sci/sound/music.cpp @@ -170,15 +170,15 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) { int channelFilterMask = 0; SoundResource::Track *track = pSnd->soundRes->getTrackByType(_pMidiDrv->getPlayId()); - if (track) { - // If MIDI device is selected but there is no digital track in sound resource - // try to use adlib's digital sample if possible - if (_bMultiMidi && (track->digitalChannelNr == -1)) { - SoundResource::Track *digital = pSnd->soundRes->getDigitalTrack(); - if (digital) - track = digital; - } + // If MIDI device is selected but there is no digital track in sound resource + // try to use adlib's digital sample if possible + if (_bMultiMidi && (!track || track->digitalChannelNr == -1)) { + SoundResource::Track *digital = pSnd->soundRes->getDigitalTrack(); + if (digital) + track = digital; + } + if (track) { // Play digital sample if (track->digitalChannelNr != -1) { byte *channelData = track->channels[track->digitalChannelNr].data; diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp index 7b1f108667..b9609014e7 100644 --- a/engines/sci/sound/soundcmd.cpp +++ b/engines/sci/sound/soundcmd.cpp @@ -286,6 +286,11 @@ void SoundCommandParser::cmdInitSound(reg_t obj, int16 value) { #else + // Check if a track with the same sound object is already playing + MusicEntry *oldSound = _music->getSlot(obj); + if (oldSound) + cmdDisposeSound(obj, value); + MusicEntry *newSound = new MusicEntry(); newSound->resnum = number; if (number && _resMan->testResource(ResourceId(kResourceTypeSound, number))) @@ -299,11 +304,6 @@ void SoundCommandParser::cmdInitSound(reg_t obj, int16 value) { if (_soundVersion >= SCI_VERSION_1_LATE) newSound->volume = CLIP(GET_SEL32V(_segMan, obj, vol), 0, MUSIC_VOLUME_MAX); - // Check if a track with the same sound object is already playing - MusicEntry *oldSound = _music->getSlot(obj); - if (oldSound) - cmdDisposeSound(obj, value); - // In SCI1.1 games, sound effects are started from here. If we can find // a relevant audio resource, play it, otherwise switch to synthesized // effects. If the resource exists, play it using map 65535 (sound -- cgit v1.2.3