In main.lua I have:
local backgroundMusic = Sound.new(backgroundMusicSource)
backgroundMusicVolume = 0.5
In splashScene.lua I have the function below which is called when the volume up button is clicked. It works fine. When I click the button I get the 2 print statements in the console and each time I click it, the variable backgroundMusicVolume is 0.05 bigger, until it reaches 1 and then it only prints the Raising volume line.
if backgroundMusicVolume < 1 then
backgroundMusicVolume = backgroundMusicVolume + 0.05
print("backgroundMusicVolume = ", backgroundMusicVolume)
But when I raise the variable backgroundMusicVolume, the actual volume of the music doesn't change.
When I was programming in löve, I would run this function inside of love.update(dt), which runs every frame and so would update the music volume every frame. But I don't know how to "update" the volume in Gideros. How do I get the volume to change when the volume control buttons are clicked?