[Scummvm-cvs-logs] SF.net SVN: scummvm:[50558] scummvm/trunk/engines/draci
spalek at users.sourceforge.net
spalek at users.sourceforge.net
Thu Jul 1 19:06:14 CEST 2010
Revision: 50558
http://scummvm.svn.sourceforge.net/scummvm/?rev=50558&view=rev
Author: spalek
Date: 2010-07-01 17:06:14 +0000 (Thu, 01 Jul 2010)
Log Message:
-----------
Fix playing RAW and RAW80 streams
Modified Paths:
--------------
scummvm/trunk/engines/draci/sound.cpp
scummvm/trunk/engines/draci/sound.h
Modified: scummvm/trunk/engines/draci/sound.cpp
===================================================================
--- scummvm/trunk/engines/draci/sound.cpp 2010-07-01 16:26:18 UTC (rev 50557)
+++ scummvm/trunk/engines/draci/sound.cpp 2010-07-01 17:06:14 UTC (rev 50558)
@@ -180,6 +180,10 @@
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 @@
// 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 RAW:
case RAW80:
- stream->skip(80); // and fall-thru
- case RAW:
reader = Audio::makeRawStream(stream, buffer._frequency, Audio::FLAG_UNSIGNED, DisposeAfterUse::YES);
break;
#ifdef USE_MAD
Modified: scummvm/trunk/engines/draci/sound.h
===================================================================
--- scummvm/trunk/engines/draci/sound.h 2010-07-01 16:26:18 UTC (rev 50557)
+++ scummvm/trunk/engines/draci/sound.h 2010-07-01 17:06:14 UTC (rev 50558)
@@ -54,7 +54,7 @@
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;
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