aboutsummaryrefslogtreecommitdiff
path: root/scumm/sound.cpp
diff options
context:
space:
mode:
authorTravis Howell2005-05-08 14:31:27 +0000
committerTravis Howell2005-05-08 14:31:27 +0000
commit01b2f3867093cae9626126ce35bd2731a7072c6a (patch)
treee1555496b97df3b005e4b5bab0a2cb78894ffb58 /scumm/sound.cpp
parenta81b093e65f90ea70c5b07676a1fcc46d3e95a5e (diff)
downloadscummvm-rg350-01b2f3867093cae9626126ce35bd2731a7072c6a.tar.gz
scummvm-rg350-01b2f3867093cae9626126ce35bd2731a7072c6a.tar.bz2
scummvm-rg350-01b2f3867093cae9626126ce35bd2731a7072c6a.zip
HE games queue speech as sound resource 1.
svn-id: r17965
Diffstat (limited to 'scumm/sound.cpp')
-rw-r--r--scumm/sound.cpp58
1 files changed, 16 insertions, 42 deletions
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 4932ed41d1..68e3c3d066 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -648,10 +648,24 @@ static int compareMP3OffsetTable(const void *a, const void *b) {
return ((const MP3OffsetTable *)a)->org_offset - ((const MP3OffsetTable *)b)->org_offset;
}
+void Sound::startHETalkSound(uint32 offset) {
+ byte *ptr;
+ int32 size;
+
+ _vm->res.nukeResource(rtSound, 1);
+ _sfxFile->seek(offset + 4, SEEK_SET);
+ size = _sfxFile->readUint32BE() - 8;
+ _vm->res.createResource(rtSound, 1, size);
+ ptr = _vm->getResourceAddress(rtSound, 1);
+ _sfxFile->read(ptr, size);
+
+ int channel = (_vm->VAR_SOUND_CHANNEL != 0xFF) ? _vm->VAR(_vm->VAR_SOUND_CHANNEL) : 0;
+ addSoundToQueue2(1, 0, channel, 0);
+}
+
void Sound::startTalkSound(uint32 offset, uint32 b, int mode, SoundHandle *handle) {
int num = 0, i;
int size = 0;
- byte *sound;
int id = -1;
if (_vm->_gameId == GID_CMI) {
@@ -704,46 +718,6 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, SoundHandle *handl
return;
}
- if (_vm->_heversion >= 60) {
- _sfxMode |= mode;
-
- _sfxFile->seek(offset, SEEK_SET);
- if (_sfxFile->readUint32LE() == TO_LE_32(MKID('WSOU'))) {
- // 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 (_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;
- }
-
// Some games frequently assume that starting one sound effect will
// automatically stop any other that may be playing at that time. So
// that is what we do here, but we make an exception for speech.
@@ -836,7 +810,7 @@ void Sound::stopTalkSound() {
if (_sfxMode & 2) {
if (_vm->_imuseDigital) {
_vm->_imuseDigital->stopSound(kTalkSoundID);
- } else if (_vm->_heversion >= 70) {
+ } else if (_vm->_heversion >= 60) {
_vm->_mixer->stopID(1);
} else {
_vm->_mixer->stopHandle(_talkChannelHandle);