diff options
author | Filippos Karapetis | 2009-12-25 18:15:16 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-12-25 18:15:16 +0000 |
commit | 113c0941ae8d79f23eb6ea54aaf9e784ecd670cd (patch) | |
tree | f67c431efd0fdf3c6a3686ddfd6ab98ac14966f9 /engines | |
parent | 16eff8660dce2d60cfe5291041bbf618f149766c (diff) | |
download | scummvm-rg350-113c0941ae8d79f23eb6ea54aaf9e784ecd670cd.tar.gz scummvm-rg350-113c0941ae8d79f23eb6ea54aaf9e784ecd670cd.tar.bz2 scummvm-rg350-113c0941ae8d79f23eb6ea54aaf9e784ecd670cd.zip |
- Introduced a new version in the sound version detection routine, as SCI0 early games had different sound than SCI0 late ones
- Changed sound-related debug output from printf's into debugC calls
svn-id: r46560
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/state.cpp | 9 | ||||
-rw-r--r-- | engines/sci/engine/state.h | 3 | ||||
-rw-r--r-- | engines/sci/resource.cpp | 7 | ||||
-rw-r--r-- | engines/sci/sfx/music.cpp | 17 | ||||
-rw-r--r-- | engines/sci/sfx/soundcmd.cpp | 18 |
5 files changed, 28 insertions, 26 deletions
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp index a46dcf35c9..4cc830cb02 100644 --- a/engines/sci/engine/state.cpp +++ b/engines/sci/engine/state.cpp @@ -479,10 +479,13 @@ bool EngineState::autoDetectFeature(FeatureDetection featureDetection, int metho SciVersion EngineState::detectDoSoundType() { if (_doSoundType == SCI_VERSION_AUTODETECT) { - if (_kernel->_selectorCache.nodePtr == -1) { - // No nodePtr selector, so this game is definitely using - // SCI0 sound code (i.e. SCI_VERSION_0_EARLY) + if (getSciVersion() == SCI_VERSION_0_EARLY) { + // This game is using early SCI0 sound code (different headers than SCI0 late) _doSoundType = SCI_VERSION_0_EARLY; + } else if (_kernel->_selectorCache.nodePtr == -1) { + // No nodePtr selector, so this game is definitely using newer + // SCI0 sound code (i.e. SCI_VERSION_0_LATE) + _doSoundType = SCI_VERSION_0_LATE; } else { if (getSciVersion() >= SCI_VERSION_1_LATE) { // All SCI1 late games use the newer doSound semantics diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index 053fc51f18..69006710ad 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -239,7 +239,8 @@ public: /** * Autodetects the DoSound type - * @return DoSound type, SCI_VERSION_0_EARLY / SCI_VERSION_1_EARLY / SCI_VERSION_1_LATE + * @return DoSound type, SCI_VERSION_0_EARLY / SCI_VERSION_0_LATE / + * SCI_VERSION_1_EARLY / SCI_VERSION_1_LATE */ SciVersion detectDoSoundType(); diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index f09bc5e54b..d7f08187e6 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -1821,6 +1821,7 @@ SoundResource::SoundResource(uint32 resNumber, ResourceManager *resMan, SciVersi switch (_soundVersion) { case SCI_VERSION_0_EARLY: + case SCI_VERSION_0_LATE: _trackCount = 1; _tracks = new Track[_trackCount]; _tracks->nDigital = 0xFF; @@ -1907,7 +1908,7 @@ SoundResource::~SoundResource() { } //---------------------------------------------------- SoundResource::Track* SoundResource::getTrackByNumber(uint16 number) { - if (_soundVersion == SCI_VERSION_0_EARLY) + if (_soundVersion <= SCI_VERSION_0_LATE) return &_tracks[0]; if (/*number >= 0 &&*/number < _trackCount) @@ -1916,7 +1917,7 @@ SoundResource::Track* SoundResource::getTrackByNumber(uint16 number) { } SoundResource::Track* SoundResource::getTrackByType(TrackType type) { - if (_soundVersion == SCI_VERSION_0_EARLY) + if (_soundVersion <= SCI_VERSION_0_LATE) return &_tracks[0]; for (int trackNr = 0; trackNr < _trackCount; trackNr++) { @@ -1931,7 +1932,7 @@ int SoundResource::getChannelFilterMask(int hardwareMask) { byte *data = _innerResource->data; int channelMask = 0; - if (_soundVersion == SCI_VERSION_0_EARLY) { + if (_soundVersion <= SCI_VERSION_0_LATE) { data++; // Skip over digital sample flag for (int channelNr = 0; channelNr < 16; channelNr++) { data++; diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp index 0426b40dd6..b98004b06f 100644 --- a/engines/sci/sfx/music.cpp +++ b/engines/sci/sfx/music.cpp @@ -611,6 +611,7 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) { if (info.basic.param1 == 0x60) { switch (_soundVersion) { case SCI_VERSION_0_EARLY: + case SCI_VERSION_0_LATE: _pSnd->dataInc += info.basic.param2; _signalSet = true; _signalToSet = 0x7f + _pSnd->dataInc; @@ -835,22 +836,22 @@ byte *MidiParser_SCI::midiFilterChannels(int channelMask) { } if ((1 << curChannel) & channelMask) { if (command != 0xFC) { - printf("\nDELTA "); + debugC(2, kDebugLevelSound, "\nDELTA "); // Write delta while (delta > 240) { *filterData++ = 0xF8; - printf("F8 "); + debugC(2, kDebugLevelSound, "F8 "); delta -= 240; } *filterData++ = (byte)delta; - printf("%02X ", delta); + debugC(2, kDebugLevelSound, "%02X ", delta); delta = 0; } // Write command switch (command) { case 0xF0: // sysEx *filterData++ = command; - printf("%02X ", command); + debugC(2, kDebugLevelSound, "%02X ", command); do { curByte = *channelData++; *filterData++ = curByte; // out @@ -864,20 +865,20 @@ byte *MidiParser_SCI::midiFilterChannels(int channelMask) { default: // MIDI command if (lastCommand != command) { *filterData++ = command; - printf("%02X ", command); + debugC(2, kDebugLevelSound, "%02X ", command); lastCommand = command; } if (midiParamCount > 0) { if (curByte & 0x80) { - printf("%02X ", *channelData); + debugC(2, kDebugLevelSound, "%02X ", *channelData); *filterData++ = *channelData++; } else { - printf("%02X ", curByte); + debugC(2, kDebugLevelSound, "%02X ", curByte); *filterData++ = curByte; } } if (midiParamCount > 1) { - printf("%02X ", *channelData); + debugC(2, kDebugLevelSound, "%02X ", *channelData); *filterData++ = *channelData++; } } diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp index b4773bd984..0fa0f8c3a3 100644 --- a/engines/sci/sfx/soundcmd.cpp +++ b/engines/sci/sfx/soundcmd.cpp @@ -101,14 +101,14 @@ void process_sound_events(EngineState *s) { /* Get all sound events, apply their case SI_RELATIVE_CUE: debugC(2, kDebugLevelSound, "[process-sound] Song %04x:%04x received relative cue %d\n", PRINT_REG(obj), cue); - printf("rel-signal %04X\n", cue + 0x7f); + debugC(2, kDebugLevelSound, "rel-signal %04X\n", cue + 0x7f); PUT_SEL32V(segMan, obj, signal, cue + 0x7f); break; case SI_ABSOLUTE_CUE: debugC(2, kDebugLevelSound, "[process-sound] Song %04x:%04x received absolute cue %d\n", PRINT_REG(obj), cue); - printf("abs-signal %04X\n", cue); + debugC(2, kDebugLevelSound, "abs-signal %04X\n", cue); PUT_SEL32V(segMan, obj, signal, cue); break; @@ -145,6 +145,7 @@ SoundCommandParser::SoundCommandParser(ResourceManager *resMan, SegManager *segM switch (_soundVersion) { case SCI_VERSION_0_EARLY: + case SCI_VERSION_0_LATE: SOUNDCOMMAND(cmdInitHandle); SOUNDCOMMAND(cmdPlayHandle); SOUNDCOMMAND(cmdDummy); @@ -415,15 +416,10 @@ void SoundCommandParser::cmdPlayHandle(reg_t obj, int16 value) { _music->_playList[slot]->loop = GET_SEL32V(_segMan, obj, loop) == 0xFFFF ? 1 : 0; _music->_playList[slot]->prio = GET_SEL32V(_segMan, obj, priority); // vol selector doesnt get used before sci1late - switch (_soundVersion) { - case SCI_VERSION_0_EARLY: - case SCI_VERSION_1_EARLY: + if (_soundVersion < SCI_VERSION_1_LATE) _music->_playList[slot]->volume = 100; - break; - case SCI_VERSION_1_LATE: + else _music->_playList[slot]->volume = GET_SEL32V(_segMan, obj, vol); - break; - } _music->soundPlay(_music->_playList[slot]); #endif @@ -688,7 +684,7 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) { case SI_ABSOLUTE_CUE: debugC(2, kDebugLevelSound, "--- [CUE] %04x:%04x Absolute Cue: %d\n", PRINT_REG(obj), signal); - printf("abs-signal %04X\n", signal); + debugC(2, kDebugLevelSound, "abs-signal %04X\n", signal); PUT_SEL32V(_segMan, obj, signal, signal); break; @@ -700,7 +696,7 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) { * below, with proper storage of dataInc and * signal in the iterator code. */ PUT_SEL32V(_segMan, obj, dataInc, signal); - printf("rel-signal %04X\n", signal); + debugC(2, kDebugLevelSound, "rel-signal %04X\n", signal); if (_soundVersion == SCI_VERSION_1_EARLY) PUT_SEL32V(_segMan, obj, signal, signal); else |