[Scummvm-cvs-logs] SF.net SVN: scummvm: [24541] scummvm/trunk/engines/scumm/smush
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sat Oct 28 02:04:55 CEST 2006
Revision: 24541
http://svn.sourceforge.net/scummvm/?rev=24541&view=rev
Author: fingolfin
Date: 2006-10-27 17:04:50 -0700 (Fri, 27 Oct 2006)
Log Message:
-----------
SCUMM: Changed SaudChannel to return 8bit mono data (the mixer will do any necessary conversions for us, no need to waste memory like this); fix SmushMixer to not allocate buffers twice as big as necessary
Modified Paths:
--------------
scummvm/trunk/engines/scumm/smush/channel.h
scummvm/trunk/engines/scumm/smush/saud_channel.cpp
scummvm/trunk/engines/scumm/smush/smush_mixer.cpp
Modified: scummvm/trunk/engines/scumm/smush/channel.h
===================================================================
--- scummvm/trunk/engines/scumm/smush/channel.h 2006-10-27 23:00:28 UTC (rev 24540)
+++ scummvm/trunk/engines/scumm/smush/channel.h 2006-10-28 00:04:50 UTC (rev 24541)
@@ -87,12 +87,12 @@
bool checkParameters(int32 index, int32 duration, int32 flags, int32 vol1, int32 vol2);
bool appendData(Chunk &b, int32 size);
int32 getAvailableSoundDataSize() const;
- void getSoundData(int16 *sound_buffer, int32 size);
- void getSoundData(int8 *sound_buffer, int32 size) { error("8bit request for SAUD channel should never happen"); };
+ void getSoundData(int16 *sound_buffer, int32 size) { error("16bit request for SAUD channel should never happen"); };
+ void getSoundData(int8 *sound_buffer, int32 size);
int32 getRate() { return 22050; }
bool getParameters(bool &stereo, bool &is_16bit, int32 &vol, int32 &pan) {
- stereo = true;
- is_16bit = true;
+ stereo = false;
+ is_16bit = false;
vol = _volume;
pan = _pan;
return true;
Modified: scummvm/trunk/engines/scumm/smush/saud_channel.cpp
===================================================================
--- scummvm/trunk/engines/scumm/smush/saud_channel.cpp 2006-10-27 23:00:28 UTC (rev 24540)
+++ scummvm/trunk/engines/scumm/smush/saud_channel.cpp 2006-10-28 00:04:50 UTC (rev 24541)
@@ -184,11 +184,8 @@
return _sbufferSize;
}
-void SaudChannel::getSoundData(int16 *snd, int32 size) {
- for (int32 i = 0; i < size; i++) {
- snd[2 * i] = TO_LE_16(_sbuffer[i] ^ 0x80);
- snd[2 * i + 1] = TO_LE_16(_sbuffer[i] ^ 0x80);
- }
+void SaudChannel::getSoundData(int8 *snd, int32 size) {
+ memcpy(snd, _sbuffer, size);
if (!_keepSize)
_dataSize -= size;
delete []_sbuffer;
Modified: scummvm/trunk/engines/scumm/smush/smush_mixer.cpp
===================================================================
--- scummvm/trunk/engines/scumm/smush/smush_mixer.cpp 2006-10-27 23:00:28 UTC (rev 24540)
+++ scummvm/trunk/engines/scumm/smush/smush_mixer.cpp 2006-10-28 00:04:50 UTC (rev 24541)
@@ -113,14 +113,14 @@
byte flags = stereo ? Audio::Mixer::FLAG_STEREO : 0;
if (is_16bit) {
- data = malloc(size * (stereo ? 2 : 1) * 4);
+ data = malloc(size * (stereo ? 4 : 2));
_channels[i].chan->getSoundData((int16 *)data, size);
size *= stereo ? 4 : 2;
flags |= Audio::Mixer::FLAG_16BITS;
} else {
- data = malloc(size * (stereo ? 2 : 1) * 2);
+ data = malloc(size * (stereo ? 2 : 1));
_channels[i].chan->getSoundData((int8 *)data, size);
size *= stereo ? 2 : 1;
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