diff options
author | Martin Kiewitz | 2009-12-27 20:38:14 +0000 |
---|---|---|
committer | Martin Kiewitz | 2009-12-27 20:38:14 +0000 |
commit | 4f78c872d731bf5b567d191d533b3fc1081f04e4 (patch) | |
tree | 4c8f80a5f19a3fb73c5a26af91e214f320db89ac /engines | |
parent | 264bec306a642b4f40ef88b31c40e7421ddfab9a (diff) | |
download | scummvm-rg350-4f78c872d731bf5b567d191d533b3fc1081f04e4.tar.gz scummvm-rg350-4f78c872d731bf5b567d191d533b3fc1081f04e4.tar.bz2 scummvm-rg350-4f78c872d731bf5b567d191d533b3fc1081f04e4.zip |
SCI/newmusic: Accept WAVE files as audio resources (needed for gk1 title music) - requires additional resourcemanager support (or rename sfx\5.wav to 5.aud and add 8Dh 00h header)
svn-id: r46658
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/sfx/audio.cpp | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/engines/sci/sfx/audio.cpp b/engines/sci/sfx/audio.cpp index ed7425ff26..d2cb72fec1 100644 --- a/engines/sci/sfx/audio.cpp +++ b/engines/sci/sfx/audio.cpp @@ -32,6 +32,7 @@ #include "sound/audiostream.h" #include "sound/audiocd.h" +#include "sound/wave.h" namespace Sci { @@ -224,21 +225,31 @@ Audio::AudioStream* AudioPlayer::getAudioStream(uint32 number, uint32 volume, in data = readSOLAudio(&dataStream, size, audioFlags, flags); } } else { - // SCI1 - size = audioRes->size; - data = (byte *)malloc(size); - assert(data); - memcpy(data, audioRes->data, size); - flags = Audio::Mixer::FLAG_UNSIGNED; + // SCI1 or WAVE file + if (audioRes->size > 4) { + if (memcmp(audioRes->data, "RIFF", 4) == 0) { + // WAVE detected + Common::MemoryReadStream *waveStream = new Common::MemoryReadStream(audioRes->data, audioRes->size, Common::DisposeAfterUse::NO); + audioStream = Audio::makeWAVStream(waveStream, true, false); + } + } + if (!audioStream) { + // SCI1 raw audio + size = audioRes->size; + data = (byte *)malloc(size); + assert(data); + memcpy(data, audioRes->data, size); + flags = Audio::Mixer::FLAG_UNSIGNED; + } } if (data) { audioStream = Audio::makeLinearInputStream(data, size, _audioRate, flags | Audio::Mixer::FLAG_AUTOFREE, 0, 0); - if (audioStream) { - *sampleLen = (flags & Audio::Mixer::FLAG_16BITS ? size >> 1 : size) * 60 / _audioRate; - return audioStream; - } + } + if (audioStream) { + *sampleLen = (flags & Audio::Mixer::FLAG_16BITS ? size >> 1 : size) * 60 / _audioRate; + return audioStream; } return NULL; |