How do I mute/unmute audio and music separately

Get help using Construct 2

Post » Wed Jul 27, 2016 3:49 pm

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
B
12
S
3
Posts: 26
Reputation: 816

Post » Thu Jul 28, 2016 4:33 pm

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
B
12
S
3
Posts: 26
Reputation: 816

Post » Thu Jul 28, 2016 8:36 pm

@mpatekar if you want publish the game for Android, you need put all audio in "Music" folder.
My Bitcoin address: 1NG9VKTZzA3patBrWySA4qRWcuKyYkhtfc
B
23
S
7
G
4
Posts: 320
Reputation: 3,839

Post » Fri Jul 29, 2016 10:58 pm

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
B
12
S
3
Posts: 26
Reputation: 816

Post » Wed Sep 07, 2016 11:18 pm

DaniellMesquito wrote:@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.
B
12
S
3
Posts: 26
Reputation: 816

Post » Thu Sep 08, 2016 7:44 pm

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".
My Bitcoin address: 1NG9VKTZzA3patBrWySA4qRWcuKyYkhtfc
B
23
S
7
G
4
Posts: 320
Reputation: 3,839


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest