aboutsummaryrefslogtreecommitdiff
path: root/scumm/player_v1.cpp
diff options
context:
space:
mode:
authorMax Horn2003-09-19 14:43:57 +0000
committerMax Horn2003-09-19 14:43:57 +0000
commit0c8df2838793316b1ed182ad66d569dbbae8312d (patch)
tree9d467eda645e3690734ee20cea0b00d2c9ffa2f2 /scumm/player_v1.cpp
parentabdc8f1247e81b689584b8aca6f4de70768d065b (diff)
downloadscummvm-rg350-0c8df2838793316b1ed182ad66d569dbbae8312d.tar.gz
scummvm-rg350-0c8df2838793316b1ed182ad66d569dbbae8312d.tar.bz2
scummvm-rg350-0c8df2838793316b1ed182ad66d569dbbae8312d.zip
cleanup; some more fixed need afnow that the premix proc is expected to generate stereo data; (we probably should add a common base class for Player_V1/V2 instead of deriving V1 from V2)
svn-id: r10312
Diffstat (limited to 'scumm/player_v1.cpp')
-rw-r--r--scumm/player_v1.cpp41
1 files changed, 10 insertions, 31 deletions
diff --git a/scumm/player_v1.cpp b/scumm/player_v1.cpp
index 3236e2cf63..57288ae2a5 100644
--- a/scumm/player_v1.cpp
+++ b/scumm/player_v1.cpp
@@ -56,7 +56,6 @@ void Player_V1::chainSound(int nr, byte *data) {
_current_nr = nr;
_current_data = data;
_repeat_chunk = _next_chunk = data + (_pcjr ? 2 : 4);
- _music_timer = 0;
debug(4, "Chaining new sound %d", nr);
if (_pcjr)
@@ -512,43 +511,23 @@ void Player_V1::set_mplex(uint mplex) {
_tick_len = _mplex_step * mplex;
}
-void Player_V1::do_mix(int16 *data, uint len) {
- mutex_up();
- uint step;
-
- do {
- step = len;
- if (step > (_next_tick >> FIXP_SHIFT))
- step = (_next_tick >> FIXP_SHIFT);
+void Player_V1::nextTick() {
+ if (_next_chunk) {
if (_pcjr)
- generatePCjrSamples(data, step);
+ nextPCjrCmd();
else
- generateSpkSamples(data, step);
- data += 2 * step;
- _next_tick -= step << FIXP_SHIFT;
-
- if (!(_next_tick >> FIXP_SHIFT)) {
- _next_tick += _tick_len;
- if (_next_chunk) {
- if (_pcjr)
- nextPCjrCmd();
- else
- nextSpeakerCmd();
- }
- }
- } while (len -= step);
- mutex_down();
+ nextSpeakerCmd();
+ }
}
void Player_V1::generateSpkSamples(int16 *data, uint len) {
uint i;
- memset (data, 0, sizeof(int16) * len);
+ memset(data, 0, 2 * sizeof(int16) * len);
if (_channels[0].freq == 0) {
if (_forced_level) {
- for (i = 0; i < len; i++) {
- data[i] = _volumetable[0];
- }
+ for (i = 0; i < len; i++)
+ data[2*i] = data[2*i+1] = _volumetable[0];
debug(9, "speaker: %8x: forced one", _tick_len);
} else if (!_level) {
return;
@@ -566,11 +545,11 @@ void Player_V1::generatePCjrSamples(int16 *data, uint len) {
uint freq, vol;
bool hasdata = false;
- memset(data, 0, sizeof(int16) * len);
+ memset(data, 0, 2 * sizeof(int16) * len);
if (_forced_level) {
for (i = 0; i < len; i++)
- data[i] = _volumetable[0];
+ data[2*i] = data[2*i+1] = _volumetable[0];
hasdata = true;
debug(9, "channel[4]: %8x: forced one", _tick_len);
}