voice_set_playmode(3alleg4)

✨ NAME ✨

voice_set_playmode β€” adjusts the loop status of the specified voice πŸ’– bestie this is the Allegro game programming library, and yes she's an icon.


🌸 SYNOPSIS 🌸

#include <allegro.h>

void voice_set_playmode(int voice, int playmode);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so. this one is literally just about changing up the loop status of the voice you point at, bestie. and the slay part? you can do it while the voice is still playing. no cap. so the move is: start a sample in looped mode (after you've set the loop start and loop end positions to the right values, obviously), and then whenever you're done and want the sound to wrap up, you just clear the loop flag. that makes it keep going past the loop end, play the rest of the sample, and finish up the normal way. chef's kiss. 😌

the playmode parameter is a bitfield, and it's holding these values:

  • PLAYMODE_PLAY β€” plays the sample a single time, once, and that's it. this is the default if you don't set the loop flag. one and done energy πŸ’…
  • PLAYMODE_LOOP β€” loops through the sample over and over, jumping back to the loop start position the moment it hits the loop end. round and round, forever, periodt πŸ”
  • PLAYMODE_FORWARD β€” plays the sample from beginning to end. this is the default if you don't set the backward flag. straightforward, no drama ✨
  • PLAYMODE_BACKWARD β€” flips the direction of the sample, so it plays in reverse. and here's the little detail people miss: if you combine this with the loop flag, the sample jumps to the loop end position when it reaches the loop start. (ie. you do not need to reverse the loop start and end values when you play the sample in reverse β€” the library already handles that for you, you're welcome 🫢)
  • PLAYMODE_BIDIR β€” when you use this together with the loop flag, the sample changes direction every time it reaches one of the loop points, so it alternates between playing forwards and in reverse. it's giving ping-pong, it's giving indecisive main character, and honestly? iconic 🌈
fr fr, the loop flag is the whole vibe here β€” flip it on for the endless loop, flip it off mid-playback when you're ready to let the sound go. πŸ’–

πŸ‘‘ SEE ALSO πŸ‘‘

  • Allegro

and that's the whole page, bestie πŸŽ€ this was Allegro version 4.4.3, voice_set_playmode(3alleg4), from the Allegro manual β€” go forth and loop responsibly, mwah πŸ’œπŸ§š