I'm having a problem with this. I have a button that I want to toggle the music on or off.
Below is the code I'm using.
The emMusicOn(x,y) determines if the mouse is on the button.
The button works to pause the music, but clicking it again DOESN'T unpause (resume) it.
I added the 4 print statements to see if the button is changing the play state. Apparently the play state is changing,
Each time I click the button, the prinout indicates both the playing and paused values switch.
But there's no audio coming through.
I have no idea what the problem is.
Note1: I tried using love.audio.play( audioFundo ) instead of love.audio.resume( audioFundo ) but it still didn't work.
Note2: There are two other buttons to control volume, but I'm not touching them and I don't see how they could be the problem.
Code: Select all
mousereleased = function(x, y, button)
--CLIQUES DO MOUSE
if emMusicOn( x, y ) then
print("playing =")
print(audioFundo:isPlaying())
print("paused =")
print(audioFundo:isPaused())
if audioFundo:isPlaying() then love.audio.pause( audioFundo )
elseif audioFundo:isPaused() then love.audio.resume( audioFundo )
end
return
end