You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have seen MixChannel.hx has a finished property to check if a track is finished but I'd like to delete an channel as soon as it's finished playing, something like play(destroyOnFinished: bool = true) or soundChannel.onFinished(?callback:Void), instead of checking soundChannel.finished each frame. Is it possible to do this with the current version of Aura or does it need to be implemented?
For context, I'm trying to implement randomized 'steps foley' sounds and uncommented the bit of code in line 113 if (inputChannels[i] == null || inputChannels[i].finished) from MixChannel.hx for a temporary solution.
The text was updated successfully, but these errors were encountered:
Hi, at the moment there is no callback like that, but there are other, better solutions for your problem ("round robin" playback):
You can create a few channels for the different sounds you want to play, and then just pick one random channel to play each time the sound should be played. There's no need to re-create channels all the time, it just adds unnecessary memory allocations and stress for the garbage collector.
You can use source effects which are constructs that are similar to DSP insert effects but instead of applying changes while the playback is happening, they apply changes to the audio source itself. Using this, you could implement a source effect that chooses a random audio source from a predefined list of sounds each time the channel is restarted (see applyOnReplay).
I plan to eventually implement a round robin source effect, but feel free to open a pull request for this if you happen to implement one :)
I'm also open towards implementing channel finished callbacks, but this will require some thought since the callbacks should not be executed in the audio thread.
I have seen
MixChannel.hx
has afinished
property to check if a track is finished but I'd like to delete an channel as soon as it's finished playing, something likeplay(destroyOnFinished: bool = true)
orsoundChannel.onFinished(?callback:Void)
, instead of checkingsoundChannel.finished
each frame. Is it possible to do this with the current version of Aura or does it need to be implemented?For context, I'm trying to implement randomized 'steps foley' sounds and uncommented the bit of code in line 113
if (inputChannels[i] == null || inputChannels[i].finished)
fromMixChannel.hx
for a temporary solution.The text was updated successfully, but these errors were encountered: