aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorPaweł Kołodziejski2002-10-03 08:03:41 +0000
committerPaweł Kołodziejski2002-10-03 08:03:41 +0000
commit9e0906c723adc33b3297617e2bcd58d00c08a98e (patch)
tree1d20f83b4e677ab2b9ade8a8a2be3d01afac9bdd /scumm
parent830dfe090f6b455fc5e3db8e20311ae8ccec7619 (diff)
downloadscummvm-rg350-9e0906c723adc33b3297617e2bcd58d00c08a98e.tar.gz
scummvm-rg350-9e0906c723adc33b3297617e2bcd58d00c08a98e.tar.bz2
scummvm-rg350-9e0906c723adc33b3297617e2bcd58d00c08a98e.zip
added prebuffer (if new_mixer -> mixer_size*2) (imuse)
svn-id: r5083
Diffstat (limited to 'scumm')
-rw-r--r--scumm/imuse.cpp47
1 files changed, 26 insertions, 21 deletions
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp
index b5ab8176e3..fc294b5017 100644
--- a/scumm/imuse.cpp
+++ b/scumm/imuse.cpp
@@ -4873,8 +4873,29 @@ void IMuseDigital::handler() {
uint32 new_size = _channel[l]._mixerSize;
uint32 mixer_size = new_size;
+ new_mixer = false;
+ if (_channel[l]._mixerTrack == -1) {
+ _scumm->_system->lock_mutex(_scumm->_mixer->_mutex);
+ for (idx = 0; idx < SoundMixer::NUM_CHANNELS; idx++) {
+ if (_scumm->_mixer->_channels[idx] == NULL) {
+ _channel[l]._mixerTrack = idx;
+ new_mixer = true;
+ break;
+ }
+ }
+ }
+ if(SoundMixer::NUM_CHANNELS == idx) {
+ warning("IMuseDigital::handler() no free SoundMixer channel");
+ return;
+ }
+
+ if (new_mixer == true) {
+ mixer_size *= 2;
+ new_size *= 2;
+ }
+
if (_channel[l]._isLoop == false) {
- if (_channel[l]._offset + _channel[l]._mixerSize > _channel[l]._size) {
+ if (_channel[l]._offset + mixer_size > _channel[l]._size) {
new_size = _channel[l]._size - _channel[l]._offset;
_channel[l]._toBeRemoved = true;
mixer_size = new_size;
@@ -4883,7 +4904,7 @@ void IMuseDigital::handler() {
if (_channel[l]._jump[0]._numLoops != 500) {
_channel[l]._jump[0]._numLoops--;
}
- if (_channel[l]._offset + _channel[l]._mixerSize >= _channel[l]._jump[0]._offset) {
+ if (_channel[l]._offset + mixer_size >= _channel[l]._jump[0]._offset) {
new_size = _channel[l]._jump[0]._offset - _channel[l]._offset;
}
}
@@ -4891,7 +4912,7 @@ void IMuseDigital::handler() {
byte *buf = (byte*)malloc(mixer_size);
memcpy(buf, _channel[l]._data + _channel[l]._offset, new_size);
if ((new_size != _channel[l]._mixerSize) && (_channel[l]._isLoop == true)) {
- memcpy(buf + new_size, _channel[l]._data + _channel[l]._jump[0]._dest, _channel[l]._mixerSize - new_size);
+ memcpy(buf + new_size, _channel[l]._data + _channel[l]._jump[0]._dest, mixer_size - new_size);
}
if (_channel[l]._volumeFade != -1) {
@@ -4921,22 +4942,6 @@ void IMuseDigital::handler() {
}
}
- new_mixer = false;
- if (_channel[l]._mixerTrack == -1) {
- _scumm->_system->lock_mutex(_scumm->_mixer->_mutex);
- for (idx = 0; idx < SoundMixer::NUM_CHANNELS; idx++) {
- if (_scumm->_mixer->_channels[idx] == NULL) {
- _channel[l]._mixerTrack = idx;
- new_mixer = true;
- break;
- }
- }
- }
- if(SoundMixer::NUM_CHANNELS == idx) {
- warning("IMuseDigital::handler() no free SoundMixer channel");
- return;
- }
-
if (new_mixer) {
_scumm->_mixer->playStream(NULL, _channel[l]._mixerTrack, buf, mixer_size,
_channel[l]._freq, _channel[l]._mixerFlags);
@@ -4946,8 +4951,8 @@ void IMuseDigital::handler() {
}
_scumm->_system->unlock_mutex(_scumm->_mixer->_mutex);
- if ((new_size != _channel[l]._mixerSize) && (_channel[l]._isLoop == true)) {
- _channel[l]._offset = _channel[l]._jump[0]._dest + (_channel[l]._mixerSize - new_size);
+ if ((new_size != mixer_size) && (_channel[l]._isLoop == true)) {
+ _channel[l]._offset = _channel[l]._jump[0]._dest + (mixer_size - new_size);
} else {
_channel[l]._offset += _channel[l]._mixerSize;
}