[Scummvm-cvs-logs] CVS: scummvm/scumm imuse.cpp,1.29,1.30
Pawe? Ko?odziejski
aquadran at users.sourceforge.net
Thu Oct 3 01:04:01 CEST 2002
Update of /cvsroot/scummvm/scummvm/scumm
In directory usw-pr-cvs1:/tmp/cvs-serv23682
Modified Files:
imuse.cpp
Log Message:
added prebuffer (if new_mixer -> mixer_size*2) (imuse)
Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- imuse.cpp 3 Oct 2002 07:42:25 -0000 1.29
+++ imuse.cpp 3 Oct 2002 08:03:41 -0000 1.30
@@ -4873,8 +4873,29 @@
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 @@
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 @@
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 @@
}
}
- 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 @@
}
_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;
}
More information about the Scummvm-git-logs
mailing list