aboutsummaryrefslogtreecommitdiff
path: root/sword1
diff options
context:
space:
mode:
authorMax Horn2005-01-09 15:57:38 +0000
committerMax Horn2005-01-09 15:57:38 +0000
commit7df70de2b1e070ed6474f81f9da782bc22f21bb1 (patch)
tree9be433339c87291a98fee6d968bfd794b1c12169 /sword1
parent9cea3d393f0c3657f3caef72a13dce5594581bdd (diff)
downloadscummvm-rg350-7df70de2b1e070ed6474f81f9da782bc22f21bb1.tar.gz
scummvm-rg350-7df70de2b1e070ed6474f81f9da782bc22f21bb1.tar.bz2
scummvm-rg350-7df70de2b1e070ed6474f81f9da782bc22f21bb1.zip
Mark some places which probably should use loadWAVFromStream(); maybe some of the engine maintainers can look into using it
svn-id: r16503
Diffstat (limited to 'sword1')
-rw-r--r--sword1/music.cpp10
-rw-r--r--sword1/sound.cpp14
2 files changed, 22 insertions, 2 deletions
diff --git a/sword1/music.cpp b/sword1/music.cpp
index 4eb2ddf403..c2b21409a3 100644
--- a/sword1/music.cpp
+++ b/sword1/music.cpp
@@ -26,6 +26,7 @@
#include "common/file.h"
#include "sound/mp3.h"
#include "sound/vorbis.h"
+#include "sound/wave.h"
#define SMP_BUFSIZE 8192
@@ -43,6 +44,15 @@ WaveAudioStream::WaveAudioStream(File *source, uint32 pSize) {
_sampleBuf = (uint8*)malloc(SMP_BUFSIZE);
_sourceFile->incRef();
if (_sourceFile->isOpen()) {
+ // TODO: use loadWAVFromStream to load the WAVE data!
+ /*
+ int rate, size;
+ bye flags;
+ const uint32 initialPos = _sourceFile->pos();
+ isValidWAV = loadWAVFromStream(*_sourceFile, size, rate, flags);
+ */
+
+
_sourceFile->read(wavHeader, WAVEHEADERSIZE);
_isStereo = (READ_LE_UINT16(wavHeader + 0x16) == 2);
_rate = READ_LE_UINT16(wavHeader + 0x18);
diff --git a/sword1/sound.cpp b/sword1/sound.cpp
index a97e57071b..6c0e0c3e8f 100644
--- a/sword1/sound.cpp
+++ b/sword1/sound.cpp
@@ -28,6 +28,7 @@
#include "sound/mp3.h"
#include "sound/vorbis.h"
+#include "sound/wave.h"
namespace Sword1 {
@@ -221,6 +222,15 @@ int16 *Sound::uncompressSpeech(uint32 index, uint32 cSize, uint32 *size) {
_cowFile.seek(index);
_cowFile.read(fBuf, cSize);
uint32 headerPos = 0;
+
+ // TODO: use loadWAVFromStream to load the WAVE data!
+ /*
+ int rate, size;
+ bye flags;
+ Common::MemoryReadStream stream(fBuf, cSize);
+ isValidWAV = loadWAVFromStream(stream, size, rate, flags);
+ */
+
while ((READ_BE_UINT32(fBuf + headerPos) != 'data') && (headerPos < 100))
headerPos++;
if (headerPos < 100) {
@@ -235,9 +245,9 @@ int16 *Sound::uncompressSpeech(uint32 index, uint32 cSize, uint32 *size) {
if (READ_LE_UINT16(fBuf + headerPos) == 1) {
resSize = READ_LE_UINT16(fBuf + headerPos + 2);
resSize |= READ_LE_UINT16(fBuf + headerPos + 6) << 16;
- resSize >>= 1;
} else
- resSize = READ_LE_UINT32(fBuf + headerPos + 2) >> 1;
+ resSize = READ_LE_UINT32(fBuf + headerPos + 2);
+ resSize >>= 1;
}
assert(!(headerPos & 1));
int16 *srcData = (int16*)fBuf;