Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scale TTS volume with in-game volume #184

Open
Rukishou opened this issue Oct 9, 2023 · 3 comments
Open

Scale TTS volume with in-game volume #184

Rukishou opened this issue Oct 9, 2023 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Rukishou
Copy link

Rukishou commented Oct 9, 2023

Would be nice to have an option that scales the spoken volume to your in-game master or voice volume

@karashiiro karashiiro added the enhancement New feature or request label Mar 12, 2024
@ryankhart
Copy link
Collaborator

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

@RenNagasaki
Copy link

RenNagasaki commented Jul 23, 2024

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;
}

@ryankhart ryankhart added the good first issue Good for newcomers label Jul 25, 2024
@ryankhart
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants