mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 05:38:56 +00:00
The two unknown fields point to the beginning and end of the sound sample
svn-id: r47601
This commit is contained in:
parent
0f0e123e5a
commit
1ddcd178c2
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user