mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 12:39:56 +00:00
- 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
@ -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
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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++;
|
||||
|
@ -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++;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user