aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2003-09-18 16:01:33 +0000
committerMax Horn2003-09-18 16:01:33 +0000
commit9470c9f66131d16ca19d111d21948ba57a1a8eb3 (patch)
tree79aa7b664c9dcab922649ad552ef03fe6ba58e21 /scumm
parentdcf77f7a1008e4a6b98c9face6cc7461c6347e1d (diff)
downloadscummvm-rg350-9470c9f66131d16ca19d111d21948ba57a1a8eb3.tar.gz
scummvm-rg350-9470c9f66131d16ca19d111d21948ba57a1a8eb3.tar.bz2
scummvm-rg350-9470c9f66131d16ca19d111d21948ba57a1a8eb3.zip
changed & documented the premixer semantics
svn-id: r10294
Diffstat (limited to 'scumm')
-rw-r--r--scumm/player_v2.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/scumm/player_v2.cpp b/scumm/player_v2.cpp
index d8910ebf63..b1f7be623c 100644
--- a/scumm/player_v2.cpp
+++ b/scumm/player_v2.cpp
@@ -381,7 +381,7 @@ Player_V2::Player_V2(Scumm *scumm) {
set_pcjr(scumm->_midiDriver != MD_PCSPK);
setMasterVolume(255);
- _mixer->setupPremix(this, premix_proc);
+ _mixer->setupPremix(premix_proc, this);
}
Player_V2::~Player_V2() {
@@ -820,10 +820,12 @@ void Player_V2::next_freqs(ChannelInfo *channel) {
}
}
-void Player_V2::do_mix (int16 *data, uint len) {
+void Player_V2::do_mix(int16 *data, uint len) {
mutex_up();
uint step;
+ int16 *origData = data;
+ uint origLen = len;
do {
step = len;
if (step > (_next_tick >> FIXP_SHIFT))
@@ -848,6 +850,12 @@ void Player_V2::do_mix (int16 *data, uint len) {
}
}
} while (len -= step);
+
+ // Convert mono data to stereo
+ for (int i = (origLen - 1); i >= 0; i--) {
+ origData[2 * i] = origData[2 * i + 1] = origData[i];
+ }
+
mutex_down();
}
@@ -911,7 +919,7 @@ void Player_V2::generateSpkSamples(int16 *data, uint len) {
}
}
- memset (data, 0, sizeof(int16) * len);
+ memset(data, 0, sizeof(int16) * len);
if (winning_channel != -1) {
squareGenerator(0, _channels[winning_channel].d.freq, 0,
0, data, len);