[Scummvm-cvs-logs] SF.net SVN: scummvm:[46658] scummvm/trunk/engines/sci/sfx/audio.cpp
m_kiewitz at users.sourceforge.net
m_kiewitz at users.sourceforge.net
Sun Dec 27 21:38:14 CET 2009
Revision: 46658
http://scummvm.svn.sourceforge.net/scummvm/?rev=46658&view=rev
Author: m_kiewitz
Date: 2009-12-27 20:38:14 +0000 (Sun, 27 Dec 2009)
Log Message:
-----------
SCI/newmusic: Accept WAVE files as audio resources (needed for gk1 title music) - requires additional resourcemanager support (or rename sfx\5.wav to 5.aud and add 8Dh 00h header)
Modified Paths:
--------------
scummvm/trunk/engines/sci/sfx/audio.cpp
Modified: scummvm/trunk/engines/sci/sfx/audio.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/audio.cpp 2009-12-27 19:50:58 UTC (rev 46657)
+++ scummvm/trunk/engines/sci/sfx/audio.cpp 2009-12-27 20:38:14 UTC (rev 46658)
@@ -32,6 +32,7 @@
#include "sound/audiostream.h"
#include "sound/audiocd.h"
+#include "sound/wave.h"
namespace Sci {
@@ -224,22 +225,32 @@
data = readSOLAudio(&dataStream, size, audioFlags, flags);
}
} else {
- // SCI1
- size = audioRes->size;
- data = (byte *)malloc(size);
- assert(data);
- memcpy(data, audioRes->data, size);
- flags = Audio::Mixer::FLAG_UNSIGNED;
+ // SCI1 or WAVE file
+ if (audioRes->size > 4) {
+ if (memcmp(audioRes->data, "RIFF", 4) == 0) {
+ // WAVE detected
+ Common::MemoryReadStream *waveStream = new Common::MemoryReadStream(audioRes->data, audioRes->size, Common::DisposeAfterUse::NO);
+ audioStream = Audio::makeWAVStream(waveStream, true, false);
+ }
+ }
+ if (!audioStream) {
+ // SCI1 raw audio
+ size = audioRes->size;
+ data = (byte *)malloc(size);
+ assert(data);
+ memcpy(data, audioRes->data, size);
+ flags = Audio::Mixer::FLAG_UNSIGNED;
+ }
}
if (data) {
audioStream = Audio::makeLinearInputStream(data, size, _audioRate,
flags | Audio::Mixer::FLAG_AUTOFREE, 0, 0);
- if (audioStream) {
- *sampleLen = (flags & Audio::Mixer::FLAG_16BITS ? size >> 1 : size) * 60 / _audioRate;
- return audioStream;
- }
}
+ if (audioStream) {
+ *sampleLen = (flags & Audio::Mixer::FLAG_16BITS ? size >> 1 : size) * 60 / _audioRate;
+ return audioStream;
+ }
return NULL;
}
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