Use souStreamUsed to distinguish between 'stream' and 'streamSou' usage

svn-id: r30257
This commit is contained in:
Max Horn 2008-01-05 20:49:18 +00:00
parent c9a8d02f6e
commit 8b12998c72
3 changed files with 17 additions and 14 deletions

View File

@ -277,7 +277,8 @@ void IMuseDigital::callback() {
if (track->volGroupId == 3)
type = Audio::Mixer::kMusicSoundType;
if (track->stream) {
if (!track->souStreamUsed) {
assert(track->stream);
byte *tmpSndBufferPtr = NULL;
int32 curFeedSize = 0;
@ -357,7 +358,8 @@ void IMuseDigital::callback() {
feedSize -= curFeedSize;
assert(feedSize >= 0);
} while (feedSize != 0);
} else if (track->streamSou) {
} else {
assert(track->streamSou);
if (_mixer->isReady()) {
// FIXME: Can't we replace track->mixerStreamRunning by
// _mixer->isSoundHandleActive(track->mixChanHandle) ?

View File

@ -165,7 +165,8 @@ void IMuseDigital::parseScriptCmds(int cmd, int b, int c, int d, int e, int f, i
void IMuseDigital::flushTrack(Track *track) {
track->toBeRemoved = true;
if (track->stream) {
if (!track->souStreamUsed) {
assert(track->stream);
// Finalize the appendable stream
track->stream->finish();
// There might still be some data left in the buffers of the
@ -179,7 +180,8 @@ void IMuseDigital::flushTrack(Track *track) {
track->soundDesc = NULL;
track->used = false;
}
} else if (track->streamSou) {
} else {
assert(track->streamSou);
_mixer->stopHandle(track->mixChanHandle);
delete track->streamSou;
track->streamSou = NULL;
@ -397,13 +399,15 @@ void IMuseDigital::stopAllSounds() {
// Stop the sound output, *now*. No need to use toBeRemoved etc.
// as we are protected by a mutex, and this method is never called
// from IMuseDigital::callback either.
if (track->stream) {
if (!track->souStreamUsed) {
assert(track->stream);
_mixer->stopHandle(track->mixChanHandle);
delete track->stream;
track->stream = NULL;
_sound->closeSound(track->soundDesc);
track->soundDesc = NULL;
} else if (track->streamSou) {
assert(track->streamSou);
_mixer->stopHandle(track->mixChanHandle);
delete track->streamSou;
track->streamSou = NULL;

View File

@ -114,13 +114,16 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType,
int bits = 0, freq = 0, channels = 0;
if (input) {
track->souStreamUsed = (input != 0);
if (track->souStreamUsed) {
track->feedSize = 0;
track->souStreamUsed = true;
track->soundName[0] = 0;
track->soundDesc = NULL;
track->streamSou = input;
track->stream = NULL;
track->mixerStreamRunning = false;
} else {
track->souStreamUsed = false;
strcpy(track->soundName, soundName);
track->soundDesc = _sound->openSound(soundId, soundName, soundType, volGroupId, -1);
@ -162,13 +165,7 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType,
if (track->sndDataExtComp)
track->mixerFlags |= kFlagLittleEndian;
#endif
}
if (input) {
track->streamSou = input;
track->stream = NULL;
track->mixerStreamRunning = false;
} else {
const int pan = (track->pan != 64) ? 2 * track->pan - 127 : 0;
const int vol = track->vol / 1000;
Audio::Mixer::SoundType type = Audio::Mixer::kPlainSoundType;