[Scummvm-cvs-logs] SF.net SVN: scummvm: [22081] scummvm/trunk/engines/simon
kirben at users.sourceforge.net
kirben at users.sourceforge.net
Fri Apr 21 20:54:01 CEST 2006
Revision: 22081
Author: kirben
Date: 2006-04-21 20:53:14 -0700 (Fri, 21 Apr 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=22081&view=rev
Log Message:
-----------
Enable MS ADPCM WAV format decoder for all sound in Macintosh version of FF and cleanup
Modified Paths:
--------------
scummvm/trunk/engines/simon/sound.cpp
scummvm/trunk/engines/simon/sound.h
Modified: scummvm/trunk/engines/simon/sound.cpp
===================================================================
--- scummvm/trunk/engines/simon/sound.cpp 2006-04-22 03:00:21 UTC (rev 22080)
+++ scummvm/trunk/engines/simon/sound.cpp 2006-04-22 03:53:14 UTC (rev 22081)
@@ -25,6 +25,8 @@
#include "simon/simon.h"
#include "simon/sound.h"
+#include "sound/adpcm.h"
+#include "sound/audiostream.h"
#include "sound/flac.h"
#include "sound/mp3.h"
#include "sound/voc.h"
@@ -578,39 +580,37 @@
playSoundData(&_sfx5Handle, soundData, sound, pan, vol, true);
}
+void Sound::playVoiceData(byte *soundData, uint sound) {
+ _mixer->stopHandle(_voiceHandle);
+ playSoundData(&_voiceHandle, soundData, sound);
+}
+
void Sound::playSoundData(Audio::SoundHandle *handle, byte *soundData, uint sound, uint pan, uint vol, bool loop) {
- byte flags;
- int rate;
+ byte *buffer, flags;
+ uint16 compType;
+ int blockAlign, rate;
int size = READ_LE_UINT32(soundData + 4);
Common::MemoryReadStream stream(soundData, size);
- if (!loadWAVFromStream(stream, size, rate, flags)) {
+ if (!loadWAVFromStream(stream, size, rate, flags, &compType, &blockAlign)) {
error("playSoundData: Not a valid WAV data");
}
if (loop == true)
flags |= Audio::Mixer::FLAG_LOOP;
- byte *buffer = (byte *)malloc(size);
- memcpy(buffer, soundData + stream.pos(), size);
- _mixer->playRaw(handle, buffer, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE);
-}
-
-void Sound::playVoiceData(byte *soundData, uint sound) {
- byte flags;
- int rate;
-
- int size = READ_LE_UINT32(soundData + 4);
- Common::MemoryReadStream stream(soundData, size);
- if (!loadWAVFromStream(stream, size, rate, flags)) {
- error("playSoundData: Not a valid WAV data");
+ if (compType == 2) {
+ AudioStream *sndStream = makeADPCMStream(&stream, size, kADPCMMS, rate, (flags & Audio::Mixer::FLAG_STEREO) ? 2 : 1, blockAlign);
+ buffer = (byte *)malloc(size * 4);
+ size = sndStream->readBuffer((int16*)buffer, size * 2);
+ size *= 2; // 16bits.
+ delete sndStream;
+ } else {
+ buffer = (byte *)malloc(size);
+ memcpy(buffer, soundData + stream.pos(), size);
}
- byte *buffer = (byte *)malloc(size);
- memcpy(buffer, soundData + stream.pos(), size);
-
- _mixer->stopHandle(_voiceHandle);
- _mixer->playRaw(&_voiceHandle, buffer, size, rate, flags);
+ _mixer->playRaw(handle, buffer, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE);
}
void Sound::stopSfx5() {
Modified: scummvm/trunk/engines/simon/sound.h
===================================================================
--- scummvm/trunk/engines/simon/sound.h 2006-04-22 03:00:21 UTC (rev 22080)
+++ scummvm/trunk/engines/simon/sound.h 2006-04-22 03:53:14 UTC (rev 22081)
@@ -76,7 +76,7 @@
void playAmbientData(byte *soundData, uint sound, uint pan, uint vol);
void playSfxData(byte *soundData, uint sound, uint pan, uint vol);
void playSfx5Data(byte *soundData, uint sound, uint pan, uint vol);
- void playSoundData(Audio::SoundHandle *handle, byte *soundData, uint sound, uint pan, uint vol, bool loop);
+ void playSoundData(Audio::SoundHandle *handle, byte *soundData, uint sound, uint pan = 0, uint vol = 0, bool loop = false);
void playVoiceData(byte *soundData, uint sound);
void switchVoiceFile(const GameSpecificSettings *gss, uint disc);
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