Audio Control

0 favourites
  • 6 posts
From the Asset Store
Supports keyboard, mouse and gamepads. Supports several gamepads at once.
  • Hey guys.

    I'm trying to figure out how to have a slider bar control audio that has been already playing from another layout. I've gotten the slider bar to adjust audio levels when the layout with the slider bar is playing music. Now I want the opening titles layout to play music, then allow the slider bar to have control of that audio without having to restart the entire song on the opening of the layout with the slider bar. I don't know if that makes sense to anyone else, but if it does, much help would be appreciated!

  • Add a tag "music" to your music playback. Change your event to this:

    Audio Tag "music" is NOT playing -> Audio play "MyMusic.mp3" with tag "music"

    What do you want to control will this slide bar - music volume?

    On slidebar change -> Audio set "music" volume to slidebar.value

    Here is how you properly change audio volume:

  • dop2000 Thanks, but what I'm trying to figure out is kind of how to control audio that begins playing at the titles of the game. So basically, if you were to start up a game with music that plays at the titles and continues into the menu, and you wanted to lower that audio from the settings tab without the audio restarting on the opening of the settings tab, what would the code be to do that?

  • In the Title layout:

    On Start of layout

    ...Audio Tag "music" is NOT playing -> Audio play "MyMusic.mp3" with tag "music"

    In Settings layout:

    On slidebar change -> Audio set "music" volume to slidebar.value

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • dop2000 holy heck, that worked! Thanks so much, I truly appreciate it!

    Actually, one more question: whenever I exit the settings layout then enter it again, the slider bar resets it's position, but not the volume level. Is it possible to set the volume with the slider, then have the slider save it's position upon exit and re-entry of the layout?

  • See the link I posted earlier, it has correct formulas for setting volume from the slidebar, and slidebar position from volume.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)