diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/resource.cpp | 15 | ||||
-rw-r--r-- | engines/sci/resource.h | 6 | ||||
-rw-r--r-- | engines/sci/sound/music.cpp | 5 |
3 files changed, 14 insertions, 12 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 81b8359655..7af7dbd685 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -2001,6 +2001,8 @@ SoundResource::SoundResource(uint32 resNumber, ResourceManager *resMan, SciVersi //Offset 14 in the header contains the frequency as a short integer. Offset 32 contains the sample length, also as a short integer. _tracks->digitalSampleRate = READ_LE_UINT16(sampleChannel->data + 14); _tracks->digitalSampleSize = READ_LE_UINT16(sampleChannel->data + 32); + _tracks->digitalSampleStart = 0; + _tracks->digitalSampleEnd = 0; sampleChannel->data += 44; // Skip over header sampleChannel->size -= 44; } @@ -2037,6 +2039,8 @@ SoundResource::SoundResource(uint32 resNumber, ResourceManager *resMan, SciVersi _tracks[trackNr].digitalChannelNr = -1; // No digital sound associated _tracks[trackNr].digitalSampleRate = 0; _tracks[trackNr].digitalSampleSize = 0; + _tracks[trackNr].digitalSampleStart = 0; + _tracks[trackNr].digitalSampleEnd = 0; if (_tracks[trackNr].type != 0xF0) { // Digital track marker - not supported currently for (channelNr = 0; channelNr < _tracks[trackNr].channelCount; channelNr++) { channel = &_tracks[trackNr].channels[channelNr]; @@ -2050,15 +2054,8 @@ SoundResource::SoundResource(uint32 resNumber, ResourceManager *resMan, SciVersi _tracks[trackNr].digitalChannelNr = channelNr; _tracks[trackNr].digitalSampleRate = READ_LE_UINT16(channel->data); _tracks[trackNr].digitalSampleSize = READ_LE_UINT16(channel->data + 2); - uint16 unk2 = READ_LE_UINT16(channel->data + 4); - uint16 unkSize = READ_LE_UINT16(channel->data + 6); - if (unk2 != 0) - warning("Unknown sound field isn't 0 (it's %d), " - "sound might be compressed. Sound size: %d, " - "unknown size: %d", unk2, _tracks[trackNr].digitalSampleSize, unkSize); - - //assert(READ_LE_UINT16(channel->data + 4) == 0); // Possibly a compression flag - //assert(READ_LE_UINT16(channelData + 6) == size - 1); + _tracks[trackNr].digitalSampleStart = READ_LE_UINT16(channel->data + 4); + _tracks[trackNr].digitalSampleEnd = READ_LE_UINT16(channel->data + 6); channel->data += 8; // Skip over header channel->size -= 8; } diff --git a/engines/sci/resource.h b/engines/sci/resource.h index a5d35ea983..e8e6bd832d 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -464,8 +464,10 @@ public: byte channelCount; Channel *channels; int16 digitalChannelNr; - int digitalSampleRate; - uint32 digitalSampleSize; + uint16 digitalSampleRate; + uint16 digitalSampleSize; + uint16 digitalSampleStart; + uint16 digitalSampleEnd; }; public: SoundResource(uint32 resNumber, ResourceManager *resMan, SciVersion soundVersion); diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp index 740c3c43a5..3bb3f5e8df 100644 --- a/engines/sci/sound/music.cpp +++ b/engines/sci/sound/music.cpp @@ -187,7 +187,10 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) { // Amiga SCI1 games had signed sound data if (_soundVersion >= SCI_VERSION_1_EARLY && ((SciEngine *)g_engine)->getPlatform() == Common::kPlatformAmiga) flags = 0; - pSnd->pStreamAud = Audio::makeRawMemoryStream(channelData, track->digitalSampleSize, track->digitalSampleRate, flags, DisposeAfterUse::NO); + int endPart = track->digitalSampleEnd > 0 ? (track->digitalSampleSize - track->digitalSampleEnd) : 0; + pSnd->pStreamAud = Audio::makeRawMemoryStream(channelData + track->digitalSampleStart, + track->digitalSampleSize - track->digitalSampleStart - endPart, + track->digitalSampleRate, flags, DisposeAfterUse::NO); delete pSnd->pLoopStream; pSnd->pLoopStream = 0; pSnd->soundType = Audio::Mixer::kSFXSoundType; |