aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/sound.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/xeen/sound.cpp')
-rw-r--r--engines/xeen/sound.cpp41
1 files changed, 18 insertions, 23 deletions
diff --git a/engines/xeen/sound.cpp b/engines/xeen/sound.cpp
index d6bbc4c487..360cfc89da 100644
--- a/engines/xeen/sound.cpp
+++ b/engines/xeen/sound.cpp
@@ -26,42 +26,37 @@
namespace Xeen {
-Sound *Voc::_sound;
+/*------------------------------------------------------------------------*/
-Voc::Voc(const Common::String &name) {
- if (!open(name))
- error("Could not open - %s", name.c_str());
+Sound::Sound(XeenEngine *vm, Audio::Mixer *mixer): Music(), _mixer(mixer) {
}
-void Voc::init(XeenEngine *vm) {
- _sound = vm->_sound;
+Sound::~Sound() {
+ stopSound();
}
-void Voc::play() {
- _sound->playSound(this, _soundHandle);
-}
+void Sound::playSound(Common::SeekableReadStream &s, int unused) {
+ stopSound();
-void Voc::stop() {
- _sound->stopSound(_soundHandle);
+ Common::SeekableReadStream *srcStream = s.readStream(s.size());
+ Audio::SeekableAudioStream *stream = Audio::makeVOCStream(srcStream, 0, DisposeAfterUse::YES);
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, stream);
}
-/*------------------------------------------------------------------------*/
-
-Sound::Sound(XeenEngine *vm, Audio::Mixer *mixer): Music(), _mixer(mixer) {
-}
+void Sound::playSound(const Common::String &name, int unused) {
+ File f;
+ if (!f.open(name))
+ error("Could not open sound - %s", name.c_str());
-void Sound::proc2(Common::SeekableReadStream &f) {
- // TODO
+ playSound(f);
}
-void Sound::playSound(Common::SeekableReadStream *s, Audio::SoundHandle &soundHandle,
- Audio::Mixer::SoundType soundType) {
- Audio::SeekableAudioStream *stream = Audio::makeVOCStream(s, 0);
- _mixer->playStream(soundType, &soundHandle, stream);
+void Sound::stopSound() {
+ _mixer->stopHandle(_soundHandle);
}
-void Sound::stopSound(Audio::SoundHandle &soundHandle) {
- _mixer->stopHandle(soundHandle);
+bool Sound::isPlaying() const {
+ return _mixer->isSoundHandleActive(_soundHandle);
}
} // End of namespace Xeen