diff options
author | Robert Špalek | 2010-07-01 17:06:14 +0000 |
---|---|---|
committer | Robert Špalek | 2010-07-01 17:06:14 +0000 |
commit | 2d6f912bd10f70ae556af627f2b4ae6565f904ed (patch) | |
tree | b52cc44c19aaa9c1836a83faa33971b15cf0cd8c /engines/draci | |
parent | a905327e65be97824e3faf483d3e535e763586cd (diff) | |
download | scummvm-rg350-2d6f912bd10f70ae556af627f2b4ae6565f904ed.tar.gz scummvm-rg350-2d6f912bd10f70ae556af627f2b4ae6565f904ed.tar.bz2 scummvm-rg350-2d6f912bd10f70ae556af627f2b4ae6565f904ed.zip |
Fix playing RAW and RAW80 streams
svn-id: r50558
Diffstat (limited to 'engines/draci')
-rw-r--r-- | engines/draci/sound.cpp | 14 | ||||
-rw-r--r-- | engines/draci/sound.h | 2 |
2 files changed, 11 insertions, 5 deletions
diff --git a/engines/draci/sound.cpp b/engines/draci/sound.cpp index e430da7bdc..eddf10e3ad 100644 --- a/engines/draci/sound.cpp +++ b/engines/draci/sound.cpp @@ -180,6 +180,10 @@ SoundSample *LegacySoundArchive::getSample(int i, uint freq) { void ZipSoundArchive::openArchive(const char *path, const char *extension, SoundFormat format, int raw_frequency) { closeArchive(); + if ((_format == RAW || _format == RAW80) && !raw_frequency) { + error("openArchive() expects frequency for RAW data"); + return; + } _archive = Common::makeZipArchive(path); _path = path; @@ -294,17 +298,19 @@ void Sound::playSoundBuffer(Audio::SoundHandle *handle, const SoundSample &buffe // script.cpp, which blocks until the dubbed sentence has finished // playing. Common::SeekableReadStream* stream; + const int skip = buffer._format == RAW80 ? 80 : 0; if (buffer._stream) { - stream = new Common::SeekableSubReadStream(buffer._stream, 0, buffer._stream->size(), DisposeAfterUse::NO); + stream = new Common::SeekableSubReadStream( + buffer._stream, skip, buffer._stream->size() /* end */, DisposeAfterUse::NO); } else { - stream = new Common::MemoryReadStream(buffer._data, buffer._length, DisposeAfterUse::NO); + stream = new Common::MemoryReadStream( + buffer._data + skip, buffer._length - skip /* length */, DisposeAfterUse::NO); } Audio::SeekableAudioStream *reader = NULL; switch (buffer._format) { - case RAW80: - stream->skip(80); // and fall-thru case RAW: + case RAW80: reader = Audio::makeRawStream(stream, buffer._frequency, Audio::FLAG_UNSIGNED, DisposeAfterUse::YES); break; #ifdef USE_MAD diff --git a/engines/draci/sound.h b/engines/draci/sound.h index b1a91bb55b..2fade6de0b 100644 --- a/engines/draci/sound.h +++ b/engines/draci/sound.h @@ -54,7 +54,7 @@ struct SoundSample { Common::SeekableReadStream* _stream; SoundSample() : _offset(0), _length(0), _frequency(0), _format(RAW), _data(NULL), _stream(NULL) { } - // The standard copy constructor is good enough, since we only stored numbers and pointers. + // The standard copy constructor is good enough, since we only store numbers and pointers. // Don't call close() automaticall in the destructor, otherwise copying causes SIGSEGV. void close() { delete[] _data; |