req: an "onComplete" callback for audio.fade() would be handy

It would be convenient if audio.fade() had something like an optional onComplete callback.

Potential usage scenario:  You have two streaming songs on separate, dedicated channels.  You don’t ever want to literally stop() either one and lose its position, just pause one, resume the other, repeat - so audio.fadeOut() isn’t an option.  But you also require a smooth volume crossfade, so you’re not content to simply call:

  audio.pause(song1Channel)

  audio.resume(song2Channel)

Instead, you’d like to do something like this:

  – do a fade-out-then-pause on first song

  local function pauseSong1() audio:pause(song1Channel) end

  audio.fade({channel=song1Channel, time=300, volume=0, onComplete=pauseSong1})

  – do a resume-with-fade-in on the other song

  audio.setVolume(0, { channel=song2Channel})

  audio.resume(song2Channel)

  audio.fade({ channel=song2Channel, time=300, volume=1}) – callback not needed

But of course you can’t do that at present.  So as a workaround you also create a timer to pause the fading-out song some short time after the fade is expected to end.  It’s kludgey, and takes more code to implement and keep track of, but it works, mostly.

A callback would be much sexier.  :)

This sounds like it could be a useful feature.  We use http://feedback.coronalabs.com for tracking feature requests.  If you could add it there and vote it up and get other developers to vote for it to would be wonderful.

Rob

oops, sorry, noobie mistake, reposted as feature request here:

http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/4123930-an-oncomplete-callback-for-audio-fade-would-be

thanks!

This sounds like it could be a useful feature.  We use http://feedback.coronalabs.com for tracking feature requests.  If you could add it there and vote it up and get other developers to vote for it to would be wonderful.

Rob

oops, sorry, noobie mistake, reposted as feature request here:

http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/4123930-an-oncomplete-callback-for-audio-fade-would-be

thanks!