AFQUERY(3)

πŸ’– NAME πŸ’–

okay so bestie, this is the AFQUERY(3) page β€” it's all about afQuery, afQueryLong, afQueryDouble and afQueryPointer, the little squad whose whole job is querying the capabilities of the Audio File Library. no cap, they're literally the vibe check for what the library can and can't do. ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <audiofile.h>

AUpvlist afQuery (int querytype, int arg1, int arg2, int arg3, int arg4);

long afQueryLong (int querytype, int arg1, int arg2, int arg3, int arg4);

double afQueryDouble (int querytype, int arg1, int arg2, int arg3,
    int arg4);

void *afQueryPointer (int querytype, int arg1, int arg2, int arg3,
    int arg4);

πŸŽ€ PARAMETERS πŸŽ€

so querytype is the main character here, and it can be exactly one of these icons:

  • AF_QUERYTYPE_FILEFMT
  • AF_QUERYTYPE_INST
  • AF_QUERYTYPE_INSTPARAM
  • AF_QUERYTYPE_COMPRESSION
  • AF_QUERYTYPE_COMPRESSIONPARAM
  • AF_QUERYTYPE_MISC
  • AF_QUERYTYPE_MARK
  • AF_QUERYTYPE_LOOP

and then arg1, arg2, arg3 and arg4 are integer selectors whose whole meaning depends on whichever querytype you picked. they're like the plus-ones β€” they only make sense in context, fr fr. πŸ’…


⭐ RETURN VALUE ⭐

when it goes well, afQuery hands you back a non-null AUpvlist value. slay. when it goes badly, afQuery returns null, while afQueryLong and afQueryDouble return -1 and afQueryPointer returns null. it's giving rejection. 😭

okay and this part MATTERS, bestie: pointers that represent character strings are owned by the Audio File Library and must not be freed. all other pointer values must be freed by the caller. so know which one you're holding, okay?? do not be out here freeing the library's stuff. πŸ™ˆ


🌸 DESCRIPTION 🌸

✨ for AF_QUERYTYPE_FILEFMT ✨

these are the valid values for arg1, babes:

  • AF_QUERY_LABEL β€” request a short label string for the format (e.g., "aiff").
  • AF_QUERY_NAME β€” request a short name for the format (e.g., "MS RIFF WAVE").
  • AF_QUERY_DESC β€” request a descriptive name for the format (e.g., "Audio Interchange File Format").
  • AF_QUERY_IMPLEMENTED β€” request a boolean value indicating whether the format is implemented for reading and writing in the Audio File Library.
  • AF_QUERY_ID_COUNT β€” request the total number of formats implemented.
  • AF_QUERY_IDS β€” request an integer array of the id token values of all implemented file formats.
  • AF_QUERY_COMPRESSION_TYPES β€” used with the selector AF_QUERY_VALUE_COUNT in arg2, this will return a long integer containing the number of compression schemes available for use within the format specified in arg3. used with selector AF_QUERY_VALUES, it returns a pointer to an integer array containing the compression id values of the compression schemes supported by the format specified in arg3. two moods, one selector. πŸ’…
  • AF_QUERY_SAMPLE_FORMATS β€” used with the selector AF_QUERY_DEFAULT in arg2, this will return the default sample format for the file format specified in arg3.
  • AF_QUERY_SAMPLE_SIZES β€” used with selector AF_QUERY_DEFAULT in arg2, this will return the default sample width for the file format specified in arg3.

🧚 for AF_QUERYTYPE_INST 🧚

these are the valid selectors for arg1:

  • AF_QUERY_SUPPORTED β€” request a boolean value indicating whether the file format in arg2 supports instruments.
  • AF_QUERY_MAX_NUMBER β€” request an integer value indicating the maximum number of instruments supported by the file format in arg2.

🌈 for AF_QUERYTYPE_INSTPARAM 🌈

these are the valid selectors for arg1:

  • AF_QUERY_SUPPORTED β€” request a boolean value indicating whether the file format in arg2 supports instrument parameters.
  • AF_QUERY_ID_COUNT β€” request an integer value indicating the number of instrument parameters supported by the file format in arg2.
  • AF_QUERY_IDS β€” request an integer array containing the instrument parameter values for the file format in arg2.
  • AF_QUERY_TYPE β€” for the file format in arg2, request the type of the instrument parameter in arg3.
  • AF_QUERY_NAME β€” for the file format in arg2, request the name of the instrument parameter in arg3.
  • AF_QUERY_DEFAULT β€” for the file format in arg2, request the default value of the instrument parameter in arg3.

πŸ’€ ERRORS πŸ’€

afQuery can produce these little disasters:

  • AF_BAD_QUERYTYPE β€” the query type is unsupported.
  • AF_BAD_QUERY β€” the arguments to the query are bad.
not me getting AF_BAD_QUERY because my args were mid 😭 double check those selectors before you come for the library, okay?

πŸ‘‘ AUTHOR πŸ‘‘

Michael Pruett <michael@68k.org> β€” the icon, the legend, the moment. 🫢


and that's the whole page, bestie!! this was Audio File Library 0.3.6, dated 03/06/2013, and it ate. go query something iconic. periodt. πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from