AFINITSAMPLEFORMAT(3)

πŸ’– afInitSampleFormat(3) πŸ’–

welcome to the AFINITSAMPLEFORMAT(3) era bestie, where we set up how your audio data is gonna look before the file even exists. it's giving "getting ready" energy. πŸŽ€


✨ NAME ✨

afInitSampleFormat, afInitByteOrder, afInitChannels, afInitRate β€” these four besties initialize the audio data format for a track inside an audio file setup. think of it as picking out the outfit before the main character (the file) walks in. πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <audiofile.h>

void afInitSampleFormat(AFfilesetup setup, int track, int sampleFormat,
    int sampleWidth);
void afInitByteOrder(AFfilesetup setup, int track, int byteOrder);
void afInitChannels(AFfilesetup setup, int track, int channels);
void afInitRate(AFfilesetup setup, int track, double rate);

no cap, that's the whole vibe right there. ✨


🌸 PARAMETERS 🌸

okay so here's who's who in this friend group:

  • setup β€” a valid file setup that you got back from afNewFileSetup(3). if it's not valid, we're gonna have a problem. 🫢
  • track β€” picks which track inside the audio file setup you're talking about. and listen: track is always AF_DEFAULT_TRACK for all currently supported file formats. every single one. so yeah. 😌
  • sampleFormat β€” a symbolic constant that says what the sample format of the audio data in the track is gonna be. it must be one of AF_SAMPFMT_TWOSCOMP, AF_SAMPFMT_UNSIGNED, AF_SAMPFMT_FLOAT, or AF_SAMPFMT_DOUBLE. those are the only options, periodt. πŸ’…
  • sampleWidth β€” a positive integer, bestie. it's the number of bits for each sample in the track. πŸ“
  • byteOrder β€” a symbolic constant for the byte order of the track. must be one of AF_BYTEORDER_BIGENDIAN or AF_BYTEORDER_LITTLEENDIAN. pick a side. 🌈
  • channels β€” a positive integer saying how many channels the track has. (positive!! not zero, not negative, we're not doing that today.) πŸ”₯
  • rate β€” a positive double-precision floating-point number for the sample rate of the track. yes it's a double. yes it's positive. slay. ⭐

πŸ’œ DESCRIPTION πŸ’œ

short and sweet, one for each function, iykyk:

  • afInitSampleFormat β€” initializes the track to the sample format and sample width you specified. 🎚️
  • afInitByteOrder β€” initializes the track to the byte order you specified. πŸ”„
  • afInitChannels β€” initializes the track to the number of channels you specified. 🎧
  • afInitRate β€” initializes the track to the sample rate you specified. ⏱️

that's it. that's the whole job. they init, you vibe. πŸ’–


πŸ’€ ERRORS πŸ’€

not every day is a good day, so here's what can go wrong. afInitSampleFormat, afInitByteOrder, afInitChannels, and afInitRate can all produce these:

  • AF_BAD_FILESETUP β€” setup represents an invalid file setup. 😭
  • AF_BAD_TRACK β€” track represents an invalid track identifier. πŸ™ˆ

and then each one has its own lil extra way to fail, because why not:

afInitSampleFormat can also produce the following errors:

  • AF_BAD_SAMPFMT β€” sampleFormat does not represent a valid sample format. 🚫
  • AF_BAD_WIDTH β€” sampleWidth is not a valid sample width. πŸ“‰

afInitByteOrder can also produce the following error:

  • AF_BAD_BYTEORDER β€” byteOrder does not represent a valid byte order. πŸ”€

afInitChannels can also produce the following error:

  • AF_BAD_CHANNELS β€” channels specifies an invalid number of channels. πŸ”Š

afInitRate can also produce the following error:

  • AF_BAD_RATE β€” rate specifies an invalid sample rate. 🐌
fr fr, check your arguments before you call these. the library will tell you, and it will not be subtle about it. πŸ’…

πŸ‘€ SEE ALSO πŸ‘€

go read these next, bestie, they're the rest of the lore:


πŸ‘‘ AUTHOR πŸ‘‘

Michael Pruett <michael@68k.org> β€” the icon who wrote this. we love him. πŸ’–


and that's the page!! this manual page came to you courtesy of Audio File Library 0.3.6, dated 03/06/2013. yes, it's been iconic for a minute. πŸ«Άβœ¨πŸŽ€

πŸ“¦ where this page comes from