diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tinsel/sound.cpp | 42 |
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; |