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. [import]uid: 66117 topic_id: 17360 reply_id: 317360[/import]
Put this on top of main.lua and you can bool the sound on/off
[lua]local mute = true
if mute then
audio.play = function () end
end [import]uid: 13632 topic_id: 17360 reply_id: 65692[/import]
Ah! Thanks! Never would have figured that out!
Much appreciated,
J.K.
[import]uid: 66117 topic_id: 17360 reply_id: 65693[/import]
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. [import]uid: 91798 topic_id: 17360 reply_id: 65702[/import]
That would work fine to mute, so would;
[lua]audio.setVolume( 0 ) [/lua]
See here; http://developer.anscamobile.com/reference/index/audiosetvolume
Peach [import]uid: 52491 topic_id: 17360 reply_id: 65737[/import]
@ 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> [import]uid: 66117 topic_id: 17360 reply_id: 65798[/import]
There is your answer :
…/Desktop/Corona Projects/Warp Speed/easyGame.lua:1155: Unsupported argument in audio.rewind
[import]uid: 84637 topic_id: 17360 reply_id: 66064[/import]