aboutsummaryrefslogtreecommitdiff
path: root/scumm/sound.cpp
diff options
context:
space:
mode:
authorTravis Howell2005-04-27 04:47:02 +0000
committerTravis Howell2005-04-27 04:47:02 +0000
commit3065bab0cbc427d5f485b6ac93890a4e9630a62f (patch)
tree2e53adf8407a8821098fc8984c46e855d100b1ca /scumm/sound.cpp
parentf28c3d14a3820fc835ac9473f55aa11640b07abc (diff)
downloadscummvm-rg350-3065bab0cbc427d5f485b6ac93890a4e9630a62f.tar.gz
scummvm-rg350-3065bab0cbc427d5f485b6ac93890a4e9630a62f.tar.bz2
scummvm-rg350-3065bab0cbc427d5f485b6ac93890a4e9630a62f.zip
Add some basic support for pjgames.
svn-id: r17831
Diffstat (limited to 'scumm/sound.cpp')
-rw-r--r--scumm/sound.cpp42
1 files changed, 26 insertions, 16 deletions
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index cfdf33e157..8226c204d7 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -703,27 +703,37 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, SoundHandle *handl
_sfxFile->seek(offset, SEEK_SET);
if (_sfxFile->readUint32LE() == TO_LE_32(MKID('WSOU'))) {
- debug(1, "IMA ADPCM compression not supported");
- return;
+ // Skip the WSOU chunk
+ _sfxFile->seek(offset + 8, SEEK_SET);
+
+ // Try to load the WAVE data into an audio stream
+ AudioStream *stream = makeWAVStream(*_sfxFile);
+ if (!stream) {
+ warning("startTalkSound: IMA ADPCM compression not supported");
+ return;
+ }
+
+ int channel = _vm->VAR(_vm->VAR_SOUND_CHANNEL);
+ _vm->_mixer->playInputStream(SoundMixer::kSFXSoundType, &_heSoundChannels[channel], stream, 1);
} else {
// Skip the TALK (8) and HSHD (24) chunks
_sfxFile->seek(28, SEEK_CUR);
- }
- if (_sfxFile->readUint32LE() == TO_LE_32(MKID('SBNG'))) {
- // Skip the SBNG, so we end up at the SDAT chunk
- size = _sfxFile->readUint32BE() - 4;
- _sfxFile->seek(size, SEEK_CUR);
- }
- size = _sfxFile->readUint32BE() - 8;
- sound = (byte *)malloc(size);
- _sfxFile->read(sound, size);
+ if (_sfxFile->readUint32LE() == TO_LE_32(MKID('SBNG'))) {
+ // Skip the SBNG, so we end up at the SDAT chunk
+ size = _sfxFile->readUint32BE() - 4;
+ _sfxFile->seek(size, SEEK_CUR);
+ }
+ size = _sfxFile->readUint32BE() - 8;
+ sound = (byte *)malloc(size);
+ _sfxFile->read(sound, size);
- if (_vm->_heversion >= 70) {
- int channel = _vm->VAR(_vm->VAR_SOUND_CHANNEL);
- _vm->_mixer->playRaw(&_heSoundChannels[channel], sound, size, 11000, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE, 1);
- } else {
- _vm->_mixer->playRaw(handle, sound, size, 11000, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
+ if (_vm->_heversion >= 70) {
+ int channel = _vm->VAR(_vm->VAR_SOUND_CHANNEL);
+ _vm->_mixer->playRaw(&_heSoundChannels[channel], sound, size, 11000, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE, 1);
+ } else {
+ _vm->_mixer->playRaw(handle, sound, size, 11000, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
+ }
}
return;
}