aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorTravis Howell2005-04-19 10:35:25 +0000
committerTravis Howell2005-04-19 10:35:25 +0000
commitc3bc118dc8fa39624c960f367c48d4f9bef48469 (patch)
treeb11e13f0306d80b61e5fdac17f17f00e42266e69 /scumm
parent0e24739de1d6b241c1089ccf32778acf1ec33c06 (diff)
downloadscummvm-rg350-c3bc118dc8fa39624c960f367c48d4f9bef48469.tar.gz
scummvm-rg350-c3bc118dc8fa39624c960f367c48d4f9bef48469.tar.bz2
scummvm-rg350-c3bc118dc8fa39624c960f367c48d4f9bef48469.zip
Add RIFF sound type.
svn-id: r17688
Diffstat (limited to 'scumm')
-rw-r--r--scumm/resource_v7he.cpp31
-rw-r--r--scumm/sound.cpp3
2 files changed, 23 insertions, 11 deletions
diff --git a/scumm/resource_v7he.cpp b/scumm/resource_v7he.cpp
index d5a2a1bc8f..b0f0f38613 100644
--- a/scumm/resource_v7he.cpp
+++ b/scumm/resource_v7he.cpp
@@ -30,6 +30,7 @@
#include "scumm/resource_v7he.h"
#include "scumm/sound.h"
#include "scumm/util.h"
+#include "sound/wave.h"
#include "common/stream.h"
#include "common/system.h"
@@ -1765,18 +1766,30 @@ int ScummEngine_v72he::getSoundResourceSize(int id) {
if (!ptr)
return 0;
- if (READ_UINT32(ptr) == MKID('HSHD')) {
- ptr += READ_BE_UINT32(ptr + 4);
+ if (READ_UINT32(ptr) == MKID('RIFF')) {
+ byte flags;
+ int rate;
+
+ size = READ_BE_UINT32(ptr + 4);
+ Common::MemoryReadStream stream(ptr, size);
+
+ if (!loadWAVFromStream(stream, size, rate, flags)) {
+ error("getSoundResourceSize: Not a valid WAV file");
+ }
} else {
- ptr += 8 + READ_BE_UINT32(ptr + 12);
- }
+ if (READ_UINT32(ptr) == MKID('HSHD')) {
+ ptr += READ_BE_UINT32(ptr + 4);
+ } else {
+ ptr += 8 + READ_BE_UINT32(ptr + 12);
+ }
- if (READ_UINT32(ptr) == MKID('SBNG')) {
- ptr += READ_BE_UINT32(ptr + 4);
- }
+ if (READ_UINT32(ptr) == MKID('SBNG')) {
+ ptr += READ_BE_UINT32(ptr + 4);
+ }
- assert(READ_UINT32(ptr) == MKID('SDAT'));
- size = READ_BE_UINT32(ptr + 4) - 8;
+ assert(READ_UINT32(ptr) == MKID('SDAT'));
+ size = READ_BE_UINT32(ptr + 4) - 8;
+ }
}
return size;
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 24fdb6e187..8752819867 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -293,8 +293,7 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) {
Common::MemoryReadStream stream(ptr, size);
if (!loadWAVFromStream(stream, size, rate, flags)) {
- warning("playSound: Not a valid WAV file");
- return;
+ error("playSound: Not a valid WAV file");
}
// Allocate a sound buffer, copy the data into it, and play