aboutsummaryrefslogtreecommitdiff
path: root/engines/tinsel
diff options
context:
space:
mode:
authorFabio Battaglia2009-05-24 08:27:33 +0000
committerFabio Battaglia2009-05-24 08:27:33 +0000
commit5a32f3f502de47486368dfcbbc271e167a596d44 (patch)
tree1a4e6f96e8d3ee4c53de716266f6564e769f0ee4 /engines/tinsel
parent57e104c62525a30ff3f44d1b91d1da5bae772047 (diff)
downloadscummvm-rg350-5a32f3f502de47486368dfcbbc271e167a596d44.tar.gz
scummvm-rg350-5a32f3f502de47486368dfcbbc271e167a596d44.tar.bz2
scummvm-rg350-5a32f3f502de47486368dfcbbc271e167a596d44.zip
tinsel: sound samples and speech support for Discworld PSX using VAG. Based on a patch provided by clone2727
svn-id: r40852
Diffstat (limited to 'engines/tinsel')
-rw-r--r--engines/tinsel/sound.cpp42
1 files changed, 28 insertions, 14 deletions
diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp
index 54178a898a..47b7ffc51a 100644
--- a/engines/tinsel/sound.cpp
+++ b/engines/tinsel/sound.cpp
@@ -40,6 +40,7 @@
#include "sound/mixer.h"
#include "sound/adpcm.h"
+#include "sound/vag.h"
#include "gui/message.h"
@@ -99,24 +100,37 @@ bool SoundManager::playSample(int id, Audio::Mixer::SoundType type, Audio::Sound
uint32 sampleLen = _sampleStream.readUint32LE();
if (_sampleStream.ioFailed())
error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage));
+
+ if (TinselV1PSX) {
+ // Read the stream and create a VAG Audio stream
+ Audio::AudioStream *vagStream = new Audio::VagStream(_sampleStream.readStream(sampleLen), false, 44100);
+
+ // FIXME: Should set this in a different place ;)
+ _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, volSound);
+ //_vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, soundVolumeMusic);
+ _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, volVoice);
+
+ // Play the audio stream
+ _vm->_mixer->playInputStream(type, &curChan.handle, vagStream);
+ } else {
+ // allocate a buffer
+ void *sampleBuf = malloc(sampleLen);
+ assert(sampleBuf);
- // allocate a buffer
- void *sampleBuf = malloc(sampleLen);
- assert(sampleBuf);
-
- // read all of the sample
- if (_sampleStream.read(sampleBuf, sampleLen) != sampleLen)
- error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage));
+ // read all of the sample
+ if (_sampleStream.read(sampleBuf, sampleLen) != sampleLen)
+ error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage));
- // FIXME: Should set this in a different place ;)
- _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, volSound);
- //_vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, soundVolumeMusic);
- _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, volVoice);
+ // FIXME: Should set this in a different place ;)
+ _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, volSound);
+ //_vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, soundVolumeMusic);
+ _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, volVoice);
- // play it
- _vm->_mixer->playRaw(type, &curChan.handle, sampleBuf, sampleLen, 22050,
- Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED);
+ // play it
+ _vm->_mixer->playRaw(type, &curChan.handle, sampleBuf, sampleLen, 22050,
+ Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED);
+ }
if (handle)
*handle = curChan.handle;