From 401a8c355d1b8af353db0df6dab6117cb725f756 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 23 Dec 2010 13:11:10 +0000 Subject: SCI: Some initial work on the sound of robot videos (doesn't work yet, seems to be a problem with the encoding of the customized SOL audio files in robot videos) svn-id: r55023 --- engines/sci/sound/audio.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'engines/sci/sound/audio.cpp') diff --git a/engines/sci/sound/audio.cpp b/engines/sci/sound/audio.cpp index 829a94d90c..f2c13cf5f5 100644 --- a/engines/sci/sound/audio.cpp +++ b/engines/sci/sound/audio.cpp @@ -243,6 +243,20 @@ static byte *readSOLAudio(Common::SeekableReadStream *audioStream, uint32 &size, return buffer; } +// FIXME: This doesn't work correctly yet, perhaps there are differences in the +// way the audio in robot files is handled +Audio::RewindableAudioStream *AudioPlayer::getRobotAudioStream(byte *buffer) { + const uint16 rbtHeaderSize = 19; // TODO: is this right? + const uint16 rbtAudioRate = 22050; // Seems to be hardcoded for all Robot videos + byte audioFlags = *(buffer + 6); + byte flags = 0; + uint32 audioSize = READ_LE_UINT16(buffer + 15) - rbtHeaderSize; + + Common::MemoryReadStream dataStream(buffer + rbtHeaderSize - 1, audioSize, DisposeAfterUse::NO); + byte *data = readSOLAudio(&dataStream, audioSize, audioFlags, flags); + return Audio::makeRawStream(data, audioSize, rbtAudioRate, flags); +} + Audio::RewindableAudioStream *AudioPlayer::getAudioStream(uint32 number, uint32 volume, int *sampleLen) { Audio::SeekableAudioStream *audioSeekStream = 0; Audio::RewindableAudioStream *audioStream = 0; -- cgit v1.2.3