aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/groovie/music.cpp8
-rw-r--r--engines/lastexpress/data/snd.cpp8
-rw-r--r--engines/lastexpress/data/snd.h6
-rw-r--r--engines/mohawk/sound.cpp30
-rw-r--r--engines/mohawk/sound.h6
5 files changed, 32 insertions, 26 deletions
diff --git a/engines/groovie/music.cpp b/engines/groovie/music.cpp
index c00290b155..cf65e012c8 100644
--- a/engines/groovie/music.cpp
+++ b/engines/groovie/music.cpp
@@ -934,16 +934,18 @@ bool MusicPlayerIOS::load(uint32 fileref, bool loop) {
}
// Create the audio stream
- Audio::AudioStream *audStream = Audio::SeekableAudioStream::openStreamFile(info.filename);
+ Audio::SeekableAudioStream *seekStream = Audio::SeekableAudioStream::openStreamFile(info.filename);
- if (!audStream) {
+ if (!seekStream) {
warning("Could not play audio file '%s'", info.filename.c_str());
return false;
}
+ Audio::AudioStream *audStream = seekStream;
+
// Loop if requested
if (loop)
- audStream = Audio::makeLoopingAudioStream((Audio::RewindableAudioStream *)audStream, 0);
+ audStream = Audio::makeLoopingAudioStream(seekStream, 0);
// MIDI player handles volume reset on load, IOS player doesn't - force update here
updateVolume();
diff --git a/engines/lastexpress/data/snd.cpp b/engines/lastexpress/data/snd.cpp
index 2a221afadc..e310bafd18 100644
--- a/engines/lastexpress/data/snd.cpp
+++ b/engines/lastexpress/data/snd.cpp
@@ -442,7 +442,7 @@ void SimpleSound::loadHeader(Common::SeekableReadStream *in) {
_blockSize = _size / _blocks;
}
-Audio::AudioStream *SimpleSound::makeDecoder(Common::SeekableReadStream *in, uint32 size, int32 filterId) const {
+LastExpress_ADPCMStream *SimpleSound::makeDecoder(Common::SeekableReadStream *in, uint32 size, int32 filterId) const {
return new LastExpress_ADPCMStream(in, DisposeAfterUse::YES, size, _blockSize, filterId);
}
@@ -489,7 +489,7 @@ void StreamedSound::setFilterId(int32 filterId) {
if (!_as)
return;
- ((LastExpress_ADPCMStream *)_as)->setFilterId(filterId);
+ _as->setFilterId(filterId);
}
//////////////////////////////////////////////////////////////////////////
@@ -525,8 +525,8 @@ void AppendableSound::queueBuffer(Common::SeekableReadStream *bufferIn) {
// Setup the ADPCM decoder
uint32 sizeIn = (uint32)bufferIn->size();
- Audio::AudioStream *adpcm = makeDecoder(bufferIn, sizeIn);
- ((LastExpress_ADPCMStream *)adpcm)->setFilterId(16);
+ LastExpress_ADPCMStream *adpcm = makeDecoder(bufferIn, sizeIn);
+ adpcm->setFilterId(16);
// Queue the stream
_as->queueAudioStream(adpcm);
diff --git a/engines/lastexpress/data/snd.h b/engines/lastexpress/data/snd.h
index f489304ff3..19e5fda9c9 100644
--- a/engines/lastexpress/data/snd.h
+++ b/engines/lastexpress/data/snd.h
@@ -49,6 +49,8 @@ class SeekableReadStream;
namespace LastExpress {
+class LastExpress_ADPCMStream;
+
class SimpleSound {
public:
SimpleSound();
@@ -59,7 +61,7 @@ public:
protected:
void loadHeader(Common::SeekableReadStream *in);
- Audio::AudioStream *makeDecoder(Common::SeekableReadStream *in, uint32 size, int32 filterId = -1) const;
+ LastExpress_ADPCMStream *makeDecoder(Common::SeekableReadStream *in, uint32 size, int32 filterId = -1) const;
void play(Audio::AudioStream *as);
uint32 _size; ///< data size
@@ -82,7 +84,7 @@ public:
void setFilterId(int32 filterId);
private:
- Audio::AudioStream *_as;
+ LastExpress_ADPCMStream *_as;
bool _loaded;
};
diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp
index 6f18d7178e..198627e012 100644
--- a/engines/mohawk/sound.cpp
+++ b/engines/mohawk/sound.cpp
@@ -77,8 +77,8 @@ void Sound::initMidi() {
_midiParser->setTimerRate(_midiDriver->getBaseTempo());
}
-Audio::AudioStream *Sound::makeAudioStream(uint16 id, CueList *cueList) {
- Audio::AudioStream *audStream = NULL;
+Audio::RewindableAudioStream *Sound::makeAudioStream(uint16 id, CueList *cueList) {
+ Audio::RewindableAudioStream *audStream = NULL;
switch (_vm->getGameType()) {
case GType_MYST:
@@ -109,17 +109,18 @@ Audio::AudioStream *Sound::makeAudioStream(uint16 id, CueList *cueList) {
Audio::SoundHandle *Sound::playSound(uint16 id, byte volume, bool loop, CueList *cueList) {
debug (0, "Playing sound %d", id);
- Audio::AudioStream *audStream = makeAudioStream(id, cueList);
+ Audio::RewindableAudioStream *rewindStream = makeAudioStream(id, cueList);
- if (audStream) {
+ if (rewindStream) {
SndHandle *handle = getHandle();
handle->type = kUsedHandle;
handle->id = id;
- handle->samplesPerSecond = audStream->getRate();
+ handle->samplesPerSecond = rewindStream->getRate();
// Set the stream to loop here if it's requested
+ Audio::AudioStream *audStream = rewindStream;
if (loop)
- audStream = Audio::makeLoopingAudioStream((Audio::RewindableAudioStream *)audStream, 0);
+ audStream = Audio::makeLoopingAudioStream(rewindStream, 0);
_vm->_mixer->playStream(Audio::Mixer::kPlainSoundType, &handle->handle, audStream, -1, volume);
return &handle->handle;
@@ -335,11 +336,12 @@ void Sound::playSLSTSound(uint16 id, bool fade, bool loop, uint16 volume, int16
sndHandle.id = id;
_currentSLSTSounds.push_back(sndHandle);
- Audio::AudioStream *audStream = makeMohawkWaveStream(_vm->getResource(ID_TWAV, id));
+ Audio::RewindableAudioStream *rewindStream = makeMohawkWaveStream(_vm->getResource(ID_TWAV, id));
// Loop here if necessary
+ Audio::AudioStream *audStream = rewindStream;
if (loop)
- audStream = Audio::makeLoopingAudioStream((Audio::RewindableAudioStream *)audStream, 0);
+ audStream = Audio::makeLoopingAudioStream(rewindStream, 0);
// TODO: Handle fading, possibly just raise the volume of the channel in increments?
@@ -363,7 +365,7 @@ void Sound::resumeSLST() {
_vm->_mixer->pauseHandle(*_currentSLSTSounds[i].handle, false);
}
-Audio::AudioStream *Sound::makeMohawkWaveStream(Common::SeekableReadStream *stream, CueList *cueList) {
+Audio::RewindableAudioStream *Sound::makeMohawkWaveStream(Common::SeekableReadStream *stream, CueList *cueList) {
uint32 tag = 0;
ADPCMStatus adpcmStatus;
DataChunk dataChunk;
@@ -507,7 +509,7 @@ Audio::AudioStream *Sound::makeMohawkWaveStream(Common::SeekableReadStream *stre
return NULL;
}
-Audio::AudioStream *Sound::makeLivingBooksWaveStream_v1(Common::SeekableReadStream *stream) {
+Audio::RewindableAudioStream *Sound::makeLivingBooksWaveStream_v1(Common::SeekableReadStream *stream) {
uint16 header = stream->readUint16BE();
uint16 rate = 0;
uint32 size = 0;
@@ -646,15 +648,15 @@ Audio::SoundHandle *Sound::replaceBackgroundMyst(uint16 id, uint16 volume) {
stopBackgroundMyst();
// Play new sound
- Audio::AudioStream *audStream = makeAudioStream(id);
+ Audio::RewindableAudioStream *rewindStream = makeAudioStream(id);
- if (audStream) {
+ if (rewindStream) {
_mystBackgroundSound.type = kUsedHandle;
_mystBackgroundSound.id = id;
- _mystBackgroundSound.samplesPerSecond = audStream->getRate();
+ _mystBackgroundSound.samplesPerSecond = rewindStream->getRate();
// Set the stream to loop
- audStream = Audio::makeLoopingAudioStream((Audio::RewindableAudioStream *)audStream, 0);
+ Audio::AudioStream *audStream = Audio::makeLoopingAudioStream(rewindStream, 0);
_vm->_mixer->playStream(Audio::Mixer::kPlainSoundType, &_mystBackgroundSound.handle, audStream, -1, volume >> 8);
return &_mystBackgroundSound.handle;
diff --git a/engines/mohawk/sound.h b/engines/mohawk/sound.h
index 49f6751072..75c9492d96 100644
--- a/engines/mohawk/sound.h
+++ b/engines/mohawk/sound.h
@@ -156,13 +156,13 @@ private:
MidiParser *_midiParser;
byte *_midiData;
- static Audio::AudioStream *makeMohawkWaveStream(Common::SeekableReadStream *stream, CueList *cueList = NULL);
- static Audio::AudioStream *makeLivingBooksWaveStream_v1(Common::SeekableReadStream *stream);
+ static Audio::RewindableAudioStream *makeMohawkWaveStream(Common::SeekableReadStream *stream, CueList *cueList = NULL);
+ static Audio::RewindableAudioStream *makeLivingBooksWaveStream_v1(Common::SeekableReadStream *stream);
void initMidi();
Common::Array<SndHandle> _handles;
SndHandle *getHandle();
- Audio::AudioStream *makeAudioStream(uint16 id, CueList *cueList = NULL);
+ Audio::RewindableAudioStream *makeAudioStream(uint16 id, CueList *cueList = NULL);
uint16 convertMystID(uint16 id);
// Myst-specific