Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Nixxon on Sun 12/04/2015 08:01:26

Title: Music volume during speech
Post by: Nixxon on Sun 12/04/2015 08:01:26
Hey Guys,

When I have dialog speech playing the music volume is 0, I would just like it to be faint instead of non existent.

Searched the forums and found this command - speech_music_drop

Ctrl-F in the global script and can't find it or anything that relates to this function.

Just wondering how I would achieve this?

Many thanks.
Title: Re: Music volume during speech
Post by: Snarky on Sun 12/04/2015 08:18:09
In AGS 3.2 and up, it's now Game.SetAudioTypeSpeechVolumeDrop() (listed in the manual under Multimedia functions).

There's a default drop set in the properties for the different AudioTypes (VolumeReductionWhileSpeechPlaying), and you can change it there or in the script using this function. The volume drop is an absolute, so if the initial music volume is 50 and the drop is 40, it will play at volume 10, but if you change the music volume to 40 it won't play at all during speech (you can avoid this by scaling the drop proportionally when you change the music volume).
Title: Re: Music volume during speech
Post by: Nixxon on Sun 12/04/2015 11:40:02
That's awesome sauce friend.

However, In searching the global script for this I am still unable to find where I can configure the settings.
Title: Re: Music volume during speech
Post by: Crimson Wizard on Sun 12/04/2015 11:46:52
Quote from: Nixxon on Sun 12/04/2015 11:40:02
However, In searching the global script for this I am still unable to find where I can configure the settings.

The global script is something that you write. Its initial contents are coming from template, but in 99% it does not have everything you need.
Just put extra line in the game_start:
Code (ags) Select

function game_start()
{
    // whichever code was here before ..........

    Game.SetAudioTypeSpeechVolumeDrop(eAudioTypeMusic, 30);
}
Title: Re: Music volume during speech
Post by: Snarky on Sun 12/04/2015 12:20:01
If you just want to set a different value that will be used throughout the game, you don't have to write any code at all, you can simply change it in the properties for the "Music" AudioType.
Title: Re: Music volume during speech
Post by: Nixxon on Sun 12/04/2015 22:03:49
That's brilliant, All working now

Thanks a ton.