aboutsummaryrefslogtreecommitdiff
path: root/engines/cge
diff options
context:
space:
mode:
authorStrangerke2011-09-06 21:58:41 +0200
committerStrangerke2011-09-06 21:58:41 +0200
commit85d10fe6c7fb249bdb0e349fba5f4d46dce464e4 (patch)
tree95e4467c2d634ebef1f3bfe3f7e22211d49b692a /engines/cge
parente46c613e9a06828ede0001b8e4e7db1bef65d433 (diff)
downloadscummvm-rg350-85d10fe6c7fb249bdb0e349fba5f4d46dce464e4.tar.gz
scummvm-rg350-85d10fe6c7fb249bdb0e349fba5f4d46dce464e4.tar.bz2
scummvm-rg350-85d10fe6c7fb249bdb0e349fba5f4d46dce464e4.zip
CGE: Handle properly looping samples
Diffstat (limited to 'engines/cge')
-rw-r--r--engines/cge/snddrv.h2
-rw-r--r--engines/cge/sound.cpp6
2 files changed, 5 insertions, 3 deletions
diff --git a/engines/cge/snddrv.h b/engines/cge/snddrv.h
index 987582190c..93793de2fe 100644
--- a/engines/cge/snddrv.h
+++ b/engines/cge/snddrv.h
@@ -39,7 +39,7 @@ struct SmpInfo {
const uint8 *_saddr; // address
uint16 _slen; // length
uint16 _span; // left/right pan (0-15)
- int _sflag; // flag
+ int _counter; // number of time the sample should be played
};
// ******************************************************
diff --git a/engines/cge/sound.cpp b/engines/cge/sound.cpp
index 340a6c644c..fb0549ac22 100644
--- a/engines/cge/sound.cpp
+++ b/engines/cge/sound.cpp
@@ -32,6 +32,7 @@
#include "common/config-manager.h"
#include "common/memstream.h"
#include "audio/decoders/raw.h"
+#include "audio/audiostream.h"
namespace CGE {
@@ -68,7 +69,7 @@ void Sound::play(DataCk *wav, int pan) {
_smpinf._saddr = &*(wav->addr());
_smpinf._slen = (uint16)wav->size();
_smpinf._span = pan;
- _smpinf._sflag = getRepeat();
+ _smpinf._counter = getRepeat();
sndDigiStart(&_smpinf);
}
}
@@ -80,7 +81,8 @@ void Sound::sndDigiStart(SmpInfo *PSmpInfo) {
_audioStream = Audio::makeWAVStream(stream, DisposeAfterUse::YES);
// Start the new sound
- _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, _audioStream);
+ _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle,
+ Audio::makeLoopingAudioStream(_audioStream, (uint)PSmpInfo->_counter));
}
void Sound::stop() {