diff options
| author | Colin Snover | 2017-09-10 01:34:35 -0500 |
|---|---|---|
| committer | Colin Snover | 2017-09-19 19:54:29 -0500 |
| commit | 836f1bdf441a199e16ef4583975eab8fe377e863 (patch) | |
| tree | b5e92581c6e035c16a46113ed3bd95ff760d2405 /engines/sci/sound | |
| parent | 301d0403cb46cbb268c914c3fdcf070c31781e07 (diff) | |
| download | scummvm-rg350-836f1bdf441a199e16ef4583975eab8fe377e863.tar.gz scummvm-rg350-836f1bdf441a199e16ef4583975eab8fe377e863.tar.bz2 scummvm-rg350-836f1bdf441a199e16ef4583975eab8fe377e863.zip | |
SCI32: Add audio dump debugger command
Diffstat (limited to 'engines/sci/sound')
| -rw-r--r-- | engines/sci/sound/audio32.cpp | 77 | ||||
| -rw-r--r-- | engines/sci/sound/audio32.h | 5 |
2 files changed, 45 insertions, 37 deletions
diff --git a/engines/sci/sound/audio32.cpp b/engines/sci/sound/audio32.cpp index 1b521cd023..2f30f7dd79 100644 --- a/engines/sci/sound/audio32.cpp +++ b/engines/sci/sound/audio32.cpp @@ -46,6 +46,46 @@ namespace Sci { +bool detectSolAudio(Common::SeekableReadStream &stream) { + const size_t initialPosition = stream.pos(); + + byte header[6]; + if (stream.read(header, sizeof(header)) != sizeof(header)) { + stream.seek(initialPosition); + return false; + } + + stream.seek(initialPosition); + + if ((header[0] & 0x7f) != kResourceTypeAudio || READ_BE_UINT32(header + 2) != MKTAG('S', 'O', 'L', 0)) { + return false; + } + + return true; +} + +bool detectWaveAudio(Common::SeekableReadStream &stream) { + const size_t initialPosition = stream.pos(); + + byte blockHeader[8]; + if (stream.read(blockHeader, sizeof(blockHeader)) != sizeof(blockHeader)) { + stream.seek(initialPosition); + return false; + } + + stream.seek(initialPosition); + const uint32 headerType = READ_BE_UINT32(blockHeader); + + if (headerType != MKTAG('R', 'I', 'F', 'F')) { + return false; + } + + return true; +} + +#pragma mark - +#pragma mark MutableLoopAudioStream + class MutableLoopAudioStream : public Audio::AudioStream { public: MutableLoopAudioStream(Audio::RewindableAudioStream *stream, const bool loop_, const DisposeAfterUse::Flag dispose = DisposeAfterUse::YES) : @@ -105,43 +145,6 @@ private: bool _loop; }; -bool detectSolAudio(Common::SeekableReadStream &stream) { - const size_t initialPosition = stream.pos(); - - byte header[6]; - if (stream.read(header, sizeof(header)) != sizeof(header)) { - stream.seek(initialPosition); - return false; - } - - stream.seek(initialPosition); - - if ((header[0] & 0x7f) != kResourceTypeAudio || READ_BE_UINT32(header + 2) != MKTAG('S', 'O', 'L', 0)) { - return false; - } - - return true; -} - -bool detectWaveAudio(Common::SeekableReadStream &stream) { - const size_t initialPosition = stream.pos(); - - byte blockHeader[8]; - if (stream.read(blockHeader, sizeof(blockHeader)) != sizeof(blockHeader)) { - stream.seek(initialPosition); - return false; - } - - stream.seek(initialPosition); - const uint32 headerType = READ_BE_UINT32(blockHeader); - - if (headerType != MKTAG('R', 'I', 'F', 'F')) { - return false; - } - - return true; -} - #pragma mark - Audio32::Audio32(ResourceManager *resMan) : diff --git a/engines/sci/sound/audio32.h b/engines/sci/sound/audio32.h index a994113e32..8b8ec2a6b5 100644 --- a/engines/sci/sound/audio32.h +++ b/engines/sci/sound/audio32.h @@ -35,6 +35,9 @@ namespace Sci { class Console; +bool detectSolAudio(Common::SeekableReadStream &stream); +bool detectWaveAudio(Common::SeekableReadStream &stream); + #pragma mark AudioChannel /** @@ -130,6 +133,8 @@ struct AudioChannel { int pan; }; +#pragma mark - + /** * Special audio channel indexes used to select a channel * for digital audio playback. |
