Can't Mute Sound Properly

Bugs will be moved here once resolved.

Post » Fri Oct 25, 2013 7:58 am

Link to .capx file (required!):
https://dl.dropboxusercontent.com/u/50465867/Errors/Mute.capx

Steps to reproduce:
1. Click Mute button to toggle mute on and off for tagged sfx
2. Click the circle to play a sound

Observed result:
Chrome - The sound can still be heard, as though it plays before the system knows it's muted. It is sharply cut off, resulting in a minor tapping sound. I thought it was tagged sounds it had a problem with, but it's happening if it's untagged too.

Internet Explorer - Works best out of the 3 main browsers, but if you tap very fast, you can still hear a tapping on occasion.

Firefox - Worst. Doesn't seem to know when to mute and when not to. Results vary.

Expected result:
Mute should be silenced, and not play anything at all.

Browsers affected:
Chrome: yes
Firefox: yes
Internet Explorer: yes

Operating system & service pack:

Windows 7 SP1

Construct 2 version:

r148
    
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
79
S
12
G
7
Posts: 963
Reputation: 10,721

Post » Fri Nov 01, 2013 2:24 pm

Closing as not a bug. You play the sound at 0dB volume, then mute it the next tick. So you are hearing about 16ms of audio playback, which is what your events specify.
Scirra Founder
B
395
S
233
G
88
Posts: 24,376
Reputation: 193,842

Post » Fri Nov 01, 2013 2:57 pm

@Ashley, sorry, I don't understand. What order should I have my events set up in then? I can't get it to work.

Surely if sound is muted, it shouldn't play at all. In my game I have a global variable.

0 = Unmuted
1 = Mute

This variable is then called to mute or unmute which is done at the start of the layout.

The sound is then called on an action, and I still hear a split second. Works fine with music.

Do you mind tweaking my capx to actually have mute working?
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
79
S
12
G
7
Posts: 963
Reputation: 10,721

Post » Fri Nov 01, 2013 3:52 pm

Make the conditions that check for muted state sub-events to the click event. Then at least you set the mute state immediately, rather than playing the audio at full volume, then waiting for the next run of the events a few milliseconds later to set the muted state. (Remember triggers fire outside of the normal top-to-bottom event flow.)

Even then some implementations may play a short click, since you still play the audio at full volume, then mute it a moment later, and audio may start playing between the two actions running. If you intend to have the audio muted, don't play it at 0dB - play it at -99dB to begin with.
Scirra Founder
B
395
S
233
G
88
Posts: 24,376
Reputation: 193,842

Post » Fri Nov 01, 2013 7:16 pm

@Ashley

As a work around I had already gone through my project and added in an event that only plays the sound when the variable = 0. It was a bit of a pain doing this to each and every sound, but then again it'll be a lot easier the next time.

Seems unusual that the mute event doesn't really work as I expect it to. I thought it would control a global override aspect of the code automatically, to say if muted, don't play the sounds in the first place.

As it stands, it looks like I'll have more luck putting all sounds in a group which is deactivated when my mute variable is on, rather than using the mute function at all.

Thanks for the pointers :)AnD4D2013-11-01 19:16:39
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
79
S
12
G
7
Posts: 963
Reputation: 10,721


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 12 guests