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

0 favourites
  • 1 posts
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • The manual actually describes this problem as follows:

    [quote:2njbc6o1]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":

    (sub-events):

    Param0 = Sound1 --> Play sound effect 1 at (sound effects slider volume) dB

    Param0 = Sound2 --> Play sound effect 2 at (sound effects slider volume) dB

    etc

    etc

    etc

    Thank you.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)