aboutsummaryrefslogtreecommitdiff
path: root/engines/agos/sound.cpp
diff options
context:
space:
mode:
authorMax Horn2010-01-23 00:02:59 +0000
committerMax Horn2010-01-23 00:02:59 +0000
commita193c91e9566ff63f60846902b7f616f2fa9df1f (patch)
tree8fa7555d63f81d005cd5d4da70c5c7866e5f2426 /engines/agos/sound.cpp
parentc3c7071948010c6418f8246b82232832ef5c48c4 (diff)
downloadscummvm-rg350-a193c91e9566ff63f60846902b7f616f2fa9df1f.tar.gz
scummvm-rg350-a193c91e9566ff63f60846902b7f616f2fa9df1f.tar.bz2
scummvm-rg350-a193c91e9566ff63f60846902b7f616f2fa9df1f.zip
AGOS: Turn BaseSound::makeAudioStream into a pure virtual method
svn-id: r47456
Diffstat (limited to 'engines/agos/sound.cpp')
-rw-r--r--engines/agos/sound.cpp28
1 files changed, 17 insertions, 11 deletions
diff --git a/engines/agos/sound.cpp b/engines/agos/sound.cpp
index 670f8bf9a7..e327a67f5f 100644
--- a/engines/agos/sound.cpp
+++ b/engines/agos/sound.cpp
@@ -61,12 +61,11 @@ public:
playSound(sound, sound, type, handle, loop, vol);
}
virtual void playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, bool loop, int vol = 0) = 0;
- virtual Audio::AudioStream *makeAudioStream(uint sound) { return NULL; }
+ virtual Audio::AudioStream *makeAudioStream(uint sound) = 0;
};
-BaseSound::BaseSound(Audio::Mixer *mixer, File *file, uint32 base, bool bigEndian) {
- _mixer = mixer;
- _file = file;
+BaseSound::BaseSound(Audio::Mixer *mixer, File *file, uint32 base, bool bigEndian)
+ : _mixer(mixer), _file(file) {
uint res = 0;
uint32 size;
@@ -99,9 +98,9 @@ BaseSound::BaseSound(Audio::Mixer *mixer, File *file, uint32 base, bool bigEndia
_offsets[res] = _file->size();
}
-BaseSound::BaseSound(Audio::Mixer *mixer, File *file, uint32 *offsets) {
- _mixer = mixer;
- _file = file;
+BaseSound::BaseSound(Audio::Mixer *mixer, File *file, uint32 *offsets)
+ : _mixer(mixer), _file(file) {
+
_offsets = offsets;
_freeOffsets = false;
}
@@ -280,12 +279,13 @@ class RawSound : public BaseSound {
public:
RawSound(Audio::Mixer *mixer, File *file, bool isUnsigned)
: BaseSound(mixer, file, 0, SOUND_BIG_ENDIAN), _flags(isUnsigned ? Audio::FLAG_UNSIGNED : 0) {}
+ Audio::AudioStream *makeAudioStream(uint sound);
void playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, bool loop, int vol = 0);
};
-void RawSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, bool loop, int vol) {
+Audio::AudioStream *RawSound::makeAudioStream(uint sound) {
if (_offsets == NULL)
- return;
+ return NULL;
_file->seek(_offsets[sound], SEEK_SET);
@@ -294,8 +294,14 @@ void RawSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType typ
assert(buffer);
_file->read(buffer, size);
- Audio::AudioStream *stream = Audio::makeRawMemoryStream(buffer, size, DisposeAfterUse::YES, 22050, _flags);
- _mixer->playInputStream(type, handle, stream);
+ return Audio::makeRawMemoryStream(buffer, size, DisposeAfterUse::YES, 22050, _flags);
+}
+
+void RawSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, bool loop, int vol) {
+ // FIXME: We ignore loopSound and vol. Is this on purpose?
+ _mixer->playInputStream(type, handle, makeAudioStream(sound));
+// convertVolume(vol);
+// _mixer->playInputStream(type, handle, new LoopingAudioStream(this, sound, loopSound, loop), -1, vol);
}
///////////////////////////////////////////////////////////////////////////////