aboutsummaryrefslogtreecommitdiff
path: root/engines/sky
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sky')
-rw-r--r--engines/sky/intro.cpp23
-rw-r--r--engines/sky/sound.cpp9
2 files changed, 23 insertions, 9 deletions
diff --git a/engines/sky/intro.cpp b/engines/sky/intro.cpp
index 5e1b432418..a81058692d 100644
--- a/engines/sky/intro.cpp
+++ b/engines/sky/intro.cpp
@@ -38,6 +38,9 @@
#include "sky/struc.h"
#include "sky/text.h"
+#include "sound/audiostream.h"
+#include "sound/raw.h"
+
namespace Sky {
#define SHOWSCREEN 0
@@ -677,6 +680,8 @@ bool Intro::doIntro(bool floppyIntro) {
bool Intro::nextPart(uint16 *&data) {
uint8 *vData = NULL;
+ Audio::AudioStream *stream = 0;
+
// return false means cancel intro
uint16 command = *data++;
switch (command) {
@@ -730,11 +735,13 @@ bool Intro::nextPart(uint16 *&data) {
return false;
vData = _skyDisk->loadFile(*data++);
// HACK: Fill the header with silence. We should
- // probably use _skySound instead of calling playRaw()
+ // probably use _skySound instead of calling playInputStream()
// directly, but this will have to do for now.
memset(vData, 127, sizeof(DataFileHeader));
- _mixer->playRaw(Audio::Mixer::kSpeechSoundType, &_voice, vData, _skyDisk->_lastLoadedFileSize, DisposeAfterUse::YES,
- 11025, Audio::Mixer::FLAG_UNSIGNED, SOUND_VOICE);
+
+ stream = Audio::makeRawMemoryStream(vData, _skyDisk->_lastLoadedFileSize, DisposeAfterUse::YES,
+ 11025, Audio::Mixer::FLAG_UNSIGNED);
+ _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_voice, stream, SOUND_VOICE);
return true;
case WAITVOICE:
while (_mixer->isSoundHandleActive(_voice))
@@ -749,13 +756,15 @@ bool Intro::nextPart(uint16 *&data) {
return true;
case LOOPBG:
_mixer->stopID(SOUND_BG);
- _mixer->playRaw(Audio::Mixer::kSFXSoundType, &_bgSfx, _bgBuf + 256, _bgSize - 768, DisposeAfterUse::YES,
- 11025, Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_LOOP, SOUND_BG);
+ stream = Audio::makeRawMemoryStream(_bgBuf + 256, _bgSize - 768, DisposeAfterUse::YES,
+ 11025, Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_LOOP, 0, 0);
+ _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_bgSfx, stream, SOUND_BG);
return true;
case PLAYBG:
_mixer->stopID(SOUND_BG);
- _mixer->playRaw(Audio::Mixer::kSFXSoundType, &_bgSfx, _bgBuf + 256, _bgSize - 768, DisposeAfterUse::YES,
- 11025, Audio::Mixer::FLAG_UNSIGNED, SOUND_BG);
+ stream = Audio::makeRawMemoryStream(_bgBuf + 256, _bgSize - 768, DisposeAfterUse::YES,
+ 11025, Audio::Mixer::FLAG_UNSIGNED);
+ _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_bgSfx, stream, SOUND_BG);
return true;
case STOPBG:
_mixer->stopID(SOUND_BG);
diff --git a/engines/sky/sound.cpp b/engines/sky/sound.cpp
index cf5dc78c21..83ddc11a6b 100644
--- a/engines/sky/sound.cpp
+++ b/engines/sky/sound.cpp
@@ -33,6 +33,7 @@
#include "sky/sound.h"
#include "sky/struc.h"
+#include "sound/audiostream.h"
#include "sound/raw.h"
namespace Sky {
@@ -1043,7 +1044,9 @@ void Sound::playSound(uint32 id, byte *sound, uint32 size, Audio::SoundHandle *h
memcpy(buffer, sound+sizeof(DataFileHeader), size);
_mixer->stopID(id);
- _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer, size, DisposeAfterUse::YES, 11025, flags, id);
+
+ Audio::AudioStream *stream = Audio::makeRawMemoryStream(buffer, size, DisposeAfterUse::YES, 11025, flags);
+ _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, stream, id);
}
void Sound::loadSection(uint8 pSection) {
@@ -1245,7 +1248,9 @@ bool Sound::startSpeech(uint16 textNum) {
rate = 11025;
_mixer->stopID(SOUND_SPEECH);
- _mixer->playRaw(Audio::Mixer::kSpeechSoundType, &_ingameSpeech, playBuffer, speechSize, DisposeAfterUse::YES, rate, Audio::Mixer::FLAG_UNSIGNED, SOUND_SPEECH);
+
+ Audio::AudioStream *stream = Audio::makeRawMemoryStream(playBuffer, speechSize, DisposeAfterUse::YES, rate, Audio::Mixer::FLAG_UNSIGNED);
+ _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_ingameSpeech, stream, SOUND_SPEECH);
return true;
}