mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
MADE: Use SFX sound type for sampled audio
The engine used the plain sound type for sampled sound effects and movie audio and applied the SFX user volume control to the plain sound type. This caused emulators like the AdLib emulator and Munt to be affected by the SFX user volume control, because they use the plain sound type. This commit fixes this by using the SFX sound type instead of the plain sound type. User volume is applied by Engine::syncSoundSettings. This commit also fixes the setSoundVolume script function. Volume was previously applied to the SFX and speech sound types, which were not used. Also, by directly using Mixer::setVolumeForSoundType, it would override the user volume setting. This is fixed by storing the game sound volume in a field and applying this to the current and future audio streams. This fixes bug #6444.
This commit is contained in:
parent
84e88b9b3c
commit
69629944e5
@ -114,8 +114,6 @@ void MadeEngine::syncSoundSettings() {
|
||||
mute = ConfMan.getBool("mute");
|
||||
|
||||
_music->setVolume(mute ? 0 : ConfMan.getInt("music_volume"));
|
||||
_mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType,
|
||||
mute ? 0 : ConfMan.getInt("sfx_volume"));
|
||||
}
|
||||
|
||||
int16 MadeEngine::getTicks() {
|
||||
|
@ -189,7 +189,7 @@ bool PmvPlayer::play(const char *filename) {
|
||||
decompressMovieImage(imageData, *_surface, cmdOffs, pixelOffs, maskOffs, lineSize);
|
||||
|
||||
if (firstTime) {
|
||||
_mixer->playStream(Audio::Mixer::kPlainSoundType, &_audioStreamHandle, _audioStream);
|
||||
_mixer->playStream(Audio::Mixer::kSFXSoundType, &_audioStreamHandle, _audioStream);
|
||||
soundStartTime = g_system->getMillis();
|
||||
skipFrames = 0;
|
||||
firstTime = false;
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
namespace Made {
|
||||
|
||||
ScriptFunctions::ScriptFunctions(MadeEngine *vm) : _vm(vm), _soundStarted(false) {
|
||||
ScriptFunctions::ScriptFunctions(MadeEngine *vm) : _vm(vm), _soundStarted(false), _gameAudioVolume(Audio::Mixer::kMaxChannelVolume) {
|
||||
// Initialize the two tone generators
|
||||
_pcSpeaker1 = new Audio::PCSpeaker();
|
||||
_pcSpeaker2 = new Audio::PCSpeaker();
|
||||
@ -252,8 +252,8 @@ int16 ScriptFunctions::sfPlaySound(int16 argc, int16 *argv) {
|
||||
}
|
||||
if (soundNum > 0) {
|
||||
SoundResource *soundRes = _vm->_res->getSound(soundNum);
|
||||
_vm->_mixer->playStream(Audio::Mixer::kPlainSoundType, &_audioStreamHandle,
|
||||
soundRes->getAudioStream(_vm->_soundRate, false));
|
||||
_vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_audioStreamHandle,
|
||||
soundRes->getAudioStream(_vm->_soundRate, false), -1, _gameAudioVolume);
|
||||
_vm->_soundEnergyArray = soundRes->getSoundEnergyArray();
|
||||
_vm->_soundEnergyIndex = 0;
|
||||
_soundStarted = true;
|
||||
@ -641,8 +641,8 @@ int16 ScriptFunctions::sfPlayVoice(int16 argc, int16 *argv) {
|
||||
stopSound();
|
||||
if (soundNum > 0) {
|
||||
_soundResource = _vm->_res->getSound(soundNum);
|
||||
_vm->_mixer->playStream(Audio::Mixer::kPlainSoundType, &_audioStreamHandle,
|
||||
_soundResource->getAudioStream(_vm->_soundRate, false));
|
||||
_vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_audioStreamHandle,
|
||||
_soundResource->getAudioStream(_vm->_soundRate, false), -1, _gameAudioVolume);
|
||||
_vm->_autoStopSound = true;
|
||||
_soundStarted = true;
|
||||
}
|
||||
@ -1013,8 +1013,9 @@ int16 ScriptFunctions::sfPlaceMenu(int16 argc, int16 *argv) {
|
||||
}
|
||||
|
||||
int16 ScriptFunctions::sfSetSoundVolume(int16 argc, int16 *argv) {
|
||||
_vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, argv[0] * 25);
|
||||
_vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, argv[0] * 25);
|
||||
_gameAudioVolume = argv[0] * 25;
|
||||
if (_vm->_mixer->isSoundHandleActive(_audioStreamHandle))
|
||||
_vm->_mixer->setChannelVolume(_audioStreamHandle, _gameAudioVolume);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,8 @@ protected:
|
||||
Audio::SoundHandle _voiceStreamHandle;
|
||||
SoundResource* _soundResource;
|
||||
bool _soundStarted;
|
||||
// The audio volume set by the game scripts.
|
||||
uint8 _gameAudioVolume;
|
||||
|
||||
// PlayNote/StopNote and PlayTele/StopTele wave generators
|
||||
Audio::SoundHandle _pcSpeakerHandle1, _pcSpeakerHandle2;
|
||||
|
Loading…
Reference in New Issue
Block a user