Scale TTS volume with in-game volume
Would be nice to have an option that scales the spoken volume to your in-game master or voice volume
I just had this idea as well when I decided to install the StanleyParableXiv plugin and saw that it had the configuration option to tie the narrator volume to the game volume.
I'll link it here as inspiration in case Karashiiro or maybe I feel like tackling this feature in the future.
https://github.com/rekyuu/StanleyParableXiv/blob/e14e7cd19e966a9f594abdb4d1ce2557eb2b4de2/StanleyParableXiv/Configuration.cs#L24
Volume can easily be read by this:
public static unsafe float GetVoiceVolume(IGameConfig gameConfig)
{
var voiceVolume = .5f;
var masterVolume = .5f;
var instance = Framework.Instance();
if (instance != null && instance->SoundManager != null)
{
var soundManager = instance->SoundManager;
masterVolume = soundManager->MasterVolume;
voiceVolume = soundManager->GetEffectiveVolume(SoundManager.SoundChannel.Voice);
var isMasterMuted = false;
var isVoiceMuted = false;
gameConfig.System.TryGetBool("IsSndMaster", out isMasterMuted);
gameConfig.System.TryGetBool("IsSndVoice", out isVoiceMuted);
if (isMasterMuted || isVoiceMuted)
return 0f;
}
var volumeFloat = masterVolume * voiceVolume;
return volumeFloat;
}
Thank you! I may try that sometime and see how it goes, but I'll want to run it by Karashiiro before I merge anything into the main branch.