load_wav(3)

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

πŸ’– load_wav(3) πŸ’–

okay bestie, welcome to the Allegro manual β€” yes, that Allegro, the game programming library, and today's main character is load_wav.


✨ NAME ✨

load_wav β€” loads a sample from a RIFF WAV file. part of the Allegro game programming library. no cap, that's the whole job description πŸ’…


🌸 SYNOPSIS 🌸

#include <allegro.h>

SAMPLE *load_wav(const char *filename);

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically: load_wav loads a sample from a RIFF WAV file. that's it. that's the vibe. one file in, one SAMPLE out πŸŽ€

here's how it looks in the wild, literally:

SAMPLE *sample = load_wav("scream.wav");
if (!sample)
   abort_on_error("Couldn't scare user!");

like, you point it at your "scream.wav", and if it hands you back nothing (a whole NULL, rude), you go ahead and abort_on_error with "Couldn't scare user!". iconic error handling tbh 😭


πŸŽ€ RETURN VALUE πŸŽ€

  • gives you back a pointer to the SAMPLE β€” slay πŸ’–
  • or NULL if something went wrong πŸ™ˆ
⚠️ bestie, listen: remember to free this sample later or you'll get memory leaks. the leaks are not cute. free your sample, protect your peace 🫢

πŸ‘‘ SEE ALSO πŸ‘‘


Allegro, version 4.4.3 β€” that's the source and the version, mwah, love that for us. thanks for reading bestie, go load some WAVs πŸ’œπŸ¦‹βœ¨

πŸ“¦ where this page comes from