[RESOLVED] Fade out/in in sounds

I’m playing a music and want to fade-out to start a new music with fade-in. The fade-out work fine, but it set the volume to zero, and the fade-in don’t increase it again. See my code:

local channel = 1

local play = function()

  audio.stop(channel)

  local musicStream = audio.loadStream(musicName)

  audio.play( musicStream, { channel=channel, loops=-1, fadein=1000 }  )

end

audio.fadeOut{ channel=channel, time=1000 }

timer.performWithDelay(1000, play)

I executed the following code to track the channel volume, and confirm my suspicion. The volume goes to zero and remains there.

timer.performWithDelay(100, function()

  print(audio.getVolume{channel=channel})

end, 1000)

Ok, solved. Before start the new music, I need to restore the channel volume:

audio.setVolume( 1.0, { channel=channel } )

Ok, solved. Before start the new music, I need to restore the channel volume:

audio.setVolume( 1.0, { channel=channel } )