aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/he/sound_he.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2011-11-02 23:56:45 +0100
committerJohannes Schickel2011-11-06 13:33:55 +0100
commit09708f7224cc388ef45ec570a477a8ace0e61bec (patch)
treebf560850c9ff6b8bccd70f86f665bd137c850f1b /engines/scumm/he/sound_he.cpp
parent9fa9f68789ef51e078cb8631e06bead13cae13f2 (diff)
downloadscummvm-rg350-09708f7224cc388ef45ec570a477a8ace0e61bec.tar.gz
scummvm-rg350-09708f7224cc388ef45ec570a477a8ace0e61bec.tar.bz2
scummvm-rg350-09708f7224cc388ef45ec570a477a8ace0e61bec.zip
SCUMM: Stream sfx/voice sounds from mouster.sou.
This fixes sound corruption when using the new VOC streaming code. It also reduces the runtime memory needed for compressed sound files slightly, since it does not preload them into memory anymore. This comes at the expense of one file descriptor needed per sfx being played though. Thanks to Kirben for his review and feedback.
Diffstat (limited to 'engines/scumm/he/sound_he.cpp')
-rw-r--r--engines/scumm/he/sound_he.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp
index 5c15a85929..85e2a2f1dd 100644
--- a/engines/scumm/he/sound_he.cpp
+++ b/engines/scumm/he/sound_he.cpp
@@ -770,24 +770,30 @@ void SoundHE::startHETalkSound(uint32 offset) {
if (ConfMan.getBool("speech_mute"))
return;
- assert(_sfxFile);
- if (!_sfxFile->isOpen()) {
+ if (_sfxFilename.empty()) {
// This happens in the Pajama Sam's Lost & Found demo, on the
// main menu screen, so don't make it a fatal error.
- warning("startHETalkSound: Speech file is not open");
+ warning("startHETalkSound: Speech file is not found");
return;
}
+ ScummFile file;
+ if (!_vm->openFile(file, _sfxFilename)) {
+ warning("startHETalkSound: Could not open speech file %s", _sfxFilename.c_str());
+ return;
+ }
+ file.setEnc(_sfxFileEncByte);
+
_sfxMode |= 2;
_vm->_res->nukeResource(rtSound, 1);
- _sfxFile->seek(offset + 4, SEEK_SET);
- size = _sfxFile->readUint32BE();
- _sfxFile->seek(offset, SEEK_SET);
+ file.seek(offset + 4, SEEK_SET);
+ size = file.readUint32BE();
+ file.seek(offset, SEEK_SET);
_vm->_res->createResource(rtSound, 1, size);
ptr = _vm->getResourceAddress(rtSound, 1);
- _sfxFile->read(ptr, size);
+ file.read(ptr, size);
int channel = (_vm->VAR_TALK_CHANNEL != 0xFF) ? _vm->VAR(_vm->VAR_TALK_CHANNEL) : 0;
addSoundToQueue2(1, 0, channel, 0);