AFWRITEFRAMES(3)

πŸ’– AFWRITEFRAMES(3) πŸ’–

okay bestie, so this is afWriteFrames β€” it's a lil function from the Audio File Library and its whole job is writing sample frames to a track in an audio file. she's the write-side twin of afReadFrames(3), iykyk. πŸŽ€


✨ SYNOPSIS ✨

#include <audiofile.h>

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

like… that's the whole vibe right there. include the header, call the function, boom. πŸ’…


🌸 DESCRIPTION 🌸

afWriteFrames attempts to write up to count frames of audio data from the buffer data into the audio file handle file.

that's it. that's the function. she writes frames. she's not complicated, she's just important. ✨

note the "attempts" bestie β€” that's not me being dramatic, that's literally the wording. you get back how many actually made it. 🫢

πŸ¦‹ PARAMETERS πŸ¦‹

  • file β€” a valid file handle, and it has to be one that afOpenFile(3) gave you. no random handles, no vibes-based file descriptors. πŸ‘‘
  • track β€” for every file format that's currently supported, this is always AF_DEFAULT_TRACK. yes, every time. it's giving "parameter for future reasons." πŸ™ˆ
  • data β€” the buffer of sample frames you wanna write into the file. your actual audio, right there. πŸ“
  • count β€” how many sample frames you're writing. the number. the amount. the quantity. ✨

πŸ’œ RETURN VALUE πŸ’œ

afWriteFrames returns the number of sample frames that were successfully written to file.

so like β€” check it! don't just assume all count of them went through, bestie. read the number, respect the number. 😭


πŸ’€ ERRORS πŸ’€

afWriteFrames can produce these errors, and when she does, she does NOT play:

  • AF_BAD_FILEHANDLE β€” the file handle was invalid. it wasn't a real handle, it was a fake one, a little impostor. πŸ™ˆ
  • AF_BAD_TRACKID β€” the track is not AF_DEFAULT_TRACK. you tried to be different and the library said no. πŸ’€
  • AF_BAD_WRITE β€” writing the audio data to the file failed. the write itself just did not happen. πŸ”₯
  • AF_BAD_LSEEK β€” seeking within the file failed. couldn't move around in there, tragic. 😭

🌈 SEE ALSO 🌈


🧚 AUTHOR 🧚

Michael Pruett <michael@68k.org> β€” thank you king, we appreciate you. πŸ‘‘


Audio File Library 0.3.6 🌸 03/06/2013 β€” yeah she's an elder but she still slays, and that's the version + date this whole page is serving. periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from