From 67b311713d8f4cfcd460a9649e0075f24278a048 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 27 Dec 2004 00:27:00 +0000 Subject: Added 'sound types' to the mixer - for now, only plain (for the premixer), SFX and music; volume is now controlled based on the sound type svn-id: r16330 --- scumm/imuse_digi/dimuse.cpp | 4 ++-- scumm/imuse_digi/dimuse_track.cpp | 4 ++-- scumm/scumm.cpp | 6 +++--- scumm/smush/smush_mixer.cpp | 2 +- scumm/smush/smush_player.cpp | 4 ++-- scumm/sound.cpp | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) (limited to 'scumm') diff --git a/scumm/imuse_digi/dimuse.cpp b/scumm/imuse_digi/dimuse.cpp index c9527672ee..6d2df1d53e 100644 --- a/scumm/imuse_digi/dimuse.cpp +++ b/scumm/imuse_digi/dimuse.cpp @@ -149,7 +149,7 @@ void IMuseDigital::saveOrLoad(Serializer *ser) { int freq = _sound->getFreq(track->soundHandle); track->stream2 = NULL; track->stream = makeAppendableAudioStream(freq, track->mixerFlags, streamBufferSize); - _vm->_mixer->playInputStream(&track->handle, track->stream, false, -1, track->mixerVol, track->mixerPan, false); + _vm->_mixer->playInputStream(SoundMixer::kSFXAudioDataType, &track->handle, track->stream, -1, track->mixerVol, track->mixerPan, false); } } } @@ -289,7 +289,7 @@ void IMuseDigital::callback() { if (_vm->_mixer->isReady()) { if (!track->started) { track->started = true; - _vm->_mixer->playInputStream(&track->handle, track->stream2, false, -1, vol, pan, false); + _vm->_mixer->playInputStream(SoundMixer::kSFXAudioDataType, &track->handle, track->stream2, -1, vol, pan, false); } else { _vm->_mixer->setChannelVolume(track->handle, vol); _vm->_mixer->setChannelBalance(track->handle, pan); diff --git a/scumm/imuse_digi/dimuse_track.cpp b/scumm/imuse_digi/dimuse_track.cpp index c59848d4b0..28a7aa7fd9 100644 --- a/scumm/imuse_digi/dimuse_track.cpp +++ b/scumm/imuse_digi/dimuse_track.cpp @@ -173,7 +173,7 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, int32 streamBufferSize = track->iteration; track->stream2 = NULL; track->stream = makeAppendableAudioStream(freq, track->mixerFlags, streamBufferSize); - _vm->_mixer->playInputStream(&track->handle, track->stream, false, -1, track->mixerVol, track->mixerPan, false); + _vm->_mixer->playInputStream(SoundMixer::kSFXAudioDataType, &track->handle, track->stream, -1, track->mixerVol, track->mixerPan, false); track->started = true; } @@ -305,7 +305,7 @@ IMuseDigital::Track *IMuseDigital::cloneToFadeOutTrack(Track *track, int fadeDel // setup 1 second stream wrapped buffer int32 streamBufferSize = fadeTrack->iteration; fadeTrack->stream = makeAppendableAudioStream(_sound->getFreq(fadeTrack->soundHandle), fadeTrack->mixerFlags, streamBufferSize); - _vm->_mixer->playInputStream(&fadeTrack->handle, fadeTrack->stream, false, -1, fadeTrack->vol / 1000, fadeTrack->pan, false); + _vm->_mixer->playInputStream(SoundMixer::kSFXAudioDataType, &fadeTrack->handle, fadeTrack->stream, -1, fadeTrack->vol / 1000, fadeTrack->pan, false); fadeTrack->started = true; fadeTrack->used = true; diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 338b942429..efb8e3fe87 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -1388,11 +1388,11 @@ void ScummEngine::setupVolumes() { _musicEngine->setMusicVolume(soundVolumeMusic); } - _mixer->setVolume(soundVolumeSfx); - _mixer->setMusicVolume(soundVolumeMusic); + _mixer->setVolumeForSoundType(SoundMixer::kSFXAudioDataType, soundVolumeSfx); + _mixer->setVolumeForSoundType(SoundMixer::kMusicAudioDataType, soundVolumeMusic); if (_imuseDigital) { - _mixer->setVolume(255); + _mixer->setVolumeForSoundType(SoundMixer::kSFXAudioDataType, 255); _imuseDigital->setGroupMusicVolume(soundVolumeMusic / 2); _imuseDigital->setGroupSfxVolume(soundVolumeSfx / 2); _imuseDigital->setGroupVoiceVolume(soundVolumeSpeech / 2); diff --git a/scumm/smush/smush_mixer.cpp b/scumm/smush/smush_mixer.cpp index f7309cb87e..8378200ecd 100644 --- a/scumm/smush/smush_mixer.cpp +++ b/scumm/smush/smush_mixer.cpp @@ -122,7 +122,7 @@ bool SmushMixer::handleFrame() { if (_mixer->isReady()) { if (!_channels[i].handle.isActive()) { _channels[i].stream = makeAppendableAudioStream(rate, flags, 500000); - _mixer->playInputStream(&_channels[i].handle, _channels[i].stream, false); + _mixer->playInputStream(SoundMixer::kSFXAudioDataType, &_channels[i].handle, _channels[i].stream); } _mixer->setChannelVolume(_channels[i].handle, vol); _mixer->setChannelBalance(_channels[i].handle, pan); diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp index 3e5e097c0a..669916cf1b 100644 --- a/scumm/smush/smush_player.cpp +++ b/scumm/smush/smush_player.cpp @@ -503,7 +503,7 @@ void SmushPlayer::handleIACT(Chunk &b) { if (!_IACTchannel.isActive()) { _IACTstream = makeAppendableAudioStream(22050, SoundMixer::FLAG_STEREO | SoundMixer::FLAG_16BITS, 400000); - _vm->_mixer->playInputStream(&_IACTchannel, _IACTstream, false); + _vm->_mixer->playInputStream(SoundMixer::kSFXAudioDataType, &_IACTchannel, _IACTstream); } _IACTstream->append(output_data, 0x1000); @@ -1177,7 +1177,7 @@ void SmushPlayer::tryOggFile(const char *filename) { if (_compressedFile.isOpen()) { int size = _compressedFile.size(); _compressedFileMode = true; - _vm->_mixer->playInputStream(&_compressedFileSoundHandle, makeVorbisStream(&_compressedFile, size), false); + _vm->_mixer->playInputStream(SoundMixer::kSFXAudioDataType, &_compressedFileSoundHandle, makeVorbisStream(&_compressedFile, size)); } #endif } diff --git a/scumm/sound.cpp b/scumm/sound.cpp index a54f45d957..e6f1e9e2c2 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -1029,7 +1029,7 @@ void Sound::startSfxSound(File *file, int file_size, PlayingSoundHandle *handle, //_vm->_imuseDigital->stopSound(kTalkSoundID); _vm->_imuseDigital->startVoice(kTalkSoundID, input); } else { - _vm->_mixer->playInputStream(handle, input, false, id); + _vm->_mixer->playInputStream(SoundMixer::kSFXAudioDataType, handle, input, id); } } @@ -1122,7 +1122,7 @@ ScummFile *Sound::openSfxFile() { } bool Sound::isSfxFinished() const { - return !_vm->_mixer->hasActiveSFXChannel(); + return !_vm->_mixer->hasActiveChannelOfType(SoundMixer::kSFXAudioDataType); } // We use a real timer in an attempt to get better sync with CD tracks. This is -- cgit v1.2.3