AFREADFRAMES(3)

πŸ’– AFREADFRAMES β€” bestie, it's giving "gimme those audio frames" πŸ’–

okay so real talk, you're in the AFREADFRAMES(3) zone, the audio-file-library part of the manual, and this one is literally just "read me some sample frames from a track, pls and thank you." πŸŽ€ Let's go.


✨ NAME ✨

afReadFrames β€” read sample frames from a track in an audio file 🎧


✨ SYNOPSIS ✨

#include <audiofile.h>

AFframecount afReadFrames(AFfilehandle file, int track, void *data,
    int count);

✨ DESCRIPTION ✨

So afReadFrames is gonna attempt to read up to count frames of audio data β€” yes, up to, that's the vibe, no promises β€” out of the audio file handle file and straight into the buffer sitting at data. 🫢


✨ PARAMETERS ✨

  • file β€” a valid file handle, like the ones afOpenFile(3) hands you. If it's not valid, we're gonna have a problem (see ERRORS, bestie πŸ’€).
  • track β€” always AF_DEFAULT_TRACK for literally every file format currently supported. That's it. That's the whole range of options. πŸ‘‘
  • data β€” a buffer that stores count frames of audio sample data. It's where the frames land. πŸͺ„
  • count β€” the number of sample frames you wanna read.

✨ RETURN VALUE ✨

afReadFrames returns the number of frames it successfully read from file. So like, check it, because it might be fewer than you asked for. πŸ‘€


✨ ERRORS ✨

when it goes wrong, it goes wrong like this:

  • AF_BAD_FILEHANDLE β€” the file handle was invalid. not the file handle being mid, the file handle being invalid, there's a difference. 😭
  • AF_BAD_TRACKID β€” the track parameter is not AF_DEFAULT_TRACK. girl, it's always AF_DEFAULT_TRACK, we talked about this. πŸ’…
  • AF_BAD_READ β€” reading the audio data from the file failed. the read simply did not eat. πŸ’€
  • AF_BAD_LSEEK β€” seeking within the file failed. the cursor said "no thank u." πŸ™ˆ

✨ SEE ALSO ✨

afWriteFrames(3) β€” the other half of the story, the one where you write frames instead. 🌈


✨ AUTHOR ✨

Michael Pruett <michael@68k.org> β€” the icon, the legend, the main character who wrote this. πŸ‘‘


and that's the whole page, no cap. this was Audio File Library 0.3.6, dated 03/06/2013, page AFREADFRAMES(3) β€” ty for coming to my ted talk, go read some frames bestie πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from