[Scummvm-cvs-logs] SF.net SVN: scummvm:[40852] scummvm/trunk/engines/tinsel/sound.cpp
Hkz at users.sourceforge.net
Hkz at users.sourceforge.net
Sun May 24 10:27:34 CEST 2009
Revision: 40852
http://scummvm.svn.sourceforge.net/scummvm/?rev=40852&view=rev
Author: Hkz
Date: 2009-05-24 08:27:33 +0000 (Sun, 24 May 2009)
Log Message:
-----------
tinsel: sound samples and speech support for Discworld PSX using VAG. Based on a patch provided by clone2727
Modified Paths:
--------------
scummvm/trunk/engines/tinsel/sound.cpp
Modified: scummvm/trunk/engines/tinsel/sound.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/sound.cpp 2009-05-24 04:29:44 UTC (rev 40851)
+++ scummvm/trunk/engines/tinsel/sound.cpp 2009-05-24 08:27:33 UTC (rev 40852)
@@ -40,6 +40,7 @@
#include "sound/mixer.h"
#include "sound/adpcm.h"
+#include "sound/vag.h"
#include "gui/message.h"
@@ -99,25 +100,38 @@
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;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list