Hey guys,
Im messing around with sound and music in my game…
for my music I did this:
[lua]
audio.reserveChannels( 1 )
local backgroundMusic = audio.loadStream(“media/MenuMusic.mp3”)
audio.play( backgroundMusic ,{ channel=1, loops=-1} )
[/lua]
See how I reserved channel 1 for the music… is it a good approach?
for my sound effects I use this for example:
[lua]
local shineOnBoard = audio.loadSound(“media/shineOnBoard.wav”)
audio.play (shineOnBoard)
[/lua]
Which from my understanding will grab a free channel automatically and play the sound on this channel.
In the game there can be a situation that there are multiple sound effects firing simultaneously.
Now say I want to control the volume of the sounds separately and the volume of the music.
So I have 2 buttons
button 1: sounds on-off (by on-off I mean, on is volume=1 and off is volume=0)
button 2: music on-off (by on-off I mean on is volume=1 and off is volume=0)
How can I set it in a way that control the volume separately when pressing those buttons?
Roy.