0 Favourites

How do I return the name of an audio file "On (tag) ended?"

  • The audio plugin doesn't seem to have any way to return filenames (according to the manual page). Here's what I'm working with:

    When "On 'tracks' ended" is triggered, I want to prevent the same song from playing twice in a row. Ideally I want it to call a function like so:

    [quote:3qb4ll9b]On "tracks" ended:

    --Call function "AudioShuffle"

    --Set Parameter 0 to "(name of audio track that triggered this call)"

    On Function "AudioShuffle"

    If Param(0) and audio are equal, call the function again.

    Else, play (choose(track1,track2,etc))

    Yes, you could do this in a dictionary or array as well (toggle from 0 to 1 for "chosen track" to stop it from repeating), but I would be surprised if there were not a way to do this as the events currently are. Thank you!

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • The audio plugin doesn't seem to have any way to return filenames (according to the manual page). Here's what I'm working with:

    When "On 'tracks' ended" is triggered, I want to prevent the same song from playing twice in a row. Ideally I want it to call a function like so:

    [quote:19xxlsd7]On "tracks" ended:

    --Call function "AudioShuffle"

    --Set Parameter 0 to "(name of audio track that triggered this call)"

    On Function "AudioShuffle"

    If Param(0) and audio are equal, call the function again.

    Else, play (choose(track1,track2,etc))

    Yes, you could do this in a dictionary or array as well (toggle from 0 to 1 for "chosen track" to stop it from repeating), but I would be surprised if there were not a way to do this as the events currently are. Thank you!

    Then you have to be surprised, because there ain't

    As workaround solution instead of your array or dictionary solutions, wouldn't it be easier just to make a list (playlist) and add all your tracks to that and use that as your input string for your audio object. That way you can always make a check vs "text at selected index" to make sure that the same track isn't played again.

  • You can use this plugin to help randomize the order, and prevent the same sequence playing even.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)