Audio plays at full volume for one frame even when set to 0.

Get help using Construct 2

Post » Wed Dec 14, 2016 9:55 pm

The manual actually describes this problem as follows:

Set volume
Change the volume of a sound. The volume is given in decibels (dB). A volume of 0 dB is original volume, and below 0 dB attenuates the sound. Note amplification is not supported. For example, entering a value of -10 plays the audio back 10 dB quieter (about half as loud).

Note it is best to set the initial volume in the Play action instead of setting it with this action immediately after playing, since that can sometimes cause a moment of playback at the wrong volume.

The problem is that I'm doing exactly what is recommended here, but getting this exactly issue. If the volume for effects is set to -60 after previously being set to 0, then it will play at 0 for a fraction of a second (maybe 1 frame/tick), and THEN play correctly.

When I want to play a sound effect, I call a function that is responsible for every sound effect, and make Parameter 0 the filename of the sound effect to play. I specify the volume at the same time as the name of the sound effect to play, i.e. all in one line and not sequentially in two actions.

Pseudo-code (I use a slider to universally control the volume of all sound effects when they play):

On click sprite:
--Call function "PlaySFX"

On function "PlaySFX":
Param0 = Sound1 --> Play sound effect 1 at (sound effects slider volume) dB
Param0 = Sound2 --> Play sound effect 2 at (sound effects slider volume) dB

Thank you.
Posts: 47
Reputation: 1,894

Return to How do I....?

Who is online

Users browsing this forum: fbarraza28, marks2 and 8 guests