[Scummvm-cvs-logs] SF.net SVN: scummvm:[55023] scummvm/trunk/engines/sci
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Thu Dec 23 14:11:10 CET 2010
Revision: 55023
http://scummvm.svn.sourceforge.net/scummvm/?rev=55023&view=rev
Author: thebluegr
Date: 2010-12-23 13:11:10 +0000 (Thu, 23 Dec 2010)
Log Message:
-----------
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)
Modified Paths:
--------------
scummvm/trunk/engines/sci/graphics/robot.cpp
scummvm/trunk/engines/sci/graphics/robot.h
scummvm/trunk/engines/sci/sound/audio.cpp
scummvm/trunk/engines/sci/sound/audio.h
Modified: scummvm/trunk/engines/sci/graphics/robot.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/robot.cpp 2010-12-23 12:54:47 UTC (rev 55022)
+++ scummvm/trunk/engines/sci/graphics/robot.cpp 2010-12-23 13:11:10 UTC (rev 55023)
@@ -27,8 +27,13 @@
#include "sci/engine/state.h"
#include "sci/graphics/screen.h"
#include "sci/graphics/robot.h"
+#include "sci/sound/audio.h"
+#include "sound/audiostream.h"
+#include "sound/mixer.h"
+
#include "common/file.h"
+#include "common/system.h"
namespace Sci {
@@ -64,9 +69,9 @@
_audioSize = READ_LE_UINT16(_resourceData + 15);
//_frameSize = READ_LE_UINT32(_resourceData + 34);
- byte hasSound = _resourceData[25];
+ _hasSound = (_resourceData[25] != 0);
- debug("Robot %d, %d frames, sound: %d\n", resourceId, _frameCount, hasSound);
+ debug("Robot %d, %d frames, sound: %s\n", resourceId, _frameCount, _hasSound ? "yes" : "no");
}
// TODO: just trying around in here...
@@ -76,6 +81,15 @@
int x, y;
int frame;
+ // Play the audio of the robot file (for debugging)
+#if 0
+ if (_hasSound) {
+ Audio::SoundHandle _audioHandle;
+ Audio::AudioStream *audioStream = g_sci->_audio->getRobotAudioStream(_resourceData);
+ g_system->getMixer()->playStream(Audio::Mixer::kSpeechSoundType, &_audioHandle, audioStream);
+ }
+#endif
+
return;
// Each frame contains these bytes:
Modified: scummvm/trunk/engines/sci/graphics/robot.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/robot.h 2010-12-23 12:54:47 UTC (rev 55022)
+++ scummvm/trunk/engines/sci/graphics/robot.h 2010-12-23 13:11:10 UTC (rev 55023)
@@ -52,6 +52,7 @@
uint16 _frameCount;
uint32 _frameSize; // is width * height (pixelCount)
uint16 _audioSize;
+ bool _hasSound;
};
#endif
Modified: scummvm/trunk/engines/sci/sound/audio.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/audio.cpp 2010-12-23 12:54:47 UTC (rev 55022)
+++ scummvm/trunk/engines/sci/sound/audio.cpp 2010-12-23 13:11:10 UTC (rev 55023)
@@ -243,6 +243,20 @@
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;
Modified: scummvm/trunk/engines/sci/sound/audio.h
===================================================================
--- scummvm/trunk/engines/sci/sound/audio.h 2010-12-23 12:54:47 UTC (rev 55022)
+++ scummvm/trunk/engines/sci/sound/audio.h 2010-12-23 13:11:10 UTC (rev 55023)
@@ -65,6 +65,7 @@
void setAudioRate(uint16 rate) { _audioRate = rate; }
Audio::SoundHandle *getAudioHandle() { return &_audioHandle; }
+ Audio::RewindableAudioStream *getRobotAudioStream(byte *buffer);
Audio::RewindableAudioStream *getAudioStream(uint32 number, uint32 volume, int *sampleLen);
int getAudioPosition();
int startAudio(uint16 module, uint32 tuple);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list