create_sample(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

✨ NAME ✨

create_sample β€” constructs a new sample structure of the specified type. It's giving Allegro game programming library, bestie. πŸ’–

✨ SYNOPSIS ✨

#include <allegro.h>

SAMPLE *create_sample(int bits, int stereo, int freq, int len);

✨ DESCRIPTION ✨

okay so bestie, this function constructs a new sample structure of the specified type. The way that you get the internal deets on the SAMPLE structure? Read the chapter "Structures and types defined by Allegro". It's literally right there. iykyk. πŸ‘‘

Now let's talk params, no cap:

  • bits β€” can be 8 or 16. That's the vibe check.
  • stereo β€” zero for mono samples, non-zero for stereo samples. Periodt. πŸ’…
  • freq β€” the frequency in hertz.
  • len β€” the number of samples you want to allocate for the full sound buffer. Like, the whole thing.

✨ RETURN VALUE ✨

It returns a pointer to the created sample, or NULL if the sample could not be created. And bestie, remember to free this sample later to avoid memory leaks β€” slay, but don't leak. Not me forgetting and leaking memory everywhere, that's not the move. 😭

✨ SEE ALSO ✨


that's the whole page, babe. this was create_sample(3) from the Allegro manual, version 4.4.3. now go make some iconic noise. πŸŽ€βœ¨

πŸ“¦ where this page comes from