[Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse.cpp,1.78,1.79 dimuse.h,1.47,1.48 dimuse_track.cpp,1.11,1.12
Pawel Kolodziejski
aquadran at users.sourceforge.net
Mon Apr 26 14:31:10 CEST 2004
Update of /cvsroot/scummvm/scummvm/scumm/imuse_digi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20303
Modified Files:
dimuse.cpp dimuse.h dimuse_track.cpp
Log Message:
imuse audio stream are use dynamic append size now
Index: dimuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.cpp,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- dimuse.cpp 26 Apr 2004 07:47:12 -0000 1.78
+++ dimuse.cpp 26 Apr 2004 21:29:49 -0000 1.79
@@ -153,14 +153,9 @@
}
if (_track[l]->stream) {
- int32 mixer_size = _track[l]->pullSize;
byte *data = NULL;
int32 result = 0;
- if (_track[l]->stream->endOfData()) {
- mixer_size *= 2;
- }
-
if (_track[l]->curRegion == -1) {
switchToNextRegion(l);
if (_track[l]->toBeRemoved)
@@ -168,6 +163,25 @@
}
int bits = _sound->getBits(_track[l]->soundHandle);
+ int channels = _sound->getChannels(_track[l]->soundHandle);
+
+ int32 mixer_size = _track[l]->stream->getFreeSpace() - 4;
+ if ((_track[l]->iteration / 2) > mixer_size)
+ continue;
+
+ if ((bits == 12) || (bits == 16)) {
+ if (channels == 1)
+ mixer_size &= ~1;
+ if (channels == 2)
+ mixer_size &= ~3;
+ } else {
+ if (channels == 2)
+ mixer_size &= ~1;
+ }
+
+ if (mixer_size == 0)
+ continue;
+
do {
if (bits == 12) {
byte *ptr = NULL;
@@ -184,16 +198,15 @@
free(ptr);
} else if (bits == 16) {
result = _sound->getDataFromRegion(_track[l]->soundHandle, _track[l]->curRegion, &data, _track[l]->regionOffset, mixer_size);
- if (_sound->getChannels(_track[l]->soundHandle) == 1) {
+ if (channels == 1) {
result &= ~1;
}
- if (_sound->getChannels(_track[l]->soundHandle) == 2) {
- if (result & 2)
- result &= ~2;
+ if (channels == 2) {
+ result &= ~3;
}
} else if (bits == 8) {
result = _sound->getDataFromRegion(_track[l]->soundHandle, _track[l]->curRegion, &data, _track[l]->regionOffset, mixer_size);
- if (_sound->getChannels(_track[l]->soundHandle) == 2) {
+ if (channels == 2) {
result &= ~1;
}
}
Index: dimuse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- dimuse.h 26 Apr 2004 19:30:11 -0000 1.47
+++ dimuse.h 26 Apr 2004 21:29:49 -0000 1.48
@@ -63,7 +63,6 @@
int volGroupId;
int iteration;
int mod;
- int32 pullSize;
int32 mixerFlags;
int mixerVol;
int mixerPan;
Index: dimuse_track.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_track.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- dimuse_track.cpp 26 Apr 2004 19:30:12 -0000 1.11
+++ dimuse_track.cpp 26 Apr 2004 21:29:49 -0000 1.12
@@ -145,20 +145,16 @@
freq -= (freq % 25);
_track[l]->iteration = freq * channels;
- _track[l]->pullSize = _track[l]->iteration;
if (channels == 2)
_track[l]->mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO;
if ((bits == 12) || (bits == 16)) {
_track[l]->mixerFlags |= SoundMixer::FLAG_16BITS;
_track[l]->iteration *= 2;
- _track[l]->pullSize = _track[l]->iteration;
} else if (bits == 8) {
_track[l]->mixerFlags |= SoundMixer::FLAG_UNSIGNED;
} else
error("IMuseDigital::startSound(): Can't handle %d bit samples", bits);
-
- _track[l]->pullSize /= 25; // We want a "frame rate" of 25 audio blocks per second
}
if (input) {
@@ -292,7 +288,6 @@
_track[track]->mixerVol = _track[fadeTrack]->mixerVol;
_track[track]->mixerPan = _track[fadeTrack]->mixerPan;
_track[track]->mod = _track[fadeTrack]->mod;
- _track[track]->pullSize = _track[fadeTrack]->pullSize;
_track[track]->used = _track[fadeTrack]->used;
_track[track]->toBeRemoved = _track[fadeTrack]->toBeRemoved;
_track[track]->started = _track[fadeTrack]->started;
More information about the Scummvm-git-logs
mailing list