Does audio.fadeOut() support onComplete?

Soo…in a sensical world, audio.fadeOut() would have an onComplete.

It makes sense, right? When the fadeout is done, trigger something. And the first paragraph of the API doc specifically mentions that an onComplete is called.

However…there is no syntax for an onComplete. The function only looks for .channel and .time. Adding .onComplete does nothing.

Is there another method to trigger .onComplete with audio functions?

I am using audio.fadeOut() with the following code:

audio.fadeOut({ channel=channel, time=timeValue, onComplete= function() ......

Two weeks ago I ended up writing my own audio module with many custom functions and did not notice that the onComplete statement is not listed.

Hi Richard, CineTek,

Let me investigate this. Your diagnosis seems to be accurate, so either the docs are wrong or the function isn’t working as it should.

Thanks,

Brent

Thanks Brent, 

I hope the docs are wrong… :smiley:

Best,

Max / CineTek

Hi Max,

Unfortunately, neither function supports an onComplete event, so the docs are wrong, but not in the way you hoped (as in, the feature was supported but just not documented). I’ll be correcting the doc soon, and in the meantime I think the best approach is to fire a timer of the same amount, or just slightly longer, and then decide what you want to do with the audio in that function.

Best regards,

Brent

@Brent:

But why does the above code work for me? I am using the latest daily build and everything seems to be fine. :huh:

Best,

Max

Now I’m confused!  :stuck_out_tongue:  You are getting the onComplete firing? I tested it on my side and did not get that flag firing. As far as I can tell, the onComplete is only available from audio.play(), when the sound completes playing.

Ah sorry, I double checked it and found a memory leak :stuck_out_tongue: The onComplete function does NOT work :wink:

PS: I hope this flag is added in the near future :wink: Now I have to re-write my audio module :smiley:

Is it correct way to trigger an audio file from onComplete. It would lead to any memory leak ?

audio.fadeOut() does not support the onComplete flag at the moment. 

It highly depends on your code whether or not there is an issue if you have used the onComplete flag in the past.

I am using audio.fadeOut() with the following code:

audio.fadeOut({ channel=channel, time=timeValue, onComplete= function() ......

Two weeks ago I ended up writing my own audio module with many custom functions and did not notice that the onComplete statement is not listed.

Hi Richard, CineTek,

Let me investigate this. Your diagnosis seems to be accurate, so either the docs are wrong or the function isn’t working as it should.

Thanks,

Brent

Thanks Brent, 

I hope the docs are wrong… :smiley:

Best,

Max / CineTek

Hi Max,

Unfortunately, neither function supports an onComplete event, so the docs are wrong, but not in the way you hoped (as in, the feature was supported but just not documented). I’ll be correcting the doc soon, and in the meantime I think the best approach is to fire a timer of the same amount, or just slightly longer, and then decide what you want to do with the audio in that function.

Best regards,

Brent

@Brent:

But why does the above code work for me? I am using the latest daily build and everything seems to be fine. :huh:

Best,

Max

Now I’m confused!  :stuck_out_tongue:  You are getting the onComplete firing? I tested it on my side and did not get that flag firing. As far as I can tell, the onComplete is only available from audio.play(), when the sound completes playing.

Ah sorry, I double checked it and found a memory leak :stuck_out_tongue: The onComplete function does NOT work :wink:

PS: I hope this flag is added in the near future :wink: Now I have to re-write my audio module :smiley:

Is it correct way to trigger an audio file from onComplete. It would lead to any memory leak ?

audio.fadeOut() does not support the onComplete flag at the moment. 

It highly depends on your code whether or not there is an issue if you have used the onComplete flag in the past.