AuSoundRecordToFile(3)

πŸ’– AuSoundRecordToFile(3) πŸ’–

okay bestie, so this is a page from the Library Functions Manual for AuSoundRecordToFile(3), and it's literally the glow-up your audio recording setup needed. it's giving "make a flow, catch a vibe, save it to a file." let's get into it πŸŽ€


✨ NAME ✨

AuSoundRecordToFile β€” create a flow to record to a file. that's it, that's the whole gig, and she ATE πŸ’…


🌸 SYNOPSIS 🌸

#include <audio/audiolib.h>
#include <audio/soundlib.h>

AuEventHandlerRec *AuSoundRecordToFile(server, filename, source, gain,
callback, callback_data, mode, file_format, comment, rate, data_format,
flow, volume_mult_elem, status)
    AuServer *server;
    char *filename;
    AuDeviceID source;
    AuFixedPoint gain;
    void (*callback) (AuServer *, AuEventHandlerRec *, AuEvent *,
AuPointer);
    AuPointer callback_data;
    int mode;
    int file_format;
    char *comment;
    AuUint32 rate;
    int data_format;
    AuFlowID *flow; /* RETURN */
    int *volume_mult_elem; /* RETURN */
    AuStatus *status; /* RETURN */

look at all those params. she's high-maintenance but worth it, fr fr ✨


πŸ¦‹ ARGUMENTS πŸ¦‹

  • server β€” the connection to the audio server. your main character link to the whole operation πŸ‘‘
  • filename β€” the name of the file you're recording to. yes, a name. pick something cute.
  • source β€” the input device you're using. who's providing the vocals, bestie 🎀
  • gain β€” the gain for the input device. turn it up (responsibly) πŸ”₯
  • callback β€” the procedure that gets called for extra event processing. like a lil side quest handler, iykyk.
  • callback_data β€” any extra arguments you wanna pass along to that callback. it's giving "here's some luggage, take it with you" 🧳
  • mode β€” the line mode for the input device. currently the following line modes are defined: AuDeviceInputModeNone, AuDeviceInputModeLineIn, AuDeviceInputModeMicrophone. pick your fighter 🌈
  • file_format β€” the file format. currently, the following file formats are supported: SoundFileFormatSnd, SoundFileFormatVoc, SoundFileFormatWave, SoundFileFormatAiff, SoundFileFormatSvx. five options, all iconic in their own way πŸ’–
  • comment β€” a comment to be embedded in the file. leave a lil note for future you πŸŽ€
  • rate β€” the sample rate to record at. numbers matter, bestie.
  • data_format β€” the data format. currently, the following data formats are defined: AuFormatULAW8, AuFormatLinearUnsigned8, AuFormatLinearSigned8, AuFormatLinearSigned16MSB, AuFormatLinearUnsigned16MSB, AuFormatSignedLinear16LSB, and AuFormatLinearUnsigned16LSB. that's SEVEN. we love a comprehensive list ✨
  • flow β€” if non-NULL, returns the flow ID. it's a RETURN param, so she gives back 🫢
  • volume_mult_elem β€” accord to the comment in the source, not implemented. 😭 that's the tea. she's just sitting there, not doing anything. also a RETURN param, technically. (not me crying over an unimplemented param πŸ’€)
  • status β€” if non-NULL, flush the output buffer and return the status from the server. also marked RETURN. important lil bean ⭐

πŸ‘‘ DESCRIPTION πŸ‘‘

AuSoundRecordToFile creates a flow to record from source to filename, and returns a pointer to the event handler it created β€” or NULL if there was an error. so basically: she builds the whole recording pipeline for you, hands you the keys, and if something went wrong she just hits you with NULL and dips πŸ™ˆ


πŸ’€ ERRORS πŸ’€

  • AuBadDevice.

that's the one error listed. she said "device's not right, that's on you" and nothing else, periodt.


🌈 SEE ALSO 🌈

  • AuSoundRecord
  • AuSoundRecordToBucket
  • AuSoundRecordToData
  • AuSoundRecordToFileN
  • audiolib β€” Network Audio System C Language Interface

go read those too, bestie, the whole fam is here 🫢


lowkey reminder: that volume_mult_elem param is not implemented according to the comment in the source. don't come for me, i'm just the messenger πŸ’…

and that's the whole page, babe πŸ’œ this lil write-up comes from soundlib version 1.9.4, with the date stamped right there at the bottom as AuSoundRecordToFile(3). slay, stay recording, and don't forget to flush your output buffer πŸŽ€βœ¨

πŸ“¦ where this page comes from