mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-31 07:53:36 +00:00
Insert preliminary Zak256 sound looping support. It's not perfect, as some Zak256 sounds only loop a part of the sample - which our mixer API doesn't yet support.
svn-id: r8741
This commit is contained in:
parent
0ed8e1ef36
commit
093a31839b
@ -370,6 +370,8 @@ void Sound::playSound(int soundID) {
|
||||
#endif
|
||||
rate = 11000;
|
||||
int type = *(ptr + 0x0D);
|
||||
int loop_start = READ_LE_UINT32(ptr+0x26);
|
||||
int loop_end = READ_LE_UINT32(ptr+0x2A);
|
||||
|
||||
// Check if it is a CD playback resource
|
||||
if (type == 2) {
|
||||
@ -399,8 +401,15 @@ void Sound::playSound(int soundID) {
|
||||
sound[x] = bit;
|
||||
}
|
||||
|
||||
// FIXME: Maybe something in the header signifies looping? Need to
|
||||
// track it down and add a mixer flag or something.
|
||||
if (loop_end > 0) {
|
||||
flags |= SoundMixer::FLAG_LOOP;
|
||||
|
||||
if ((loop_end < size) || (loop_start > 0)) {
|
||||
// FIXME: Implement partial loops
|
||||
warning("Partial loops not implemented. Loop at 0x%X thru 0x%X", loop_start, loop_end);
|
||||
}
|
||||
}
|
||||
|
||||
_scumm->_mixer->playRaw(NULL, sound, size, 11000, flags, soundID);
|
||||
return;
|
||||
}
|
||||
@ -724,7 +733,9 @@ void Sound::stopSound(int a) {
|
||||
stopCD();
|
||||
}
|
||||
|
||||
if (_scumm->_imuseDigital) {
|
||||
if (_scumm->_gameId == GID_ZAK256) {
|
||||
_scumm->_mixer->stopID(a);
|
||||
} else if (_scumm->_imuseDigital) {
|
||||
_scumm->_imuseDigital->stopSound(a);
|
||||
} else if (_scumm->_imuse) {
|
||||
_scumm->_imuse->stopSound(a);
|
||||
|
@ -229,6 +229,11 @@ int SoundMixer::insertChannel(PlayingSoundHandle *handle, Channel *chan) {
|
||||
}
|
||||
|
||||
int SoundMixer::playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, int id) {
|
||||
// Prevent duplicate sounds
|
||||
for (int i = 0; i != NUM_CHANNELS; i++)
|
||||
if (_channels[i] != NULL && _channels[i]->_id == id)
|
||||
return -1;
|
||||
|
||||
return insertChannel(handle, new ChannelRaw(this, sound, size, rate, flags, id));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user