Sound effect finished?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #30322
    shaymanjohn
    Participant

    Hi there,

    Is there a way to detect if there is currently a sound effect playing?

    I’d like to have some sound effects have higher priority, as at the moment every time I play a new one it stops the current one playing.

    I think I could manage the priority stuff in my code if there was a way to check if the last requested sound effect had (or hadn’t) finished.

    Thanks!

    #30323
    Targhan
    Keymaster

    Hi,

    There is no “out of the box” way to check sound effect, but have a look at the labels called PLY_AKG_Channel1_SoundEffectData, PLY_AKG_Channel2_SoundEffectData and PLY_AKG_Channel3_SoundEffectData (adapt “AKG” according to the player type). The first word here is 0 if there is no sound effect, else the ADDRESS of the PART of the sound effect currently played.

    My advice is to simply don’t bother with the addresses, but only keep in an array of 3 bytes with the fx number that was played. Fill that whenever you decide to play a SFX, but first check the priority of the SFX that was in your array (IF it is still playing (address != 0).

    #30324
    shaymanjohn
    Participant

    Hey Targhan,

    Thanks for the quick reply – as soon as I posted I worked out I could simply set a count when playing a sound effect which is decreased each frame until hitting zero.

    If a low priority sound effect is requested to be played while this count is non-zero then I simply ignore it.

    Sweet spot for my sound effects seems to be setting the initial value of this count to be around 12.

    This is a simple enough system but works well for what I need.

    Hope you have a great Christmas / Happy New Year!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.