From 10dd548b854682d7a98bae91db7af4cc008db525 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 28 Nov 2004 23:02:28 +0000 Subject: Changed parameter order of SoundMixer::playInputStream to match that of playRaw svn-id: r15950 --- backends/midi/mt32.cpp | 2 +- graphics/animation.cpp | 2 +- scumm/imuse_digi/dimuse.cpp | 4 ++-- scumm/imuse_digi/dimuse_track.cpp | 4 ++-- scumm/sound.cpp | 2 +- sound/mixer.cpp | 9 +++++++-- sound/mixer.h | 7 +++++-- sword1/sound.cpp | 4 ++-- sword2/driver/d_sound.cpp | 2 +- 9 files changed, 22 insertions(+), 14 deletions(-) diff --git a/backends/midi/mt32.cpp b/backends/midi/mt32.cpp index 26b32614dc..5ca857529c 100644 --- a/backends/midi/mt32.cpp +++ b/backends/midi/mt32.cpp @@ -267,7 +267,7 @@ int MidiDriver_MT32::open() { _initialising = false; g_system->clearScreen(); g_system->updateScreen(); - _mixer->playInputStream(&_handle, this, false, 255, 0, -1, false, true); + _mixer->playInputStream(&_handle, this, false, -1, 255, 0, false, true); return 0; } diff --git a/graphics/animation.cpp b/graphics/animation.cpp index 2ce89fc838..ff0968e18a 100644 --- a/graphics/animation.cpp +++ b/graphics/animation.cpp @@ -133,7 +133,7 @@ bool BaseAnimationState::init(const char *name) { bgSoundStream = AudioStream::openStreamFile(name); if (bgSoundStream != NULL) { - _snd->playInputStream(&bgSound, bgSoundStream, false, 255, 0, -1, false); + _snd->playInputStream(&bgSound, bgSoundStream, false, -1, 255, 0, false); } else { warning("Cutscene: Could not open Audio Track for %s", name); } diff --git a/scumm/imuse_digi/dimuse.cpp b/scumm/imuse_digi/dimuse.cpp index 9d482dac62..c9527672ee 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, track->mixerVol, track->mixerPan, -1, false); + _vm->_mixer->playInputStream(&track->handle, track->stream, false, -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, vol, pan, -1, false); + _vm->_mixer->playInputStream(&track->handle, track->stream2, false, -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 98af395ea8..c59848d4b0 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, track->mixerVol, track->mixerPan, -1, false); + _vm->_mixer->playInputStream(&track->handle, track->stream, false, -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, fadeTrack->vol / 1000, fadeTrack->pan, -1, false); + _vm->_mixer->playInputStream(&fadeTrack->handle, fadeTrack->stream, false, -1, fadeTrack->vol / 1000, fadeTrack->pan, false); fadeTrack->started = true; fadeTrack->used = true; diff --git a/scumm/sound.cpp b/scumm/sound.cpp index aba75c1465..e4ab81c99c 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, 255, 0, id); + _vm->_mixer->playInputStream(handle, input, false, id); } } diff --git a/sound/mixer.cpp b/sound/mixer.cpp index 1e7b0c9c80..6e8f514c1f 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -171,7 +171,8 @@ void SoundMixer::insertChannel(PlayingSoundHandle *handle, Channel *chan) { handle->setIndex(index); } -void SoundMixer::playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, int id, byte volume, int8 balance, uint32 loopStart, uint32 loopEnd) { +void SoundMixer::playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, + int id, byte volume, int8 balance, uint32 loopStart, uint32 loopEnd) { Common::StackLock lock(_mutex); // Prevent duplicate sounds @@ -204,7 +205,8 @@ void SoundMixer::playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, u insertChannel(handle, chan); } -void SoundMixer::playInputStream(PlayingSoundHandle *handle, AudioStream *input, bool isMusic, byte volume, int8 balance, int id, bool autofreeStream, bool permanent) { +void SoundMixer::playInputStream(PlayingSoundHandle *handle, AudioStream *input, bool isMusic, + int id, byte volume, int8 balance, bool autofreeStream, bool permanent) { Common::StackLock lock(_mutex); if (input == 0) { @@ -409,6 +411,9 @@ void SoundMixer::setVolume(int volume) { volume = 256; else if (volume < 0) volume = 0; + + // TODO: Maybe we should do logarithmic (not linear) volume + // scaling? See also Player_V2::setMasterVolume _globalVolume = volume; } diff --git a/sound/mixer.h b/sound/mixer.h index b071c7b293..2f9d5713a3 100644 --- a/sound/mixer.h +++ b/sound/mixer.h @@ -126,12 +126,15 @@ public: * passed on to playInputStream. */ void playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, - int id = -1, byte volume = 255, int8 balance = 0, uint32 loopStart = 0, uint32 loopEnd = 0); + int id = -1, byte volume = 255, int8 balance = 0, + uint32 loopStart = 0, uint32 loopEnd = 0); /** * Start playing the given audio input stream. */ - void playInputStream(PlayingSoundHandle *handle, AudioStream *input, bool isMusic, byte volume = 255, int8 balance = 0, int id = -1, bool autofreeStream = true, bool permanent = false); + void playInputStream(PlayingSoundHandle *handle, AudioStream *input, bool isMusic, + int id = -1, byte volume = 255, int8 balance = 0, + bool autofreeStream = true, bool permanent = false); diff --git a/sword1/sound.cpp b/sword1/sound.cpp index c9b5806f5a..e409af5e02 100644 --- a/sword1/sound.cpp +++ b/sword1/sound.cpp @@ -194,7 +194,7 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) { #ifdef USE_MAD else if (_cowMode == CowMp3) { _cowFile.seek(index); - _mixer->playInputStream(&_speechHandle, makeMP3Stream(&_cowFile, sampleSize), false, speechVol, speechPan, SOUND_SPEECH_ID); + _mixer->playInputStream(&_speechHandle, makeMP3Stream(&_cowFile, sampleSize), false, SOUND_SPEECH_ID, speechVol, speechPan); // with compressed audio, we can't calculate the wave volume. // so default to talking. for (int cnt = 0; cnt < 480; cnt++) @@ -205,7 +205,7 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) { #ifdef USE_VORBIS else if (_cowMode == CowVorbis) { _cowFile.seek(index); - _mixer->playInputStream(&_speechHandle, makeVorbisStream(&_cowFile, sampleSize), false, speechVol, speechPan, SOUND_SPEECH_ID); + _mixer->playInputStream(&_speechHandle, makeVorbisStream(&_cowFile, sampleSize), false, SOUND_SPEECH_ID, speechVol, speechPan); for (int cnt = 0; cnt < 480; cnt++) _waveVolume[cnt] = true; _waveVolPos = 0; diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp index 6f6d4d94d3..5515dd7e81 100644 --- a/sword2/driver/d_sound.cpp +++ b/sword2/driver/d_sound.cpp @@ -936,7 +936,7 @@ int32 Sound::playCompSpeech(uint32 speechid, uint8 vol, int8 pan) { int8 p = _panTable[pan + 16]; // Start the speech playing - _vm->_mixer->playInputStream(&_soundHandleSpeech, input, false, volume, p); + _vm->_mixer->playInputStream(&_soundHandleSpeech, input, false, -1, volume, p); return RD_OK; } -- cgit v1.2.3