- 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
This commit is contained in:
parent
16eff8660d
commit
113c0941ae
5 changed files with 28 additions and 26 deletions
|
@ -479,10 +479,13 @@ bool EngineState::autoDetectFeature(FeatureDetection featureDetection, int metho
|
||||||
|
|
||||||
SciVersion EngineState::detectDoSoundType() {
|
SciVersion EngineState::detectDoSoundType() {
|
||||||
if (_doSoundType == SCI_VERSION_AUTODETECT) {
|
if (_doSoundType == SCI_VERSION_AUTODETECT) {
|
||||||
if (_kernel->_selectorCache.nodePtr == -1) {
|
if (getSciVersion() == SCI_VERSION_0_EARLY) {
|
||||||
// No nodePtr selector, so this game is definitely using
|
// This game is using early SCI0 sound code (different headers than SCI0 late)
|
||||||
// SCI0 sound code (i.e. SCI_VERSION_0_EARLY)
|
|
||||||
_doSoundType = SCI_VERSION_0_EARLY;
|
_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 {
|
} else {
|
||||||
if (getSciVersion() >= SCI_VERSION_1_LATE) {
|
if (getSciVersion() >= SCI_VERSION_1_LATE) {
|
||||||
// All SCI1 late games use the newer doSound semantics
|
// All SCI1 late games use the newer doSound semantics
|
||||||
|
|
|
@ -239,7 +239,8 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autodetects the DoSound type
|
* 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();
|
SciVersion detectDoSoundType();
|
||||||
|
|
||||||
|
|
|
@ -1821,6 +1821,7 @@ SoundResource::SoundResource(uint32 resNumber, ResourceManager *resMan, SciVersi
|
||||||
|
|
||||||
switch (_soundVersion) {
|
switch (_soundVersion) {
|
||||||
case SCI_VERSION_0_EARLY:
|
case SCI_VERSION_0_EARLY:
|
||||||
|
case SCI_VERSION_0_LATE:
|
||||||
_trackCount = 1;
|
_trackCount = 1;
|
||||||
_tracks = new Track[_trackCount];
|
_tracks = new Track[_trackCount];
|
||||||
_tracks->nDigital = 0xFF;
|
_tracks->nDigital = 0xFF;
|
||||||
|
@ -1907,7 +1908,7 @@ SoundResource::~SoundResource() {
|
||||||
}
|
}
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
SoundResource::Track* SoundResource::getTrackByNumber(uint16 number) {
|
SoundResource::Track* SoundResource::getTrackByNumber(uint16 number) {
|
||||||
if (_soundVersion == SCI_VERSION_0_EARLY)
|
if (_soundVersion <= SCI_VERSION_0_LATE)
|
||||||
return &_tracks[0];
|
return &_tracks[0];
|
||||||
|
|
||||||
if (/*number >= 0 &&*/number < _trackCount)
|
if (/*number >= 0 &&*/number < _trackCount)
|
||||||
|
@ -1916,7 +1917,7 @@ SoundResource::Track* SoundResource::getTrackByNumber(uint16 number) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SoundResource::Track* SoundResource::getTrackByType(TrackType type) {
|
SoundResource::Track* SoundResource::getTrackByType(TrackType type) {
|
||||||
if (_soundVersion == SCI_VERSION_0_EARLY)
|
if (_soundVersion <= SCI_VERSION_0_LATE)
|
||||||
return &_tracks[0];
|
return &_tracks[0];
|
||||||
|
|
||||||
for (int trackNr = 0; trackNr < _trackCount; trackNr++) {
|
for (int trackNr = 0; trackNr < _trackCount; trackNr++) {
|
||||||
|
@ -1931,7 +1932,7 @@ int SoundResource::getChannelFilterMask(int hardwareMask) {
|
||||||
byte *data = _innerResource->data;
|
byte *data = _innerResource->data;
|
||||||
int channelMask = 0;
|
int channelMask = 0;
|
||||||
|
|
||||||
if (_soundVersion == SCI_VERSION_0_EARLY) {
|
if (_soundVersion <= SCI_VERSION_0_LATE) {
|
||||||
data++; // Skip over digital sample flag
|
data++; // Skip over digital sample flag
|
||||||
for (int channelNr = 0; channelNr < 16; channelNr++) {
|
for (int channelNr = 0; channelNr < 16; channelNr++) {
|
||||||
data++;
|
data++;
|
||||||
|
|
|
@ -611,6 +611,7 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) {
|
||||||
if (info.basic.param1 == 0x60) {
|
if (info.basic.param1 == 0x60) {
|
||||||
switch (_soundVersion) {
|
switch (_soundVersion) {
|
||||||
case SCI_VERSION_0_EARLY:
|
case SCI_VERSION_0_EARLY:
|
||||||
|
case SCI_VERSION_0_LATE:
|
||||||
_pSnd->dataInc += info.basic.param2;
|
_pSnd->dataInc += info.basic.param2;
|
||||||
_signalSet = true;
|
_signalSet = true;
|
||||||
_signalToSet = 0x7f + _pSnd->dataInc;
|
_signalToSet = 0x7f + _pSnd->dataInc;
|
||||||
|
@ -835,22 +836,22 @@ byte *MidiParser_SCI::midiFilterChannels(int channelMask) {
|
||||||
}
|
}
|
||||||
if ((1 << curChannel) & channelMask) {
|
if ((1 << curChannel) & channelMask) {
|
||||||
if (command != 0xFC) {
|
if (command != 0xFC) {
|
||||||
printf("\nDELTA ");
|
debugC(2, kDebugLevelSound, "\nDELTA ");
|
||||||
// Write delta
|
// Write delta
|
||||||
while (delta > 240) {
|
while (delta > 240) {
|
||||||
*filterData++ = 0xF8;
|
*filterData++ = 0xF8;
|
||||||
printf("F8 ");
|
debugC(2, kDebugLevelSound, "F8 ");
|
||||||
delta -= 240;
|
delta -= 240;
|
||||||
}
|
}
|
||||||
*filterData++ = (byte)delta;
|
*filterData++ = (byte)delta;
|
||||||
printf("%02X ", delta);
|
debugC(2, kDebugLevelSound, "%02X ", delta);
|
||||||
delta = 0;
|
delta = 0;
|
||||||
}
|
}
|
||||||
// Write command
|
// Write command
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case 0xF0: // sysEx
|
case 0xF0: // sysEx
|
||||||
*filterData++ = command;
|
*filterData++ = command;
|
||||||
printf("%02X ", command);
|
debugC(2, kDebugLevelSound, "%02X ", command);
|
||||||
do {
|
do {
|
||||||
curByte = *channelData++;
|
curByte = *channelData++;
|
||||||
*filterData++ = curByte; // out
|
*filterData++ = curByte; // out
|
||||||
|
@ -864,20 +865,20 @@ byte *MidiParser_SCI::midiFilterChannels(int channelMask) {
|
||||||
default: // MIDI command
|
default: // MIDI command
|
||||||
if (lastCommand != command) {
|
if (lastCommand != command) {
|
||||||
*filterData++ = command;
|
*filterData++ = command;
|
||||||
printf("%02X ", command);
|
debugC(2, kDebugLevelSound, "%02X ", command);
|
||||||
lastCommand = command;
|
lastCommand = command;
|
||||||
}
|
}
|
||||||
if (midiParamCount > 0) {
|
if (midiParamCount > 0) {
|
||||||
if (curByte & 0x80) {
|
if (curByte & 0x80) {
|
||||||
printf("%02X ", *channelData);
|
debugC(2, kDebugLevelSound, "%02X ", *channelData);
|
||||||
*filterData++ = *channelData++;
|
*filterData++ = *channelData++;
|
||||||
} else {
|
} else {
|
||||||
printf("%02X ", curByte);
|
debugC(2, kDebugLevelSound, "%02X ", curByte);
|
||||||
*filterData++ = curByte;
|
*filterData++ = curByte;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (midiParamCount > 1) {
|
if (midiParamCount > 1) {
|
||||||
printf("%02X ", *channelData);
|
debugC(2, kDebugLevelSound, "%02X ", *channelData);
|
||||||
*filterData++ = *channelData++;
|
*filterData++ = *channelData++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,14 +101,14 @@ void process_sound_events(EngineState *s) { /* Get all sound events, apply their
|
||||||
case SI_RELATIVE_CUE:
|
case SI_RELATIVE_CUE:
|
||||||
debugC(2, kDebugLevelSound, "[process-sound] Song %04x:%04x received relative cue %d\n",
|
debugC(2, kDebugLevelSound, "[process-sound] Song %04x:%04x received relative cue %d\n",
|
||||||
PRINT_REG(obj), cue);
|
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);
|
PUT_SEL32V(segMan, obj, signal, cue + 0x7f);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SI_ABSOLUTE_CUE:
|
case SI_ABSOLUTE_CUE:
|
||||||
debugC(2, kDebugLevelSound, "[process-sound] Song %04x:%04x received absolute cue %d\n",
|
debugC(2, kDebugLevelSound, "[process-sound] Song %04x:%04x received absolute cue %d\n",
|
||||||
PRINT_REG(obj), cue);
|
PRINT_REG(obj), cue);
|
||||||
printf("abs-signal %04X\n", cue);
|
debugC(2, kDebugLevelSound, "abs-signal %04X\n", cue);
|
||||||
PUT_SEL32V(segMan, obj, signal, cue);
|
PUT_SEL32V(segMan, obj, signal, cue);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -145,6 +145,7 @@ SoundCommandParser::SoundCommandParser(ResourceManager *resMan, SegManager *segM
|
||||||
|
|
||||||
switch (_soundVersion) {
|
switch (_soundVersion) {
|
||||||
case SCI_VERSION_0_EARLY:
|
case SCI_VERSION_0_EARLY:
|
||||||
|
case SCI_VERSION_0_LATE:
|
||||||
SOUNDCOMMAND(cmdInitHandle);
|
SOUNDCOMMAND(cmdInitHandle);
|
||||||
SOUNDCOMMAND(cmdPlayHandle);
|
SOUNDCOMMAND(cmdPlayHandle);
|
||||||
SOUNDCOMMAND(cmdDummy);
|
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]->loop = GET_SEL32V(_segMan, obj, loop) == 0xFFFF ? 1 : 0;
|
||||||
_music->_playList[slot]->prio = GET_SEL32V(_segMan, obj, priority);
|
_music->_playList[slot]->prio = GET_SEL32V(_segMan, obj, priority);
|
||||||
// vol selector doesnt get used before sci1late
|
// vol selector doesnt get used before sci1late
|
||||||
switch (_soundVersion) {
|
if (_soundVersion < SCI_VERSION_1_LATE)
|
||||||
case SCI_VERSION_0_EARLY:
|
|
||||||
case SCI_VERSION_1_EARLY:
|
|
||||||
_music->_playList[slot]->volume = 100;
|
_music->_playList[slot]->volume = 100;
|
||||||
break;
|
else
|
||||||
case SCI_VERSION_1_LATE:
|
|
||||||
_music->_playList[slot]->volume = GET_SEL32V(_segMan, obj, vol);
|
_music->_playList[slot]->volume = GET_SEL32V(_segMan, obj, vol);
|
||||||
break;
|
|
||||||
}
|
|
||||||
_music->soundPlay(_music->_playList[slot]);
|
_music->soundPlay(_music->_playList[slot]);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -688,7 +684,7 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) {
|
||||||
case SI_ABSOLUTE_CUE:
|
case SI_ABSOLUTE_CUE:
|
||||||
debugC(2, kDebugLevelSound, "--- [CUE] %04x:%04x Absolute Cue: %d\n",
|
debugC(2, kDebugLevelSound, "--- [CUE] %04x:%04x Absolute Cue: %d\n",
|
||||||
PRINT_REG(obj), signal);
|
PRINT_REG(obj), signal);
|
||||||
printf("abs-signal %04X\n", signal);
|
debugC(2, kDebugLevelSound, "abs-signal %04X\n", signal);
|
||||||
PUT_SEL32V(_segMan, obj, signal, signal);
|
PUT_SEL32V(_segMan, obj, signal, signal);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -700,7 +696,7 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) {
|
||||||
* below, with proper storage of dataInc and
|
* below, with proper storage of dataInc and
|
||||||
* signal in the iterator code. */
|
* signal in the iterator code. */
|
||||||
PUT_SEL32V(_segMan, obj, dataInc, signal);
|
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)
|
if (_soundVersion == SCI_VERSION_1_EARLY)
|
||||||
PUT_SEL32V(_segMan, obj, signal, signal);
|
PUT_SEL32V(_segMan, obj, signal, signal);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue