aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/smush/smush_mixer.cpp
diff options
context:
space:
mode:
authorMax Horn2006-10-28 00:18:13 +0000
committerMax Horn2006-10-28 00:18:13 +0000
commit48e5ec67ffcc3f45816507d53d7b276414a31867 (patch)
treecf4b88062da3f829b45aadb980c3bf25c64006cd /engines/scumm/smush/smush_mixer.cpp
parentd90762c430d9ee20ca4137d324aac5dc8308fdd6 (diff)
downloadscummvm-rg350-48e5ec67ffcc3f45816507d53d7b276414a31867.tar.gz
scummvm-rg350-48e5ec67ffcc3f45816507d53d7b276414a31867.tar.bz2
scummvm-rg350-48e5ec67ffcc3f45816507d53d7b276414a31867.zip
SCUMM: Further SMUSH audio channel cleanup; this time unified some code, and got rid of one set of memory buffers
svn-id: r24542
Diffstat (limited to 'engines/scumm/smush/smush_mixer.cpp')
-rw-r--r--engines/scumm/smush/smush_mixer.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/engines/scumm/smush/smush_mixer.cpp b/engines/scumm/smush/smush_mixer.cpp
index ea5d167193..9b0f67045f 100644
--- a/engines/scumm/smush/smush_mixer.cpp
+++ b/engines/scumm/smush/smush_mixer.cpp
@@ -106,24 +106,16 @@ bool SmushMixer::handleFrame() {
} else {
int32 vol, pan;
bool stereo, is_16bit;
- void *data;
_channels[i].chan->getParameters(stereo, is_16bit, vol, pan);
+
int32 size = _channels[i].chan->getAvailableSoundDataSize();
- byte flags = stereo ? Audio::Mixer::FLAG_STEREO : 0;
+ byte *data = _channels[i].chan->getSoundData();
+ byte flags = stereo ? Audio::Mixer::FLAG_STEREO : 0;
if (is_16bit) {
- 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));
- _channels[i].chan->getSoundData((int8 *)data, size);
- size *= stereo ? 2 : 1;
-
flags |= Audio::Mixer::FLAG_UNSIGNED;
}
@@ -134,9 +126,9 @@ bool SmushMixer::handleFrame() {
}
_mixer->setChannelVolume(_channels[i].handle, vol);
_mixer->setChannelBalance(_channels[i].handle, pan);
- _channels[i].stream->append((byte *)data, size);
+ _channels[i].stream->append(data, size);
}
- free(data);
+ delete[] data;
}
}
}