How do I mute/unmute audio and music separately

0 favourites
  • 6 posts
From the Asset Store
Make your gore effects come to life with this sounds! :D
  • Hello,

    i have a problem. I cant mute/unmute audio and music separately.

    I have attached .capx

    I made two buttons. One for music and one for audio.

    I have tried with functions : On button audio clicked ---> call function "mute audio" and vice versa

    In function "mute audio" i have put "mute sound" on all the sounds

    ________________________________________________________________________________

    I did the same for music, but music and audio is not muted

    Any help would be appreciated.

    https://www.dropbox.com/s/wsiqjvkj3a8bg ... .capx?dl=0

    Thank You

  • Hello again,

    I have found the solution.

    I have attached .capx

    I went the other way. I used two global variables. On for sound and one for music.

    Basic logic is :

    if global variable "audio"=0 then audio is on. if global variable "audio"=1 then audio is off.

    Before the sound is played we need to check if the global variable = 0 (unmuted)

    if global variable "music"=0 then music is on. if global variable "music"=1 then music is off

    Before the music is played we need to check if the global variable = 0 (unmuted)

    See atached .capx : https://www.dropbox.com/s/vp9jrnn3wmqjg ... .capx?dl=0

    I hope this will help you guys.

    Best regards,

    mpatekar

  • mpatekar if you want publish the game for Android, you need put all audio in "Music" folder.

  • Hmm...I had no problems in Android (Cordova) export when I put Audio files in Audio folder and music files in music folder.

    Everything in audio folder is loaded into memory, and everything in music folder is streamed.

    https://www.scirra.com/manual/52/import-audio

    Best regards,

    mpatekar

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • mpatekar if you want publish the game for Android, you need put all audio in "Music" folder.

    You were right. In my last game, when i exported for Android with cordova + compiled in XDK (newest versions up to date) , with the sounds in their folder I encountered 2 issues :

    1) the sound lagged noticably

    2) when the game was running and then when the screen turned off (the phone went in standby) and after the screen turns back on, the music played fine but there was no sound in the game.

    Then I took your advice and put all the sounds in Music folder, and everything worked fine. Thank you very much!

    The only thing I added was preload the most used sounds like this: on the start of first layout, i used : Audio - preload sound -xxx (for every sound)

    Again, thank you very much!

    I would really like for Scirra team to fix lag issue and " no sound after wake up from standby"

    When I get the time I will report the bug.

  • Thank you!

    Tom | Ashley

    As OP say: "I would really like for Scirra team to fix lag issue and " no sound after wake up from standby"

    When I get the time I will report the bug".

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