Mute

It would be really helpful if there was an option where you could push a button on the simulator to mute the sound or make it louder or quieter. I realize this won't affect the app, it would just be a way to mute the music so one could listen to the radio while he is coding.

Put this on top of main.lua and you can bool the sound on/off

1
2
3
4
local mute = true
if mute then 
        audio.play = function () end
end 

Ah! Thanks! Never would have figured that out!

Much appreciated,
J.K.

Out of interest, is that code also a good idea for an in-game mute button?

That'd save alot of effort if so.

Cheers.

That would work fine to mute, so would;

audio.setVolume( 0 )

See here; http://developer.anscamobile.com/reference/index/audiosetvolume

Peach :)

@ ojnab
Whenever I use that, later in the game when I have the volume fade out rewind for a level transition, it gives me an error:

Runtime error
.../Desktop/Corona Projects/Warp Speed/easyGame.lua:1155: Unsupported argument in audio.rewind
stack traceback:
[C]: ?
[C]: in function 'rewind'
.../Desktop/Corona Projects/Warp Speed/easyGame.lua:1155: in function '_listener'
?: in function <?:446>
?: in function <?:215>
Runtime error
.../Desktop/Corona Projects/Warp Speed/easyGame.lua:1155: Unsupported argument in audio.rewind
stack traceback:
[C]: ?
[C]: in function 'rewind'
...mith/Desktop/Corona Projects/Warp Speed/easyGame.lua:1155: in function '_listener'
?: in function <?:446>
?: in function <?:215>

views:1690 update:2011/11/8 8:33:25
corona forums © 2003-2011