Fix volume change in settings not affecting voice track

This commit is contained in:
Lwmte 2023-08-26 09:58:52 +02:00
parent 7fa185b730
commit ce447f3d0b
5 changed files with 13 additions and 15 deletions

View file

@ -5,9 +5,10 @@ Version 1.1.1
* Fix projectiles flying through animating objects.
* Fix harpoon gun doing enormous damage on enemies.
* Fix train death animation.
* Fix knife thrower AI.
* Fix TR1 wolf damage value inflicted on a close bite attack.
* Fix TR1 bear various original AI issues.
* Fix TR2 knife thrower AI.
* Fix volume change in settings not affecting voice track.
* Overhaul look mode:
- Allow for consistent and wider viewing angles while crawling, crouching, and hanging.
- Improve movement and control.

View file

@ -881,7 +881,7 @@ namespace TEN::Gui
MenuToDisplay = Menu::Options;
SelectedOption = 1;
SetVolumeMusic(g_Configuration.MusicVolume);
SetVolumeTracks(g_Configuration.MusicVolume);
SetVolumeFX(g_Configuration.SfxVolume);
return;
}
@ -929,7 +929,7 @@ namespace TEN::Gui
if (CurrentSettings.Configuration.MusicVolume < 0)
CurrentSettings.Configuration.MusicVolume = 0;
SetVolumeMusic(CurrentSettings.Configuration.MusicVolume);
SetVolumeTracks(CurrentSettings.Configuration.MusicVolume);
isVolumeAdjusted = true;
}
@ -968,7 +968,7 @@ namespace TEN::Gui
if (CurrentSettings.Configuration.MusicVolume > VOLUME_MAX)
CurrentSettings.Configuration.MusicVolume = VOLUME_MAX;
SetVolumeMusic(CurrentSettings.Configuration.MusicVolume);
SetVolumeTracks(CurrentSettings.Configuration.MusicVolume);
isVolumeAdjusted = true;
}
@ -1046,7 +1046,7 @@ namespace TEN::Gui
else if (SelectedOption == OtherSettingsOption::Cancel)
{
SoundEffect(SFX_TR4_MENU_SELECT, nullptr, SoundEnvironment::Always);
SetVolumeMusic(g_Configuration.MusicVolume);
SetVolumeTracks(g_Configuration.MusicVolume);
SetVolumeFX(g_Configuration.SfxVolume);
MenuToDisplay = fromPauseMenu ? Menu::Pause : Menu::Options;
SelectedOption = 1;

View file

@ -48,18 +48,15 @@ static int SecretSoundIndex = 5;
static int GlobalMusicVolume;
static int GlobalFXVolume;
void SetVolumeMusic(int vol)
void SetVolumeTracks(int vol)
{
GlobalMusicVolume = vol;
float fVol = static_cast<float>(vol) / 100.0f;
if (BASS_ChannelIsActive(SoundtrackSlot[(int)SoundTrackType::BGM].Channel))
for (int i = 0; i < (int)SoundTrackType::Count; i++)
{
BASS_ChannelSetAttribute(SoundtrackSlot[(int)SoundTrackType::BGM].Channel, BASS_ATTRIB_VOL, fVol);
}
if (BASS_ChannelIsActive(SoundtrackSlot[(int)SoundTrackType::OneShot].Channel))
{
BASS_ChannelSetAttribute(SoundtrackSlot[(int)SoundTrackType::OneShot].Channel, BASS_ATTRIB_VOL, fVol);
if (BASS_ChannelIsActive(SoundtrackSlot[i].Channel))
BASS_ChannelSetAttribute(SoundtrackSlot[i].Channel, BASS_ATTRIB_VOL, fVol);
}
}

View file

@ -177,7 +177,7 @@ std::pair<std::string, QWORD> GetSoundTrackNameAndPosition(SoundTrackType type);
static void CALLBACK Sound_FinishOneshotTrack(HSYNC handle, DWORD channel, DWORD data, void* userData);
void SetVolumeMusic(int vol);
void SetVolumeTracks(int vol);
void SetVolumeFX(int vol);
void Sound_Init(const std::string& gameDirectory);

View file

@ -281,7 +281,7 @@ bool SaveConfiguration()
void SaveAudioConfig()
{
SetVolumeMusic(g_Configuration.MusicVolume);
SetVolumeTracks(g_Configuration.MusicVolume);
SetVolumeFX(g_Configuration.SfxVolume);
}
@ -475,7 +475,7 @@ bool LoadConfiguration()
g_Configuration.EnableSubtitles = enableSubtitles;
// Set legacy variables.
SetVolumeMusic(musicVolume);
SetVolumeTracks(musicVolume);
SetVolumeFX(sfxVolume);
DefaultConflict();