SoX - Sound eXchange
Audio file processing tool.
|
Contains the interface exposed to clients of the libSoX library. More...
#include <limits.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
Classes | |
struct | sox_version_info_t |
Client API: Information about a build of libSoX, returned from the sox_version_info function. More... | |
struct | sox_globals_t |
Client API: Global parameters (for effects & formats), returned from the sox_get_globals function. More... | |
struct | sox_signalinfo_t |
Client API: Signal parameters; members should be set to SOX_UNSPEC (= 0) if unknown. More... | |
struct | sox_encodings_info_t |
Client API: Basic information about an encoding. More... | |
struct | sox_encodinginfo_t |
Client API: Encoding parameters. More... | |
struct | sox_loopinfo_t |
Client API: Looping parameters (out-of-band data). More... | |
struct | sox_instrinfo_t |
Client API: Instrument information. More... | |
struct | sox_fileinfo_t |
Client API: File buffer info. More... | |
struct | sox_format_handler_t |
Client API: Handler structure defined by each format. More... | |
struct | sox_oob_t |
Client API: Comments, instrument info, loop info (out-of-band data). More... | |
struct | sox_format_t |
Client API: Data passed to/from the format handler. More... | |
struct | sox_format_tab_t |
Client API: Information about a loaded format handler, including the format name and a function pointer that can be invoked to get additional information about the format. More... | |
struct | sox_effects_globals_t |
Client API: Global parameters for effects. More... | |
struct | sox_effect_handler_t |
Client API: Effect handler information. More... | |
struct | sox_effect_t |
Client API: Effect information. More... | |
struct | sox_effects_chain_t |
Client API: Chain of effects to be applied to a stream. More... | |
struct | lsx_enum_item |
Plugins API: String name and integer values for enumerated types (type metadata), for use with LSX_ENUM_ITEM, lsx_find_enum_text, and lsx_find_enum_value. More... | |
struct | lsx_option_t |
Plugins API: lsx_getopt long option descriptor. More... | |
struct | lsx_getopt_t |
Plugins API: lsx_getopt session information (initialization data and state). More... | |
Macros | |
#define | SOX_H |
Client API: This macro is defined if sox.h has been included. | |
#define | LSX_GCC(maj, min) 0 |
#define | LSX_API /* libSoX function */ |
Plugins API: Attribute required on all functions exported by libSoX and on all function pointer types used by the libSoX API. | |
#define | LSX_UNUSED /* Parameter or local variable is intentionally unused. */ |
Plugins API: Attribute applied to a parameter or local variable to suppress warnings about the variable being unused (especially in macro-generated code). | |
#define | LSX_PRINTF12 /* Function has printf-style arguments. */ |
Plugins API: LSX_PRINTF12: Attribute applied to a function to indicate that it requires a printf-style format string for arg1 and that printf parameters start at arg2. | |
#define | LSX_RETURN_PURE /* Function is pure. */ |
Plugins API: Attribute applied to a function to indicate that it has no side effects and depends only its input parameters and global memory. More... | |
#define | LSX_RETURN_VALID /* Function always returns a valid object (never NULL). */ |
Plugins API: Attribute applied to a function to indicate that the return value is always a pointer to a valid object (never NULL). | |
#define | LSX_RETURN_ARRAY /* Function always returns a valid array (never NULL). */ |
Plugins API: Attribute applied to a function to indicate that the return value is always a pointer to a valid array (never NULL). | |
#define | LSX_RETURN_VALID_Z /* Function always returns a 0-terminated array (never NULL). */ |
Plugins API: Attribute applied to a function to indicate that the return value is always a pointer to a valid 0-terminated array (never NULL). | |
#define | LSX_RETURN_OPT /* Function may return NULL. */ |
Plugins API: Attribute applied to a function to indicate that the returned pointer may be null. | |
#define | LSX_PARAM_IN /* Required const pointer to a valid object (never NULL). */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to one const element of the pointed-to type (never NULL). | |
#define | LSX_PARAM_IN_Z /* Required const pointer to 0-terminated string (never NULL). */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to a const 0-terminated string (never NULL). | |
#define | LSX_PARAM_IN_PRINTF /* Required const pointer to 0-terminated printf format string (never NULL). */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a const pointer to a 0-terminated printf format string. | |
#define | LSX_PARAM_IN_COUNT(len) /* Required const pointer to (len) valid objects (never NULL). */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to (len) const initialized elements of the pointed-to type, where (len) is the name of another parameter. More... | |
#define | LSX_PARAM_IN_BYTECOUNT(len) /* Required const pointer to (len) bytes of data (never NULL). */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to (len) const bytes of initialized data, where (len) is the name of another parameter. More... | |
#define | LSX_PARAM_IN_OPT /* Optional const pointer to a valid object (may be NULL). */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is either NULL or a valid pointer to one const element of the pointed-to type. | |
#define | LSX_PARAM_IN_OPT_Z /* Optional const pointer to 0-terminated string (may be NULL). */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is either NULL or a valid pointer to a const 0-terminated string. | |
#define | LSX_PARAM_INOUT /* Required pointer to a valid object (never NULL). */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to one initialized element of the pointed-to type (never NULL). More... | |
#define | LSX_PARAM_INOUT_COUNT(len) /* Required pointer to (len) valid objects (never NULL). */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to (len) initialized elements of the pointed-to type (never NULL). More... | |
#define | LSX_PARAM_OUT /* Required pointer to an object to be initialized (never NULL). */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to memory sufficient for one element of the pointed-to type (never NULL). More... | |
#define | LSX_PARAM_OUT_BYTECAP(len) /* Required pointer to writable buffer with room for len bytes. */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to memory sufficient for (len) bytes of data (never NULL), where (len) is the name of another parameter. More... | |
#define | LSX_PARAM_OUT_CAP_POST_COUNT(len, filled) /* Required pointer to buffer for (len) elements (never NULL); on return, (filled) elements will have been initialized. */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to memory sufficient for (len) elements of the pointed-to type (never NULL), where (len) is the name of another parameter. More... | |
#define | LSX_PARAM_OUT_Z_CAP_POST_COUNT(len, filled) /* Required pointer to buffer for (len) elements (never NULL); on return, (filled+1) elements will have been initialized, and the array will be 0-terminated. */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to memory sufficient for (len) elements of the pointed-to type (never NULL), where (len) is the name of another parameter. More... | |
#define | LSX_PARAM_OUT_OPT /* Optional pointer to an object to be initialized (may be NULL). */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is either NULL or a valid pointer to memory sufficient for one element of the pointed-to type. More... | |
#define | LSX_PARAM_DEREF_PRE_MAYBENULL /* Required pointer (never NULL) to another pointer (may be NULL). */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer (never NULL) to another pointer which may be NULL when the function is invoked. | |
#define | LSX_PARAM_DEREF_POST_NULL /* Required pointer (never NULL) to another pointer, which will be NULL on exit. */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer (never NULL) to another pointer which will be NULL when the function returns. | |
#define | LSX_PARAM_DEREF_POST_NOTNULL /* Required pointer (never NULL) to another pointer, which will be valid (not NULL) on exit. */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer (never NULL) to another pointer which will be non-NULL when the function returns. | |
#define | LSX_USE_VAR(x) ((void)(x)) /* Parameter or variable is intentionally unused. */ |
Plugins API: Expression that "uses" a potentially-unused variable to avoid compiler warnings (especially in macro-generated code). | |
#define | lsx_static_assert(e, f) enum {lsx_static_assert_##f = 1/((e) ? 1 : 0)} |
Plugins API: Compile-time assertion. More... | |
#define | SOX_LIB_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) |
Client API: Compute a 32-bit integer API version from three 8-bit parts. More... | |
#define | SOX_LIB_VERSION_CODE SOX_LIB_VERSION(14, 4, 2) |
Client API: The API version of the sox.h file. More... | |
#define | SOX_INT_MIN(bits) (1 <<((bits)-1)) |
Client API: Returns the smallest (negative) value storable in a twos-complement signed integer with the specified number of bits, cast to an unsigned integer; for example, SOX_INT_MIN(8) = 0x80, SOX_INT_MIN(16) = 0x8000, etc. More... | |
#define | SOX_INT_MAX(bits) (((unsigned)-1)>>(33-(bits))) |
Client API: Returns the largest (positive) value storable in a twos-complement signed integer with the specified number of bits, cast to an unsigned integer; for example, SOX_INT_MAX(8) = 0x7F, SOX_INT_MAX(16) = 0x7FFF, etc. More... | |
#define | SOX_UINT_MAX(bits) (SOX_INT_MIN(bits)|SOX_INT_MAX(bits)) |
Client API: Returns the largest value storable in an unsigned integer with the specified number of bits; for example, SOX_UINT_MAX(8) = 0xFF, SOX_UINT_MAX(16) = 0xFFFF, etc. More... | |
#define | SOX_INT8_MAX SOX_INT_MAX(8) |
Client API: Returns 0x7F. | |
#define | SOX_INT16_MAX SOX_INT_MAX(16) |
Client API: Returns 0x7FFF. | |
#define | SOX_INT24_MAX SOX_INT_MAX(24) |
Client API: Returns 0x7FFFFF. | |
#define | SOX_INT32_MAX SOX_INT_MAX(32) |
Client API: Returns 0x7FFFFFFF. | |
#define | SOX_SAMPLE_PRECISION 32 |
Client API: Bits in a sox_sample_t = 32. | |
#define | SOX_SAMPLE_MAX (sox_sample_t)SOX_INT_MAX(32) |
Client API: Max value for sox_sample_t = 0x7FFFFFFF. | |
#define | SOX_SAMPLE_MIN (sox_sample_t)SOX_INT_MIN(32) |
Client API: Min value for sox_sample_t = 0x80000000. | |
#define | SOX_SAMPLE_LOCALS |
Client API: Declares the temporary local variables that are required when using SOX conversion macros. More... | |
#define | SOX_SAMPLE_NEG SOX_INT_MIN(32) |
Client API: Sign bit for sox_sample_t = 0x80000000. | |
#define | SOX_SAMPLE_TO_UNSIGNED(bits, d, clips) (sox_uint##bits##_t)(SOX_SAMPLE_TO_SIGNED(bits,d,clips) ^ SOX_INT_MIN(bits)) |
Client API: Converts sox_sample_t to an unsigned integer of width (bits). More... | |
#define | SOX_SAMPLE_TO_SIGNED(bits, d, clips) |
Client API: Converts sox_sample_t to a signed integer of width (bits). More... | |
#define | SOX_SIGNED_TO_SAMPLE(bits, d) ((sox_sample_t)(d) << (32-bits)) |
Client API: Converts signed integer of width (bits) to sox_sample_t. More... | |
#define | SOX_UNSIGNED_TO_SAMPLE(bits, d) (SOX_SIGNED_TO_SAMPLE(bits,d) ^ SOX_SAMPLE_NEG) |
Client API: Converts unsigned integer of width (bits) to sox_sample_t. More... | |
#define | SOX_UNSIGNED_8BIT_TO_SAMPLE(d, clips) SOX_UNSIGNED_TO_SAMPLE(8,d) |
Client API: Converts unsigned 8-bit integer to sox_sample_t. More... | |
#define | SOX_SIGNED_8BIT_TO_SAMPLE(d, clips) SOX_SIGNED_TO_SAMPLE(8,d) |
Client API: Converts signed 8-bit integer to sox_sample_t. More... | |
#define | SOX_UNSIGNED_16BIT_TO_SAMPLE(d, clips) SOX_UNSIGNED_TO_SAMPLE(16,d) |
Client API: Converts unsigned 16-bit integer to sox_sample_t. More... | |
#define | SOX_SIGNED_16BIT_TO_SAMPLE(d, clips) SOX_SIGNED_TO_SAMPLE(16,d) |
Client API: Converts signed 16-bit integer to sox_sample_t. More... | |
#define | SOX_UNSIGNED_24BIT_TO_SAMPLE(d, clips) SOX_UNSIGNED_TO_SAMPLE(24,d) |
Client API: Converts unsigned 24-bit integer to sox_sample_t. More... | |
#define | SOX_SIGNED_24BIT_TO_SAMPLE(d, clips) SOX_SIGNED_TO_SAMPLE(24,d) |
Client API: Converts signed 24-bit integer to sox_sample_t. More... | |
#define | SOX_UNSIGNED_32BIT_TO_SAMPLE(d, clips) ((sox_sample_t)(d) ^ SOX_SAMPLE_NEG) |
Client API: Converts unsigned 32-bit integer to sox_sample_t. More... | |
#define | SOX_SIGNED_32BIT_TO_SAMPLE(d, clips) (sox_sample_t)(d) |
Client API: Converts signed 32-bit integer to sox_sample_t. More... | |
#define | SOX_FLOAT_32BIT_TO_SAMPLE(d, clips) SOX_FLOAT_64BIT_TO_SAMPLE(d, clips) |
Client API: Converts 32-bit float to sox_sample_t. More... | |
#define | SOX_FLOAT_64BIT_TO_SAMPLE(d, clips) |
Client API: Converts 64-bit float to sox_sample_t. More... | |
#define | SOX_SAMPLE_TO_UNSIGNED_8BIT(d, clips) SOX_SAMPLE_TO_UNSIGNED(8,d,clips) |
Client API: Converts SoX native sample to an unsigned 8-bit integer. More... | |
#define | SOX_SAMPLE_TO_SIGNED_8BIT(d, clips) SOX_SAMPLE_TO_SIGNED(8,d,clips) |
Client API: Converts SoX native sample to an signed 8-bit integer. More... | |
#define | SOX_SAMPLE_TO_UNSIGNED_16BIT(d, clips) SOX_SAMPLE_TO_UNSIGNED(16,d,clips) |
Client API: Converts SoX native sample to an unsigned 16-bit integer. More... | |
#define | SOX_SAMPLE_TO_SIGNED_16BIT(d, clips) SOX_SAMPLE_TO_SIGNED(16,d,clips) |
Client API: Converts SoX native sample to a signed 16-bit integer. More... | |
#define | SOX_SAMPLE_TO_UNSIGNED_24BIT(d, clips) SOX_SAMPLE_TO_UNSIGNED(24,d,clips) |
Client API: Converts SoX native sample to an unsigned 24-bit integer. More... | |
#define | SOX_SAMPLE_TO_SIGNED_24BIT(d, clips) SOX_SAMPLE_TO_SIGNED(24,d,clips) |
Client API: Converts SoX native sample to a signed 24-bit integer. More... | |
#define | SOX_SAMPLE_TO_UNSIGNED_32BIT(d, clips) (sox_uint32_t)((d)^SOX_SAMPLE_NEG) |
Client API: Converts SoX native sample to an unsigned 32-bit integer. More... | |
#define | SOX_SAMPLE_TO_SIGNED_32BIT(d, clips) (sox_int32_t)(d) |
Client API: Converts SoX native sample to a signed 32-bit integer. More... | |
#define | SOX_SAMPLE_TO_FLOAT_32BIT(d, clips) ((d)*(1.0 / (SOX_SAMPLE_MAX + 1.0))) |
Client API: Converts SoX native sample to a 32-bit float. More... | |
#define | SOX_SAMPLE_TO_FLOAT_64BIT(d, clips) ((d)*(1.0 / (SOX_SAMPLE_MAX + 1.0))) |
Client API: Converts SoX native sample to a 64-bit float. More... | |
#define | SOX_SAMPLE_CLIP_COUNT(samp, clips) |
Client API: Clips a value of a type that is larger then sox_sample_t (for example, int64) to sox_sample_t's limits and increment a counter if clipping occurs. More... | |
#define | SOX_ROUND_CLIP_COUNT(d, clips) |
Client API: Clips a value of a type that is larger then sox_sample_t (for example, int64) to sox_sample_t's limits and increment a counter if clipping occurs. More... | |
#define | SOX_INTEGER_CLIP_COUNT(bits, i, clips) |
Client API: Clips a value to the limits of a signed integer of the specified width and increment a counter if clipping occurs. More... | |
#define | SOX_16BIT_CLIP_COUNT(i, clips) SOX_INTEGER_CLIP_COUNT(16,i,clips) |
Client API: Clips a value to the limits of a 16-bit signed integer and increment a counter if clipping occurs. More... | |
#define | SOX_24BIT_CLIP_COUNT(i, clips) SOX_INTEGER_CLIP_COUNT(24,i,clips) |
Client API: Clips a value to the limits of a 24-bit signed integer and increment a counter if clipping occurs. More... | |
#define | SOX_SIZE_MAX ((size_t)(-1)) |
Client API: Maximum value of size_t. | |
#define | SOX_UNSPEC 0 |
Client API: Members of sox_signalinfo_t are set to SOX_UNSPEC (= 0) if the actual value is not yet known. | |
#define | SOX_UNKNOWN_LEN (sox_uint64_t)(-1) |
Client API: sox_signalinfo_t.length is set to SOX_UNKNOWN_LEN (= -1) within the effects chain if the actual length is not known. More... | |
#define | SOX_IGNORE_LENGTH (sox_uint64_t)(-2) |
Client API: sox_signalinfo_t.length is set to SOX_IGNORE_LENGTH (= -2) to indicate that a format handler should ignore length information in file headers. | |
#define | SOX_DEFAULT_CHANNELS 2 |
Client API: Default channel count is 2 (stereo). | |
#define | SOX_DEFAULT_RATE 48000 |
Client API: Default rate is 48000Hz. | |
#define | SOX_DEFAULT_PRECISION 16 |
Client API: Default precision is 16 bits per sample. | |
#define | SOX_DEFAULT_ENCODING SOX_ENCODING_SIGN2 |
Client API: Default encoding is SIGN2 (linear 2's complement PCM). | |
#define | SOX_LOOP_NONE ((unsigned char)sox_loop_none) |
Client API: single-shot = 0. | |
#define | SOX_LOOP_8 ((unsigned char)sox_loop_8) |
Client API: 8 loops = 32. | |
#define | SOX_LOOP_SUSTAIN_DECAY ((unsigned char)sox_loop_sustain_decay) |
Client API: AIFF style, one sustain & one decay loop = 64. | |
#define | SOX_MAX_NLOOPS 8 |
Client API: Maximum number of loops supported by sox_oob_t = 8. | |
#define | SOX_FILE_NOSTDIO 0x0001 |
Client API: Does not use stdio routines. | |
#define | SOX_FILE_DEVICE 0x0002 |
Client API: File is an audio device. | |
#define | SOX_FILE_PHONY 0x0004 |
Client API: Phony file/device (for example /dev/null) | |
#define | SOX_FILE_REWIND 0x0008 |
Client API: File should be rewound to write header. | |
#define | SOX_FILE_BIT_REV 0x0010 |
Client API: Is file bit-reversed? | |
#define | SOX_FILE_NIB_REV 0x0020 |
Client API: Is file nibble-reversed? | |
#define | SOX_FILE_ENDIAN 0x0040 |
Client API: Is file format endian? | |
#define | SOX_FILE_ENDBIG 0x0080 |
Client API: For endian file format, is it big endian? | |
#define | SOX_FILE_MONO 0x0100 |
Client API: Do channel restrictions allow mono? | |
#define | SOX_FILE_STEREO 0x0200 |
Client API: Do channel restrictions allow stereo? | |
#define | SOX_FILE_QUAD 0x0400 |
Client API: Do channel restrictions allow quad? | |
#define | SOX_FILE_CHANS (SOX_FILE_MONO | SOX_FILE_STEREO | SOX_FILE_QUAD) |
Client API: No channel restrictions. | |
#define | SOX_FILE_LIT_END (SOX_FILE_ENDIAN | 0) |
Client API: File is little-endian. | |
#define | SOX_FILE_BIG_END (SOX_FILE_ENDIAN | SOX_FILE_ENDBIG) |
Client API: File is big-endian. | |
#define | SOX_EFF_CHAN 1 |
Client API: Effect might alter the number of channels. | |
#define | SOX_EFF_RATE 2 |
Client API: Effect might alter sample rate. | |
#define | SOX_EFF_PREC 4 |
Client API: Effect does its own calculation of output sample precision (otherwise a default value is taken, depending on the presence of SOX_EFF_MODIFY) | |
#define | SOX_EFF_LENGTH 8 |
Client API: Effect might alter audio length (as measured in time units, not necessarily in samples) | |
#define | SOX_EFF_MCHAN 16 |
Client API: Effect handles multiple channels internally. | |
#define | SOX_EFF_NULL 32 |
Client API: Effect does nothing (can be optimized out of chain) | |
#define | SOX_EFF_DEPRECATED 64 |
Client API: Effect will soon be removed from SoX. | |
#define | SOX_EFF_GAIN 128 |
Client API: Effect does not support gain -r. | |
#define | SOX_EFF_MODIFY 256 |
Client API: Effect does not modify sample values (but might remove or duplicate samples or insert zeros) | |
#define | SOX_EFF_ALPHA 512 |
Client API: Effect is experimental/incomplete. | |
#define | SOX_EFF_INTERNAL 1024 |
Client API: Effect present in libSoX but not valid for use by SoX command-line tools. | |
#define | SOX_SEEK_SET 0 |
Client API: When used as the "whence" parameter of sox_seek, indicates that the specified offset is relative to the beginning of the file. | |
#define | sox_globals (*sox_get_globals()) |
Client API: Deprecated macro that returns the structure with libSoX's global settings as an lvalue. | |
#define | sox_encodings_info (sox_get_encodings_info()) |
Client API: Deprecated macro that returns the list of available encodings. More... | |
#define | sox_format_fns (sox_get_format_fns()) |
Client API: Deprecated macro that returns the table of format handler names and functions. | |
#define | sox_effects_globals (*sox_get_effects_globals()) |
Client API: Deprecated macro that returns global parameters for effects. | |
#define | sox_effect_fns (sox_get_effect_fns()) |
Client API: Deprecated macro that returns an array containing the known effect handlers. | |
#define | lsx_fail sox_get_globals()->subsystem=__FILE__,lsx_fail_impl |
Plugins API: Report a fatal error in libSoX; printf-style arguments must follow. | |
#define | lsx_warn sox_get_globals()->subsystem=__FILE__,lsx_warn_impl |
Plugins API: Report a warning in libSoX; printf-style arguments must follow. | |
#define | lsx_report sox_get_globals()->subsystem=__FILE__,lsx_report_impl |
Plugins API: Report an informational message in libSoX; printf-style arguments must follow. | |
#define | lsx_debug sox_get_globals()->subsystem=__FILE__,lsx_debug_impl |
Plugins API: Report a debug message in libSoX; printf-style arguments must follow. | |
#define | LSX_ENUM_ITEM(prefix, item) {#item, prefix##item}, |
Plugins API: Declares a static instance of an lsx_enum_item structure in format { "item", prefixitem }, for use in declaring lsx_enum_item[] arrays. More... | |
Typedefs | |
typedef int8_t | sox_int8_t |
Client API: Signed twos-complement 8-bit type. More... | |
typedef uint8_t | sox_uint8_t |
Client API: Unsigned 8-bit type. More... | |
typedef int16_t | sox_int16_t |
Client API: Signed twos-complement 16-bit type. More... | |
typedef uint16_t | sox_uint16_t |
Client API: Unsigned 16-bit type. More... | |
typedef int32_t | sox_int32_t |
Client API: Signed twos-complement 32-bit type. More... | |
typedef uint32_t | sox_uint32_t |
Client API: Unsigned 32-bit type. More... | |
typedef int64_t | sox_int64_t |
Client API: Signed twos-complement 64-bit type. More... | |
typedef uint64_t | sox_uint64_t |
Client API: Unsigned 64-bit type. More... | |
typedef sox_int32_t | sox_int24_t |
Client API: Alias for sox_int32_t (beware of the extra byte). | |
typedef sox_uint32_t | sox_uint24_t |
Client API: Alias for sox_uint32_t (beware of the extra byte). | |
typedef sox_int32_t | sox_sample_t |
Client API: Native SoX audio sample type (alias for sox_int32_t). | |
typedef double | sox_rate_t |
Client API: Samples per second is stored as a double. | |
typedef char ** | sox_comments_t |
Client API: File's metadata, access via sox_*_comments functions. | |
typedef void(LSX_API * | sox_output_message_handler_t) (unsigned level, LSX_PARAM_IN_Z char const *filename, LSX_PARAM_IN_PRINTF char const *fmt, LSX_PARAM_IN va_list ap) |
Client API: Callback to write a message to an output device (console or log file), used by sox_globals_t.output_message_handler. More... | |
typedef sox_format_handler_t const *(LSX_API * | sox_format_fn_t) (void) |
Client API: Callback to retrieve information about a format handler, used by sox_format_tab_t.fn. More... | |
typedef sox_effect_handler_t const *(LSX_API * | sox_effect_fn_t) (void) |
Client API: Callback to get information about an effect handler, used by the table returned from sox_get_effect_fns(void). More... | |
typedef int(LSX_API * | sox_format_handler_startread) (LSX_PARAM_INOUT sox_format_t *ft) |
Client API: Callback to initialize reader (decoder), used by sox_format_handler.startread. More... | |
typedef size_t(LSX_API * | sox_format_handler_read) (LSX_PARAM_INOUT sox_format_t *ft, LSX_PARAM_OUT_CAP_POST_COUNT(len, return) sox_sample_t *buf, size_t len) |
Client API: Callback to read (decode) a block of samples, used by sox_format_handler.read. More... | |
typedef int(LSX_API * | sox_format_handler_stopread) (LSX_PARAM_INOUT sox_format_t *ft) |
Client API: Callback to close reader (decoder), used by sox_format_handler.stopread. More... | |
typedef int(LSX_API * | sox_format_handler_startwrite) (LSX_PARAM_INOUT sox_format_t *ft) |
Client API: Callback to initialize writer (encoder), used by sox_format_handler.startwrite. More... | |
typedef size_t(LSX_API * | sox_format_handler_write) (LSX_PARAM_INOUT sox_format_t *ft, LSX_PARAM_IN_COUNT(len) sox_sample_t const *buf, size_t len) |
Client API: Callback to write (encode) a block of samples, used by sox_format_handler.write. More... | |
typedef int(LSX_API * | sox_format_handler_stopwrite) (LSX_PARAM_INOUT sox_format_t *ft) |
Client API: Callback to close writer (decoder), used by sox_format_handler.stopwrite. More... | |
typedef int(LSX_API * | sox_format_handler_seek) (LSX_PARAM_INOUT sox_format_t *ft, sox_uint64_t offset) |
Client API: Callback to reposition reader, used by sox_format_handler.seek. More... | |
typedef int(LSX_API * | sox_effect_handler_getopts) (LSX_PARAM_INOUT sox_effect_t *effp, int argc, LSX_PARAM_IN_COUNT(argc) char *argv[]) |
Client API: Callback to parse command-line arguments (called once per effect), used by sox_effect_handler.getopts. More... | |
typedef int(LSX_API * | sox_effect_handler_start) (LSX_PARAM_INOUT sox_effect_t *effp) |
Client API: Callback to initialize effect (called once per flow), used by sox_effect_handler.start. More... | |
typedef int(LSX_API * | sox_effect_handler_flow) (LSX_PARAM_INOUT sox_effect_t *effp, LSX_PARAM_IN_COUNT(*isamp) sox_sample_t const *ibuf, LSX_PARAM_OUT_CAP_POST_COUNT(*osamp, *osamp) sox_sample_t *obuf, LSX_PARAM_INOUT size_t *isamp, LSX_PARAM_INOUT size_t *osamp) |
Client API: Callback to process samples, used by sox_effect_handler.flow. More... | |
typedef int(LSX_API * | sox_effect_handler_drain) (LSX_PARAM_INOUT sox_effect_t *effp, LSX_PARAM_OUT_CAP_POST_COUNT(*osamp, *osamp) sox_sample_t *obuf, LSX_PARAM_INOUT size_t *osamp) |
Client API: Callback to finish getting output after input is complete, used by sox_effect_handler.drain. More... | |
typedef int(LSX_API * | sox_effect_handler_stop) (LSX_PARAM_INOUT sox_effect_t *effp) |
Client API: Callback to shut down effect (called once per flow), used by sox_effect_handler.stop. More... | |
typedef int(LSX_API * | sox_effect_handler_kill) (LSX_PARAM_INOUT sox_effect_t *effp) |
Client API: Callback to shut down effect (called once per effect), used by sox_effect_handler.kill. More... | |
typedef int(LSX_API * | sox_flow_effects_callback) (sox_bool all_done, void *client_data) |
Client API: Callback called while flow is running (called once per buffer), used by sox_flow_effects.callback. More... | |
typedef int(LSX_API * | sox_playlist_callback_t) (void *callback_data, LSX_PARAM_IN_Z char const *filename) |
Client API: Callback for enumerating the contents of a playlist, used by the sox_parse_playlist function. More... | |
Functions | |
LSX_RETURN_VALID_Z char const *LSX_API | sox_version (void) |
Client API: Returns version number string of libSoX, for example, "14.4.0". More... | |
LSX_RETURN_VALID LSX_RETURN_PURE sox_version_info_t const *LSX_API | sox_version_info (void) |
Client API: Returns information about this build of libsox. More... | |
LSX_RETURN_VALID LSX_RETURN_PURE sox_globals_t *LSX_API | sox_get_globals (void) |
Client API: Returns a pointer to the structure with libSoX's global settings. More... | |
LSX_RETURN_ARRAY LSX_RETURN_PURE sox_encodings_info_t const *LSX_API | sox_get_encodings_info (void) |
Client API: Returns a pointer to the list of available encodings. More... | |
void LSX_API | sox_init_encodinginfo (LSX_PARAM_OUT sox_encodinginfo_t *e) |
Client API: Fills in an encodinginfo with default values. More... | |
LSX_RETURN_PURE unsigned LSX_API | sox_precision (sox_encoding_t encoding, unsigned bits_per_sample) |
Client API: Given an encoding (for example, SIGN2) and the encoded bits_per_sample (for example, 16), returns the number of useful bits per sample in the decoded data (for example, 16), or returns 0 to indicate that the value returned by the format handler should be used instead of a pre-determined precision. More... | |
size_t LSX_API | sox_num_comments (LSX_PARAM_IN_OPT sox_comments_t comments) |
Client API: Returns the number of items in the metadata block. More... | |
void LSX_API | sox_append_comment (LSX_PARAM_DEREF_PRE_MAYBENULL LSX_PARAM_DEREF_POST_NOTNULL sox_comments_t *comments, LSX_PARAM_IN_Z char const *item) |
Client API: Adds an "id=value" item to the metadata block. More... | |
void LSX_API | sox_append_comments (LSX_PARAM_DEREF_PRE_MAYBENULL LSX_PARAM_DEREF_POST_NOTNULL sox_comments_t *comments, LSX_PARAM_IN_Z char const *items) |
Client API: Adds a newline-delimited list of "id=value" items to the metadata block. More... | |
LSX_RETURN_OPT sox_comments_t LSX_API | sox_copy_comments (LSX_PARAM_IN_OPT sox_comments_t comments) |
Client API: Duplicates the metadata block. More... | |
void LSX_API | sox_delete_comments (LSX_PARAM_DEREF_PRE_MAYBENULL LSX_PARAM_DEREF_POST_NULL sox_comments_t *comments) |
Client API: Frees the metadata block. More... | |
LSX_RETURN_OPT char const *LSX_API | sox_find_comment (LSX_PARAM_IN_OPT sox_comments_t comments, LSX_PARAM_IN_Z char const *id) |
Client API: If "id=value" is found, return value, else return null. More... | |
int LSX_API | sox_format_init (void) |
Client API: Find and load format handler plugins. More... | |
void LSX_API | sox_format_quit (void) |
Client API: Unload format handler plugins. | |
int LSX_API | sox_init (void) |
Client API: Initialize effects library. More... | |
int LSX_API | sox_quit (void) |
Client API: Close effects library and unload format handler plugins. More... | |
LSX_RETURN_ARRAY LSX_RETURN_PURE sox_format_tab_t const *LSX_API | sox_get_format_fns (void) |
Client API: Returns the table of format handler names and functions. More... | |
LSX_RETURN_OPT sox_format_t *LSX_API | sox_open_read (LSX_PARAM_IN_Z char const *path, LSX_PARAM_IN_OPT sox_signalinfo_t const *signal, LSX_PARAM_IN_OPT sox_encodinginfo_t const *encoding, LSX_PARAM_IN_OPT_Z char const *filetype) |
Client API: Opens a decoding session for a file. More... | |
LSX_RETURN_OPT sox_format_t *LSX_API | sox_open_mem_read (LSX_PARAM_IN_BYTECOUNT(buffer_size) void *buffer, size_t buffer_size, LSX_PARAM_IN_OPT sox_signalinfo_t const *signal, LSX_PARAM_IN_OPT sox_encodinginfo_t const *encoding, LSX_PARAM_IN_OPT_Z char const *filetype) |
Client API: Opens a decoding session for a memory buffer. More... | |
sox_bool LSX_API | sox_format_supports_encoding (LSX_PARAM_IN_OPT_Z char const *path, LSX_PARAM_IN_OPT_Z char const *filetype, LSX_PARAM_IN sox_encodinginfo_t const *encoding) |
Client API: Returns true if the format handler for the specified file type supports the specified encoding. More... | |
LSX_RETURN_OPT sox_format_handler_t const *LSX_API | sox_write_handler (LSX_PARAM_IN_OPT_Z char const *path, LSX_PARAM_IN_OPT_Z char const *filetype, LSX_PARAM_OUT_OPT char const **filetype1) |
Client API: Gets the format handler for a specified file type. More... | |
LSX_RETURN_OPT sox_format_t *LSX_API | sox_open_write (LSX_PARAM_IN_Z char const *path, LSX_PARAM_IN sox_signalinfo_t const *signal, LSX_PARAM_IN_OPT sox_encodinginfo_t const *encoding, LSX_PARAM_IN_OPT_Z char const *filetype, LSX_PARAM_IN_OPT sox_oob_t const *oob, LSX_PARAM_IN_OPT sox_bool(LSX_API *overwrite_permitted)(LSX_PARAM_IN_Z char const *filename)) |
Client API: Opens an encoding session for a file. More... | |
LSX_RETURN_OPT sox_format_t *LSX_API | sox_open_mem_write (LSX_PARAM_OUT_BYTECAP(buffer_size) void *buffer, LSX_PARAM_IN size_t buffer_size, LSX_PARAM_IN sox_signalinfo_t const *signal, LSX_PARAM_IN_OPT sox_encodinginfo_t const *encoding, LSX_PARAM_IN_OPT_Z char const *filetype, LSX_PARAM_IN_OPT sox_oob_t const *oob) |
Client API: Opens an encoding session for a memory buffer. More... | |
LSX_RETURN_OPT sox_format_t *LSX_API | sox_open_memstream_write (LSX_PARAM_OUT char **buffer_ptr, LSX_PARAM_OUT size_t *buffer_size_ptr, LSX_PARAM_IN sox_signalinfo_t const *signal, LSX_PARAM_IN_OPT sox_encodinginfo_t const *encoding, LSX_PARAM_IN_OPT_Z char const *filetype, LSX_PARAM_IN_OPT sox_oob_t const *oob) |
Client API: Opens an encoding session for a memstream buffer. More... | |
size_t LSX_API | sox_read (LSX_PARAM_INOUT sox_format_t *ft, LSX_PARAM_OUT_CAP_POST_COUNT(len, return) sox_sample_t *buf, size_t len) |
Client API: Reads samples from a decoding session into a sample buffer. More... | |
size_t LSX_API | sox_write (LSX_PARAM_INOUT sox_format_t *ft, LSX_PARAM_IN_COUNT(len) sox_sample_t const *buf, size_t len) |
Client API: Writes samples to an encoding session from a sample buffer. More... | |
int LSX_API | sox_close (LSX_PARAM_INOUT sox_format_t *ft) |
Client API: Closes an encoding or decoding session. More... | |
int LSX_API | sox_seek (LSX_PARAM_INOUT sox_format_t *ft, sox_uint64_t offset, int whence) |
Client API: Sets the location at which next samples will be decoded. More... | |
LSX_RETURN_OPT sox_format_handler_t const *LSX_API | sox_find_format (LSX_PARAM_IN_Z char const *name, sox_bool ignore_devices) |
Client API: Finds a format handler by name. More... | |
LSX_RETURN_VALID LSX_RETURN_PURE sox_effects_globals_t *LSX_API | sox_get_effects_globals (void) |
Client API: Returns global parameters for effects. More... | |
LSX_RETURN_OPT LSX_RETURN_PURE sox_effect_handler_t const *LSX_API | sox_find_effect (LSX_PARAM_IN_Z char const *name) |
Client API: Finds the effect handler with the given name. More... | |
LSX_RETURN_OPT sox_effect_t *LSX_API | sox_create_effect (LSX_PARAM_IN sox_effect_handler_t const *eh) |
Client API: Creates an effect using the given handler. More... | |
int LSX_API | sox_effect_options (LSX_PARAM_IN sox_effect_t *effp, int argc, LSX_PARAM_IN_COUNT(argc) char *const argv[]) |
Client API: Applies the command-line options to the effect. More... | |
LSX_RETURN_VALID_Z LSX_RETURN_PURE sox_effect_fn_t const *LSX_API | sox_get_effect_fns (void) |
Client API: Returns an array containing the known effect handlers. More... | |
LSX_RETURN_OPT sox_effects_chain_t *LSX_API | sox_create_effects_chain (LSX_PARAM_IN sox_encodinginfo_t const *in_enc, LSX_PARAM_IN sox_encodinginfo_t const *out_enc) |
Client API: Initializes an effects chain. More... | |
void LSX_API | sox_delete_effects_chain (LSX_PARAM_INOUT sox_effects_chain_t *ecp) |
Client API: Closes an effects chain. More... | |
int LSX_API | sox_add_effect (LSX_PARAM_INOUT sox_effects_chain_t *chain, LSX_PARAM_INOUT sox_effect_t *effp, LSX_PARAM_INOUT sox_signalinfo_t *in, LSX_PARAM_IN sox_signalinfo_t const *out) |
Client API: Adds an effect to the effects chain, returns SOX_SUCCESS if successful. More... | |
int LSX_API | sox_flow_effects (LSX_PARAM_INOUT sox_effects_chain_t *chain, LSX_PARAM_IN_OPT sox_flow_effects_callback callback, LSX_PARAM_IN_OPT void *client_data) |
Client API: Runs the effects chain, returns SOX_SUCCESS if successful. More... | |
sox_uint64_t LSX_API | sox_effects_clips (LSX_PARAM_IN sox_effects_chain_t *chain) |
Client API: Gets the number of clips that occurred while running an effects chain. More... | |
sox_uint64_t LSX_API | sox_stop_effect (LSX_PARAM_INOUT_COUNT(effp->flows) sox_effect_t *effp) |
Client API: Shuts down an effect (calls stop on each of its flows). More... | |
void LSX_API | sox_push_effect_last (LSX_PARAM_INOUT sox_effects_chain_t *chain, LSX_PARAM_INOUT sox_effect_t *effp) |
Client API: Adds an already-initialized effect to the end of the chain. More... | |
LSX_RETURN_OPT sox_effect_t *LSX_API | sox_pop_effect_last (LSX_PARAM_INOUT sox_effects_chain_t *chain) |
Client API: Removes and returns an effect from the end of the chain. More... | |
void LSX_API | sox_delete_effect (LSX_PARAM_INOUT_COUNT(effp->flows) sox_effect_t *effp) |
Client API: Shut down and delete an effect. More... | |
void LSX_API | sox_delete_effect_last (LSX_PARAM_INOUT sox_effects_chain_t *chain) |
Client API: Shut down and delete the last effect in the chain. More... | |
void LSX_API | sox_delete_effects (LSX_PARAM_INOUT sox_effects_chain_t *chain) |
Client API: Shut down and delete all effects in the chain. More... | |
sox_uint64_t LSX_API | sox_trim_get_start (LSX_PARAM_IN sox_effect_t *effp) |
Client API: Gets the sample offset of the start of the trim, useful for efficiently skipping the part that will be trimmed anyway (get trim start, seek, then clear trim start). More... | |
void LSX_API | sox_trim_clear_start (LSX_PARAM_INOUT sox_effect_t *effp) |
Client API: Clears the start of the trim to 0. More... | |
sox_bool LSX_API | sox_is_playlist (LSX_PARAM_IN_Z char const *filename) |
Client API: Returns true if the specified file is a known playlist file type. More... | |
int LSX_API | sox_parse_playlist (LSX_PARAM_IN sox_playlist_callback_t callback, void *p, LSX_PARAM_IN char const *const listname) |
Client API: Parses the specified playlist file. More... | |
LSX_RETURN_VALID_Z LSX_RETURN_PURE char const *LSX_API | sox_strerror (int sox_errno) |
Client API: Converts a SoX error code into an error string. More... | |
size_t LSX_API | sox_basename (LSX_PARAM_OUT_Z_CAP_POST_COUNT(base_buffer_len, return) char *base_buffer, size_t base_buffer_len, LSX_PARAM_IN_Z char const *filename) |
Client API: Gets the basename of the specified file; for example, the basename of "/a/b/c.d" would be "c". More... | |
void LSX_API | lsx_fail_impl (LSX_PARAM_IN_PRINTF char const *fmt,...) LSX_PRINTF12 |
Plugins API: Print a fatal error in libSoX. More... | |
void LSX_API | lsx_warn_impl (LSX_PARAM_IN_PRINTF char const *fmt,...) LSX_PRINTF12 |
Plugins API: Print a warning in libSoX. More... | |
void LSX_API | lsx_report_impl (LSX_PARAM_IN_PRINTF char const *fmt,...) LSX_PRINTF12 |
Plugins API: Print an informational message in libSoX. More... | |
void LSX_API | lsx_debug_impl (LSX_PARAM_IN_PRINTF char const *fmt,...) LSX_PRINTF12 |
Plugins API: Print a debug message in libSoX. More... | |
LSX_RETURN_OPT LSX_RETURN_PURE lsx_enum_item const *LSX_API | lsx_find_enum_text (LSX_PARAM_IN_Z char const *text, LSX_PARAM_IN lsx_enum_item const *lsx_enum_items, int flags) |
Plugins API: Looks up an enumeration by name in an array of lsx_enum_items. More... | |
LSX_RETURN_OPT LSX_RETURN_PURE lsx_enum_item const *LSX_API | lsx_find_enum_value (unsigned value, LSX_PARAM_IN lsx_enum_item const *lsx_enum_items) |
Plugins API: Looks up an enumeration by value in an array of lsx_enum_items. More... | |
LSX_RETURN_PURE int LSX_API | lsx_enum_option (int c, LSX_PARAM_IN_Z char const *arg, LSX_PARAM_IN lsx_enum_item const *items) |
Plugins API: Looks up a command-line argument in a set of enumeration names, showing an error message if the argument is not found in the set of names. More... | |
LSX_RETURN_PURE sox_bool LSX_API | lsx_strends (LSX_PARAM_IN_Z char const *str, LSX_PARAM_IN_Z char const *end) |
Plugins API: Determines whether the specified string ends with the specified suffix (case-sensitive). More... | |
LSX_RETURN_OPT LSX_RETURN_PURE char const *LSX_API | lsx_find_file_extension (LSX_PARAM_IN_Z char const *pathname) |
Plugins API: Finds the file extension for a filename. More... | |
LSX_RETURN_VALID_Z char const *LSX_API | lsx_sigfigs3 (double number) |
Plugins API: Formats the specified number with up to three significant figures and adds a metric suffix in place of the exponent, such as 1.23G. More... | |
LSX_RETURN_VALID_Z char const *LSX_API | lsx_sigfigs3p (double percentage) |
Plugins API: Formats the specified number as a percentage, showing up to three significant figures. More... | |
LSX_RETURN_OPT void *LSX_API | lsx_realloc (LSX_PARAM_IN_OPT void *ptr, size_t newsize) |
Plugins API: Allocates, deallocates, or resizes; like C's realloc, except that this version terminates the running application if unable to allocate the requested memory. More... | |
LSX_RETURN_PURE int LSX_API | lsx_strcasecmp (LSX_PARAM_IN_Z char const *s1, LSX_PARAM_IN_Z char const *s2) |
Plugins API: Like strcmp, except that the characters are compared without regard to case. More... | |
LSX_RETURN_PURE int LSX_API | lsx_strncasecmp (LSX_PARAM_IN_Z char const *s1, LSX_PARAM_IN_Z char const *s2, size_t n) |
Plugins API: Like strncmp, except that the characters are compared without regard to case. More... | |
void LSX_API | lsx_getopt_init (LSX_PARAM_IN int argc, LSX_PARAM_IN_COUNT(argc) char *const *argv, LSX_PARAM_IN_Z char const *shortopts, LSX_PARAM_IN_OPT lsx_option_t const *longopts, LSX_PARAM_IN lsx_getopt_flags_t flags, LSX_PARAM_IN int first, LSX_PARAM_OUT lsx_getopt_t *state) |
Plugins API: Initializes an lsx_getopt_t structure for use with lsx_getopt. More... | |
int LSX_API | lsx_getopt (LSX_PARAM_INOUT lsx_getopt_t *state) |
Plugins API: Gets the next option. More... | |
sox_uint64_t LSX_API | lsx_filelength (LSX_PARAM_IN sox_format_t *ft) |
Plugins API: Gets the file length, or 0 if the file is not seekable/normal. More... | |
Contains the interface exposed to clients of the libSoX library.
Symbols starting with "sox_" or "SOX_" are part of the public interface for libSoX clients (applications that consume libSoX). Symbols starting with "lsx_" or "LSX_" are internal use by libSoX and plugins. LSX_ and lsx_ symbols should not be used by libSoX-based applications.
#define LSX_ENUM_ITEM | ( | prefix, | |
item | |||
) | {#item, prefix##item}, |
Plugins API: Declares a static instance of an lsx_enum_item structure in format { "item", prefixitem }, for use in declaring lsx_enum_item[] arrays.
prefix | The prefix to prepend to the item in the enumeration symbolic name. |
item | The user-visible text name of the item (must also be a valid C symbol name). |
#define LSX_PARAM_IN_BYTECOUNT | ( | len | ) | /* Required const pointer to (len) bytes of data (never NULL). */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to (len) const bytes of initialized data, where (len) is the name of another parameter.
len | The parameter that contains the number of bytes in the array. |
#define LSX_PARAM_IN_COUNT | ( | len | ) | /* Required const pointer to (len) valid objects (never NULL). */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to (len) const initialized elements of the pointed-to type, where (len) is the name of another parameter.
len | The parameter that contains the number of elements in the array. |
#define LSX_PARAM_INOUT /* Required pointer to a valid object (never NULL). */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to one initialized element of the pointed-to type (never NULL).
The function may modify the element.
#define LSX_PARAM_INOUT_COUNT | ( | len | ) | /* Required pointer to (len) valid objects (never NULL). */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to (len) initialized elements of the pointed-to type (never NULL).
The function may modify the elements.
len | The parameter that contains the number of elements in the array. |
#define LSX_PARAM_OUT /* Required pointer to an object to be initialized (never NULL). */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to memory sufficient for one element of the pointed-to type (never NULL).
The function will initialize the element.
#define LSX_PARAM_OUT_BYTECAP | ( | len | ) | /* Required pointer to writable buffer with room for len bytes. */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to memory sufficient for (len) bytes of data (never NULL), where (len) is the name of another parameter.
The function may write up to len bytes of data to this memory.
len | The parameter that contains the number of bytes in the array. |
#define LSX_PARAM_OUT_CAP_POST_COUNT | ( | len, | |
filled | |||
) | /* Required pointer to buffer for (len) elements (never NULL); on return, (filled) elements will have been initialized. */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to memory sufficient for (len) elements of the pointed-to type (never NULL), where (len) is the name of another parameter.
On return, (filled) elements will have been initialized, where (filled) is either the dereference of another pointer parameter (for example "*written") or the "return" parameter (indicating that the function returns the number of elements written).
len | The parameter that contains the number of elements in the array. |
filled | The dereference of the parameter that receives the number of elements written to the array, or "return" if the value is returned. |
#define LSX_PARAM_OUT_OPT /* Optional pointer to an object to be initialized (may be NULL). */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is either NULL or a valid pointer to memory sufficient for one element of the pointed-to type.
The function will initialize the element.
#define LSX_PARAM_OUT_Z_CAP_POST_COUNT | ( | len, | |
filled | |||
) | /* Required pointer to buffer for (len) elements (never NULL); on return, (filled+1) elements will have been initialized, and the array will be 0-terminated. */ |
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to memory sufficient for (len) elements of the pointed-to type (never NULL), where (len) is the name of another parameter.
On return, (filled+1) elements will have been initialized, with the last element having been initialized to 0, where (filled) is either the dereference of another pointer parameter (for example, "*written") or the "return" parameter (indicating that the function returns the number of elements written).
len | The parameter that contains the number of elements in the array. |
filled | The dereference of the parameter that receives the number of elements written to the array (not counting the terminating null), or "return" if the value is returned. |
#define LSX_RETURN_PURE /* Function is pure. */ |
Plugins API: Attribute applied to a function to indicate that it has no side effects and depends only its input parameters and global memory.
If called repeatedly, it returns the same result each time.
#define lsx_static_assert | ( | e, | |
f | |||
) | enum {lsx_static_assert_##f = 1/((e) ? 1 : 0)} |
Plugins API: Compile-time assertion.
Causes a compile error if the expression is false.
e | The expression to test. If expression is false, compilation will fail. |
f | A unique identifier for the test, for example foo_must_not_be_zero. |
#define SOX_16BIT_CLIP_COUNT | ( | i, | |
clips | |||
) | SOX_INTEGER_CLIP_COUNT(16,i,clips) |
Client API: Clips a value to the limits of a 16-bit signed integer and increment a counter if clipping occurs.
i | Value (rvalue) to be clipped. |
clips | Value (lvalue) that is incremented if clipping is needed. |
#define SOX_24BIT_CLIP_COUNT | ( | i, | |
clips | |||
) | SOX_INTEGER_CLIP_COUNT(24,i,clips) |
Client API: Clips a value to the limits of a 24-bit signed integer and increment a counter if clipping occurs.
i | Value (rvalue) to be clipped. |
clips | Value (lvalue) that is incremented if clipping is needed. |
#define sox_encodings_info (sox_get_encodings_info()) |
Client API: Deprecated macro that returns the list of available encodings.
End of list indicated by name == NULL.
#define SOX_FLOAT_32BIT_TO_SAMPLE | ( | d, | |
clips | |||
) | SOX_FLOAT_64BIT_TO_SAMPLE(d, clips) |
Client API: Converts 32-bit float to sox_sample_t.
d | Input sample to be converted, range [-1, 1). |
clips | Variable to increment if the input sample is too large or too small. |
#define SOX_FLOAT_64BIT_TO_SAMPLE | ( | d, | |
clips | |||
) |
Client API: Converts 64-bit float to sox_sample_t.
d | Input sample to be converted, range [-1, 1). |
clips | Variable to increment if the input sample is too large or too small. |
#define SOX_INT_MAX | ( | bits | ) | (((unsigned)-1)>>(33-(bits))) |
Client API: Returns the largest (positive) value storable in a twos-complement signed integer with the specified number of bits, cast to an unsigned integer; for example, SOX_INT_MAX(8) = 0x7F, SOX_INT_MAX(16) = 0x7FFF, etc.
bits | Size of value for which to calculate maximum. |
#define SOX_INT_MIN | ( | bits | ) | (1 <<((bits)-1)) |
Client API: Returns the smallest (negative) value storable in a twos-complement signed integer with the specified number of bits, cast to an unsigned integer; for example, SOX_INT_MIN(8) = 0x80, SOX_INT_MIN(16) = 0x8000, etc.
bits | Size of value for which to calculate minimum. |
#define SOX_INTEGER_CLIP_COUNT | ( | bits, | |
i, | |||
clips | |||
) |
Client API: Clips a value to the limits of a signed integer of the specified width and increment a counter if clipping occurs.
bits | Width (in bits) of target integer type. |
i | Value (rvalue) to be clipped. |
clips | Value (lvalue) that is incremented if clipping is needed. |
#define SOX_LIB_VERSION | ( | a, | |
b, | |||
c | |||
) | (((a) << 16) + ((b) << 8) + (c)) |
Client API: Compute a 32-bit integer API version from three 8-bit parts.
a | Major version. |
b | Minor version. |
c | Revision or build number. |
#define SOX_LIB_VERSION_CODE SOX_LIB_VERSION(14, 4, 2) |
Client API: The API version of the sox.h file.
It is not meant to follow the version number of SoX but it has historically. Please do not count on SOX_LIB_VERSION_CODE staying in sync with the libSoX version.
#define SOX_ROUND_CLIP_COUNT | ( | d, | |
clips | |||
) |
Client API: Clips a value of a type that is larger then sox_sample_t (for example, int64) to sox_sample_t's limits and increment a counter if clipping occurs.
d | Value (rvalue) to be clipped. |
clips | Value (lvalue) that is incremented if clipping is needed. |
#define SOX_SAMPLE_CLIP_COUNT | ( | samp, | |
clips | |||
) |
Client API: Clips a value of a type that is larger then sox_sample_t (for example, int64) to sox_sample_t's limits and increment a counter if clipping occurs.
samp | Value (lvalue) to be clipped, updated as necessary. |
clips | Value (lvalue) that is incremented if clipping is needed. |
#define SOX_SAMPLE_LOCALS |
Client API: Declares the temporary local variables that are required when using SOX conversion macros.
#define SOX_SAMPLE_TO_FLOAT_32BIT | ( | d, | |
clips | |||
) | ((d)*(1.0 / (SOX_SAMPLE_MAX + 1.0))) |
Client API: Converts SoX native sample to a 32-bit float.
d | Input sample to be converted. |
clips | The parameter is not used. |
#define SOX_SAMPLE_TO_FLOAT_64BIT | ( | d, | |
clips | |||
) | ((d)*(1.0 / (SOX_SAMPLE_MAX + 1.0))) |
Client API: Converts SoX native sample to a 64-bit float.
d | Input sample to be converted. |
clips | The parameter is not used. |
#define SOX_SAMPLE_TO_SIGNED | ( | bits, | |
d, | |||
clips | |||
) |
Client API: Converts sox_sample_t to a signed integer of width (bits).
bits | Width of resulting sample (1 through 32). |
d | Input sample to be converted. |
clips | Variable that is incremented if the result is too big. |
#define SOX_SAMPLE_TO_SIGNED_16BIT | ( | d, | |
clips | |||
) | SOX_SAMPLE_TO_SIGNED(16,d,clips) |
Client API: Converts SoX native sample to a signed 16-bit integer.
d | Input sample to be converted. |
clips | Variable to increment if input sample is too large. |
#define SOX_SAMPLE_TO_SIGNED_24BIT | ( | d, | |
clips | |||
) | SOX_SAMPLE_TO_SIGNED(24,d,clips) |
Client API: Converts SoX native sample to a signed 24-bit integer.
d | Input sample to be converted. |
clips | Variable to increment if input sample is too large. |
#define SOX_SAMPLE_TO_SIGNED_32BIT | ( | d, | |
clips | |||
) | (sox_int32_t)(d) |
Client API: Converts SoX native sample to a signed 32-bit integer.
d | Input sample to be converted. |
clips | The parameter is not used. |
#define SOX_SAMPLE_TO_SIGNED_8BIT | ( | d, | |
clips | |||
) | SOX_SAMPLE_TO_SIGNED(8,d,clips) |
Client API: Converts SoX native sample to an signed 8-bit integer.
d | Input sample to be converted. |
clips | Variable to increment if input sample is too large. |
#define SOX_SAMPLE_TO_UNSIGNED | ( | bits, | |
d, | |||
clips | |||
) | (sox_uint##bits##_t)(SOX_SAMPLE_TO_SIGNED(bits,d,clips) ^ SOX_INT_MIN(bits)) |
Client API: Converts sox_sample_t to an unsigned integer of width (bits).
bits | Width of resulting sample (1 through 32). |
d | Input sample to be converted. |
clips | Variable that is incremented if the result is too big. |
#define SOX_SAMPLE_TO_UNSIGNED_16BIT | ( | d, | |
clips | |||
) | SOX_SAMPLE_TO_UNSIGNED(16,d,clips) |
Client API: Converts SoX native sample to an unsigned 16-bit integer.
d | Input sample to be converted. |
clips | Variable to increment if input sample is too large. |
#define SOX_SAMPLE_TO_UNSIGNED_24BIT | ( | d, | |
clips | |||
) | SOX_SAMPLE_TO_UNSIGNED(24,d,clips) |
Client API: Converts SoX native sample to an unsigned 24-bit integer.
d | Input sample to be converted. |
clips | Variable to increment if input sample is too large. |
#define SOX_SAMPLE_TO_UNSIGNED_32BIT | ( | d, | |
clips | |||
) | (sox_uint32_t)((d)^SOX_SAMPLE_NEG) |
Client API: Converts SoX native sample to an unsigned 32-bit integer.
d | Input sample to be converted. |
clips | The parameter is not used. |
#define SOX_SAMPLE_TO_UNSIGNED_8BIT | ( | d, | |
clips | |||
) | SOX_SAMPLE_TO_UNSIGNED(8,d,clips) |
Client API: Converts SoX native sample to an unsigned 8-bit integer.
d | Input sample to be converted. |
clips | Variable to increment if input sample is too large. |
#define SOX_SIGNED_16BIT_TO_SAMPLE | ( | d, | |
clips | |||
) | SOX_SIGNED_TO_SAMPLE(16,d) |
Client API: Converts signed 16-bit integer to sox_sample_t.
d | Input sample to be converted. |
clips | The parameter is not used. |
#define SOX_SIGNED_24BIT_TO_SAMPLE | ( | d, | |
clips | |||
) | SOX_SIGNED_TO_SAMPLE(24,d) |
Client API: Converts signed 24-bit integer to sox_sample_t.
d | Input sample to be converted. |
clips | The parameter is not used. |
#define SOX_SIGNED_32BIT_TO_SAMPLE | ( | d, | |
clips | |||
) | (sox_sample_t)(d) |
Client API: Converts signed 32-bit integer to sox_sample_t.
d | Input sample to be converted. |
clips | The parameter is not used. |
#define SOX_SIGNED_8BIT_TO_SAMPLE | ( | d, | |
clips | |||
) | SOX_SIGNED_TO_SAMPLE(8,d) |
Client API: Converts signed 8-bit integer to sox_sample_t.
d | Input sample to be converted. |
clips | The parameter is not used. |
#define SOX_SIGNED_TO_SAMPLE | ( | bits, | |
d | |||
) | ((sox_sample_t)(d) << (32-bits)) |
Client API: Converts signed integer of width (bits) to sox_sample_t.
bits | Width of input sample (1 through 32). |
d | Input sample to be converted. |
#define SOX_UINT_MAX | ( | bits | ) | (SOX_INT_MIN(bits)|SOX_INT_MAX(bits)) |
Client API: Returns the largest value storable in an unsigned integer with the specified number of bits; for example, SOX_UINT_MAX(8) = 0xFF, SOX_UINT_MAX(16) = 0xFFFF, etc.
bits | Size of value for which to calculate maximum. |
#define SOX_UNKNOWN_LEN (sox_uint64_t)(-1) |
Client API: sox_signalinfo_t.length is set to SOX_UNKNOWN_LEN (= -1) within the effects chain if the actual length is not known.
Format handlers currently use SOX_UNSPEC instead.
#define SOX_UNSIGNED_16BIT_TO_SAMPLE | ( | d, | |
clips | |||
) | SOX_UNSIGNED_TO_SAMPLE(16,d) |
Client API: Converts unsigned 16-bit integer to sox_sample_t.
d | Input sample to be converted. |
clips | The parameter is not used. |
#define SOX_UNSIGNED_24BIT_TO_SAMPLE | ( | d, | |
clips | |||
) | SOX_UNSIGNED_TO_SAMPLE(24,d) |
Client API: Converts unsigned 24-bit integer to sox_sample_t.
d | Input sample to be converted. |
clips | The parameter is not used. |
#define SOX_UNSIGNED_32BIT_TO_SAMPLE | ( | d, | |
clips | |||
) | ((sox_sample_t)(d) ^ SOX_SAMPLE_NEG) |
Client API: Converts unsigned 32-bit integer to sox_sample_t.
d | Input sample to be converted. |
clips | The parameter is not used. |
#define SOX_UNSIGNED_8BIT_TO_SAMPLE | ( | d, | |
clips | |||
) | SOX_UNSIGNED_TO_SAMPLE(8,d) |
Client API: Converts unsigned 8-bit integer to sox_sample_t.
d | Input sample to be converted. |
clips | The parameter is not used. |
#define SOX_UNSIGNED_TO_SAMPLE | ( | bits, | |
d | |||
) | (SOX_SIGNED_TO_SAMPLE(bits,d) ^ SOX_SAMPLE_NEG) |
Client API: Converts unsigned integer of width (bits) to sox_sample_t.
bits | Width of input sample (1 through 32). |
d | Input sample to be converted. |
typedef sox_effect_handler_t const *(LSX_API * sox_effect_fn_t) (void) |
Client API: Callback to get information about an effect handler, used by the table returned from sox_get_effect_fns(void).
typedef int(LSX_API * sox_effect_handler_drain) (LSX_PARAM_INOUT sox_effect_t *effp, LSX_PARAM_OUT_CAP_POST_COUNT(*osamp, *osamp) sox_sample_t *obuf, LSX_PARAM_INOUT size_t *osamp) |
Client API: Callback to finish getting output after input is complete, used by sox_effect_handler.drain.
effp | Effect pointer. |
obuf | Buffer to which samples are written. |
osamp | On entry, contains capacity of obuf; on exit, contains number of samples written. |
typedef int(LSX_API * sox_effect_handler_flow) (LSX_PARAM_INOUT sox_effect_t *effp, LSX_PARAM_IN_COUNT(*isamp) sox_sample_t const *ibuf, LSX_PARAM_OUT_CAP_POST_COUNT(*osamp, *osamp) sox_sample_t *obuf, LSX_PARAM_INOUT size_t *isamp, LSX_PARAM_INOUT size_t *osamp) |
Client API: Callback to process samples, used by sox_effect_handler.flow.
effp | Effect pointer. |
ibuf | Buffer from which to read samples. |
obuf | Buffer to which samples are written. |
isamp | On entry, contains capacity of ibuf; on exit, contains number of samples consumed. |
osamp | On entry, contains capacity of obuf; on exit, contains number of samples written. |
typedef int(LSX_API * sox_effect_handler_getopts) (LSX_PARAM_INOUT sox_effect_t *effp, int argc, LSX_PARAM_IN_COUNT(argc) char *argv[]) |
Client API: Callback to parse command-line arguments (called once per effect), used by sox_effect_handler.getopts.
effp | Effect pointer. |
argc | Number of arguments in argv. |
argv | Array of command-line arguments. |
typedef int(LSX_API * sox_effect_handler_kill) (LSX_PARAM_INOUT sox_effect_t *effp) |
Client API: Callback to shut down effect (called once per effect), used by sox_effect_handler.kill.
effp | Effect pointer. |
typedef int(LSX_API * sox_effect_handler_start) (LSX_PARAM_INOUT sox_effect_t *effp) |
Client API: Callback to initialize effect (called once per flow), used by sox_effect_handler.start.
effp | Effect pointer. |
typedef int(LSX_API * sox_effect_handler_stop) (LSX_PARAM_INOUT sox_effect_t *effp) |
Client API: Callback to shut down effect (called once per flow), used by sox_effect_handler.stop.
effp | Effect pointer. |
Client API: Callback called while flow is running (called once per buffer), used by sox_flow_effects.callback.
typedef sox_format_handler_t const *(LSX_API * sox_format_fn_t) (void) |
Client API: Callback to retrieve information about a format handler, used by sox_format_tab_t.fn.
typedef size_t(LSX_API * sox_format_handler_read) (LSX_PARAM_INOUT sox_format_t *ft, LSX_PARAM_OUT_CAP_POST_COUNT(len, return) sox_sample_t *buf, size_t len) |
Client API: Callback to read (decode) a block of samples, used by sox_format_handler.read.
ft | Format pointer. |
buf | Buffer from which to read samples. |
len | Number of samples available in buf. |
typedef int(LSX_API * sox_format_handler_seek) (LSX_PARAM_INOUT sox_format_t *ft, sox_uint64_t offset) |
Client API: Callback to reposition reader, used by sox_format_handler.seek.
ft | Format pointer. |
offset | Sample offset to which reader should be positioned. |
typedef int(LSX_API * sox_format_handler_startread) (LSX_PARAM_INOUT sox_format_t *ft) |
Client API: Callback to initialize reader (decoder), used by sox_format_handler.startread.
ft | Format pointer. |
typedef int(LSX_API * sox_format_handler_startwrite) (LSX_PARAM_INOUT sox_format_t *ft) |
Client API: Callback to initialize writer (encoder), used by sox_format_handler.startwrite.
ft | Format pointer. |
typedef int(LSX_API * sox_format_handler_stopread) (LSX_PARAM_INOUT sox_format_t *ft) |
Client API: Callback to close reader (decoder), used by sox_format_handler.stopread.
ft | Format pointer. |
typedef int(LSX_API * sox_format_handler_stopwrite) (LSX_PARAM_INOUT sox_format_t *ft) |
Client API: Callback to close writer (decoder), used by sox_format_handler.stopwrite.
ft | Format pointer. |
typedef size_t(LSX_API * sox_format_handler_write) (LSX_PARAM_INOUT sox_format_t *ft, LSX_PARAM_IN_COUNT(len) sox_sample_t const *buf, size_t len) |
Client API: Callback to write (encode) a block of samples, used by sox_format_handler.write.
ft | Format pointer. |
buf | Buffer to which samples are written. |
len | Capacity of buf, measured in samples. |
typedef int16_t sox_int16_t |
Client API: Signed twos-complement 16-bit type.
Typically defined as short.
typedef int32_t sox_int32_t |
Client API: Signed twos-complement 32-bit type.
Typically defined as int.
typedef int64_t sox_int64_t |
Client API: Signed twos-complement 64-bit type.
Typically defined as long or long long.
typedef int8_t sox_int8_t |
Client API: Signed twos-complement 8-bit type.
Typically defined as signed char.
typedef void(LSX_API * sox_output_message_handler_t) (unsigned level, LSX_PARAM_IN_Z char const *filename, LSX_PARAM_IN_PRINTF char const *fmt, LSX_PARAM_IN va_list ap) |
Client API: Callback to write a message to an output device (console or log file), used by sox_globals_t.output_message_handler.
level | 1 = FAIL, 2 = WARN, 3 = INFO, 4 = DEBUG, 5 = DEBUG_MORE, 6 = DEBUG_MOST. |
filename | Source code FILENAME from which message originates. |
fmt | Message format string. |
ap | Message format parameters. |
typedef int(LSX_API * sox_playlist_callback_t) (void *callback_data, LSX_PARAM_IN_Z char const *filename) |
Client API: Callback for enumerating the contents of a playlist, used by the sox_parse_playlist function.
typedef uint16_t sox_uint16_t |
Client API: Unsigned 16-bit type.
Typically defined as unsigned short.
typedef uint32_t sox_uint32_t |
Client API: Unsigned 32-bit type.
Typically defined as unsigned int.
typedef uint64_t sox_uint64_t |
Client API: Unsigned 64-bit type.
Typically defined as unsigned long or unsigned long long.
typedef uint8_t sox_uint8_t |
Client API: Unsigned 8-bit type.
Typically defined as unsigned char.
anonymous enum |
enum lsx_getopt_flags_t |
enum lsx_io_type |
enum lsx_option_arg_t |
enum sox_bool |
enum sox_encoding_t |
Client API: Format of sample data.
Client API: Flags for sox_encodings_info_t: lossless/lossy1/lossy2.
enum sox_error_t |
Client API: The libSoX-specific error codes.
libSoX functions may return these codes or others that map from errno codes.
enum sox_loop_flags_t |
Client API: Loop modes: upper 4 bits mask the loop blass, lower 4 bits describe the loop behaviour, for example single shot, bidirectional etc.
enum sox_option_t |
enum sox_plot_t |
enum sox_version_flags_t |
void LSX_API lsx_debug_impl | ( | LSX_PARAM_IN_PRINTF char const * | fmt, |
... | |||
) |
Plugins API: Print a debug message in libSoX.
fmt | printf-style format string. |
LSX_RETURN_PURE int LSX_API lsx_enum_option | ( | int | c, |
LSX_PARAM_IN_Z char const * | arg, | ||
LSX_PARAM_IN lsx_enum_item const * | items | ||
) |
Plugins API: Looks up a command-line argument in a set of enumeration names, showing an error message if the argument is not found in the set of names.
c | Option character to which arg is associated, for example with -a, c would be 'a'. |
arg | Argument to find in enumeration list. |
items | Array of items to search, with text == NULL for last item. |
void LSX_API lsx_fail_impl | ( | LSX_PARAM_IN_PRINTF char const * | fmt, |
... | |||
) |
Plugins API: Print a fatal error in libSoX.
fmt | printf-style format string. |
sox_uint64_t LSX_API lsx_filelength | ( | LSX_PARAM_IN sox_format_t * | ft | ) |
Plugins API: Gets the file length, or 0 if the file is not seekable/normal.
LSX_RETURN_OPT LSX_RETURN_PURE lsx_enum_item const *LSX_API lsx_find_enum_text | ( | LSX_PARAM_IN_Z char const * | text, |
LSX_PARAM_IN lsx_enum_item const * | lsx_enum_items, | ||
int | flags | ||
) |
Plugins API: Looks up an enumeration by name in an array of lsx_enum_items.
text | Name of enumeration to find. |
lsx_enum_items | Array of items to search, with text == NULL for last item. |
flags | Search flags: 0 (case-insensitive) or lsx_find_enum_item_case_sensitive (case-sensitive). |
LSX_RETURN_OPT LSX_RETURN_PURE lsx_enum_item const *LSX_API lsx_find_enum_value | ( | unsigned | value, |
LSX_PARAM_IN lsx_enum_item const * | lsx_enum_items | ||
) |
Plugins API: Looks up an enumeration by value in an array of lsx_enum_items.
value | Enumeration value to find. |
lsx_enum_items | Array of items to search, with text == NULL for last item. |
LSX_RETURN_OPT LSX_RETURN_PURE char const *LSX_API lsx_find_file_extension | ( | LSX_PARAM_IN_Z char const * | pathname | ) |
Plugins API: Finds the file extension for a filename.
pathname | Filename to search for extension. |
int LSX_API lsx_getopt | ( | LSX_PARAM_INOUT lsx_getopt_t * | state | ) |
Plugins API: Gets the next option.
Options are parameters that start with "-" or "--". If no more options, returns -1. If unrecognized short option, returns '?'. If a recognized short option is missing a required argument, return (shortopts[0]==':' ? ':' : '?'). If successfully recognized short option, return the recognized character. If successfully recognized long option, returns (option.flag ? 0 : option.val). Note: lsx_getopt does not permute the non-option arguments.
state | The getopt state pointer. |
void LSX_API lsx_getopt_init | ( | LSX_PARAM_IN int | argc, |
LSX_PARAM_IN_COUNT(argc) char *const * | argv, | ||
LSX_PARAM_IN_Z char const * | shortopts, | ||
LSX_PARAM_IN_OPT lsx_option_t const * | longopts, | ||
LSX_PARAM_IN lsx_getopt_flags_t | flags, | ||
LSX_PARAM_IN int | first, | ||
LSX_PARAM_OUT lsx_getopt_t * | state | ||
) |
Plugins API: Initializes an lsx_getopt_t structure for use with lsx_getopt.
argc | Number of arguments in argv |
argv | Array of arguments |
shortopts | Short options, for example ":abc:def::ghi" (+/- not supported) |
longopts | Array of long option descriptors |
flags | Flags for longonly and opterr |
first | First argv to check (usually 1) |
state | State object to be initialized |
LSX_RETURN_OPT void *LSX_API lsx_realloc | ( | LSX_PARAM_IN_OPT void * | ptr, |
size_t | newsize | ||
) |
Plugins API: Allocates, deallocates, or resizes; like C's realloc, except that this version terminates the running application if unable to allocate the requested memory.
ptr | Pointer to be freed or resized, or null if allocating a new buffer. |
newsize | New size for buffer, or 0 to free the buffer. |
void LSX_API lsx_report_impl | ( | LSX_PARAM_IN_PRINTF char const * | fmt, |
... | |||
) |
Plugins API: Print an informational message in libSoX.
fmt | printf-style format string. |
LSX_RETURN_VALID_Z char const *LSX_API lsx_sigfigs3 | ( | double | number | ) |
Plugins API: Formats the specified number with up to three significant figures and adds a metric suffix in place of the exponent, such as 1.23G.
number | Number to be formatted. |
LSX_RETURN_VALID_Z char const *LSX_API lsx_sigfigs3p | ( | double | percentage | ) |
Plugins API: Formats the specified number as a percentage, showing up to three significant figures.
percentage | Number to be formatted. |
LSX_RETURN_PURE int LSX_API lsx_strcasecmp | ( | LSX_PARAM_IN_Z char const * | s1, |
LSX_PARAM_IN_Z char const * | s2 | ||
) |
Plugins API: Like strcmp, except that the characters are compared without regard to case.
s1 | First string. |
s2 | Second string. |
LSX_RETURN_PURE sox_bool LSX_API lsx_strends | ( | LSX_PARAM_IN_Z char const * | str, |
LSX_PARAM_IN_Z char const * | end | ||
) |
Plugins API: Determines whether the specified string ends with the specified suffix (case-sensitive).
str | String to search. |
end | Suffix to search for. |
LSX_RETURN_PURE int LSX_API lsx_strncasecmp | ( | LSX_PARAM_IN_Z char const * | s1, |
LSX_PARAM_IN_Z char const * | s2, | ||
size_t | n | ||
) |
Plugins API: Like strncmp, except that the characters are compared without regard to case.
s1 | First string. |
s2 | Second string. |
n | Maximum number of characters to examine. |
void LSX_API lsx_warn_impl | ( | LSX_PARAM_IN_PRINTF char const * | fmt, |
... | |||
) |
Plugins API: Print a warning in libSoX.
fmt | printf-style format string. |
int LSX_API sox_add_effect | ( | LSX_PARAM_INOUT sox_effects_chain_t * | chain, |
LSX_PARAM_INOUT sox_effect_t * | effp, | ||
LSX_PARAM_INOUT sox_signalinfo_t * | in, | ||
LSX_PARAM_IN sox_signalinfo_t const * | out | ||
) |
Client API: Adds an effect to the effects chain, returns SOX_SUCCESS if successful.
chain | Effects chain to which effect should be added . |
effp | Effect to be added. |
in | Input format. |
out | Output format. |
void LSX_API sox_append_comment | ( | LSX_PARAM_DEREF_PRE_MAYBENULL LSX_PARAM_DEREF_POST_NOTNULL sox_comments_t * | comments, |
LSX_PARAM_IN_Z char const * | item | ||
) |
Client API: Adds an "id=value" item to the metadata block.
comments | Metadata block. |
item | Item to be added in "id=value" format. |
void LSX_API sox_append_comments | ( | LSX_PARAM_DEREF_PRE_MAYBENULL LSX_PARAM_DEREF_POST_NOTNULL sox_comments_t * | comments, |
LSX_PARAM_IN_Z char const * | items | ||
) |
Client API: Adds a newline-delimited list of "id=value" items to the metadata block.
comments | Metadata block. |
items | Newline-separated list of items to be added, for example "id1=value1\\nid2=value2". |
size_t LSX_API sox_basename | ( | LSX_PARAM_OUT_Z_CAP_POST_COUNT(base_buffer_len, return) char * | base_buffer, |
size_t | base_buffer_len, | ||
LSX_PARAM_IN_Z char const * | filename | ||
) |
Client API: Gets the basename of the specified file; for example, the basename of "/a/b/c.d" would be "c".
base_buffer | Buffer into which basename should be written. |
base_buffer_len | Size of base_buffer, in bytes. |
filename | Filename from which to extract basename. |
int LSX_API sox_close | ( | LSX_PARAM_INOUT sox_format_t * | ft | ) |
Client API: Closes an encoding or decoding session.
ft | Format pointer. |
LSX_RETURN_OPT sox_comments_t LSX_API sox_copy_comments | ( | LSX_PARAM_IN_OPT sox_comments_t | comments | ) |
Client API: Duplicates the metadata block.
comments | Metadata block to copy. |
LSX_RETURN_OPT sox_effect_t *LSX_API sox_create_effect | ( | LSX_PARAM_IN sox_effect_handler_t const * | eh | ) |
Client API: Creates an effect using the given handler.
eh | Handler to use for effect. |
LSX_RETURN_OPT sox_effects_chain_t *LSX_API sox_create_effects_chain | ( | LSX_PARAM_IN sox_encodinginfo_t const * | in_enc, |
LSX_PARAM_IN sox_encodinginfo_t const * | out_enc | ||
) |
Client API: Initializes an effects chain.
Returned handle must be closed with sox_delete_effects_chain().
in_enc | Input encoding. |
out_enc | Output encoding. |
void LSX_API sox_delete_comments | ( | LSX_PARAM_DEREF_PRE_MAYBENULL LSX_PARAM_DEREF_POST_NULL sox_comments_t * | comments | ) |
Client API: Frees the metadata block.
comments | Metadata block. |
void LSX_API sox_delete_effect | ( | LSX_PARAM_INOUT_COUNT(effp->flows) sox_effect_t * | effp | ) |
Client API: Shut down and delete an effect.
effp | Effect to be deleted. |
void LSX_API sox_delete_effect_last | ( | LSX_PARAM_INOUT sox_effects_chain_t * | chain | ) |
Client API: Shut down and delete the last effect in the chain.
chain | Effects chain from which to remove the last effect. |
void LSX_API sox_delete_effects | ( | LSX_PARAM_INOUT sox_effects_chain_t * | chain | ) |
Client API: Shut down and delete all effects in the chain.
chain | Effects chain from which to delete effects. |
void LSX_API sox_delete_effects_chain | ( | LSX_PARAM_INOUT sox_effects_chain_t * | ecp | ) |
Client API: Closes an effects chain.
ecp | Effects chain pointer. |
int LSX_API sox_effect_options | ( | LSX_PARAM_IN sox_effect_t * | effp, |
int | argc, | ||
LSX_PARAM_IN_COUNT(argc) char *const | argv[] | ||
) |
Client API: Applies the command-line options to the effect.
effp | Effect pointer on which to set options. |
argc | Number of arguments in argv. |
argv | Array of command-line options. |
sox_uint64_t LSX_API sox_effects_clips | ( | LSX_PARAM_IN sox_effects_chain_t * | chain | ) |
Client API: Gets the number of clips that occurred while running an effects chain.
chain | Effects chain from which to read clip information. |
LSX_RETURN_OPT char const *LSX_API sox_find_comment | ( | LSX_PARAM_IN_OPT sox_comments_t | comments, |
LSX_PARAM_IN_Z char const * | id | ||
) |
Client API: If "id=value" is found, return value, else return null.
comments | Metadata block in which to search. |
id | Id for which to search |
LSX_RETURN_OPT LSX_RETURN_PURE sox_effect_handler_t const *LSX_API sox_find_effect | ( | LSX_PARAM_IN_Z char const * | name | ) |
Client API: Finds the effect handler with the given name.
name | Name of effect to find. |
LSX_RETURN_OPT sox_format_handler_t const *LSX_API sox_find_format | ( | LSX_PARAM_IN_Z char const * | name, |
sox_bool | ignore_devices | ||
) |
Client API: Finds a format handler by name.
name | Name of format handler to find. |
ignore_devices | Set to true to ignore device names. |
int LSX_API sox_flow_effects | ( | LSX_PARAM_INOUT sox_effects_chain_t * | chain, |
LSX_PARAM_IN_OPT sox_flow_effects_callback | callback, | ||
LSX_PARAM_IN_OPT void * | client_data | ||
) |
Client API: Runs the effects chain, returns SOX_SUCCESS if successful.
chain | Effects chain to run. |
callback | Callback for monitoring flow progress. |
client_data | Data to pass into callback. |
int LSX_API sox_format_init | ( | void | ) |
Client API: Find and load format handler plugins.
sox_bool LSX_API sox_format_supports_encoding | ( | LSX_PARAM_IN_OPT_Z char const * | path, |
LSX_PARAM_IN_OPT_Z char const * | filetype, | ||
LSX_PARAM_IN sox_encodinginfo_t const * | encoding | ||
) |
Client API: Returns true if the format handler for the specified file type supports the specified encoding.
path | Path to file to be examined (required if filetype is NULL). |
filetype | Previously-determined file type, or NULL to use extension from path. |
encoding | Encoding for which format handler should be queried. |
LSX_RETURN_VALID_Z LSX_RETURN_PURE sox_effect_fn_t const *LSX_API sox_get_effect_fns | ( | void | ) |
Client API: Returns an array containing the known effect handlers.
LSX_RETURN_VALID LSX_RETURN_PURE sox_effects_globals_t *LSX_API sox_get_effects_globals | ( | void | ) |
Client API: Returns global parameters for effects.
LSX_RETURN_ARRAY LSX_RETURN_PURE sox_encodings_info_t const *LSX_API sox_get_encodings_info | ( | void | ) |
Client API: Returns a pointer to the list of available encodings.
End of list indicated by name == NULL.
LSX_RETURN_ARRAY LSX_RETURN_PURE sox_format_tab_t const *LSX_API sox_get_format_fns | ( | void | ) |
Client API: Returns the table of format handler names and functions.
LSX_RETURN_VALID LSX_RETURN_PURE sox_globals_t *LSX_API sox_get_globals | ( | void | ) |
Client API: Returns a pointer to the structure with libSoX's global settings.
int LSX_API sox_init | ( | void | ) |
Client API: Initialize effects library.
void LSX_API sox_init_encodinginfo | ( | LSX_PARAM_OUT sox_encodinginfo_t * | e | ) |
Client API: Fills in an encodinginfo with default values.
e | Pointer to uninitialized encoding info structure to be initialized. |
sox_bool LSX_API sox_is_playlist | ( | LSX_PARAM_IN_Z char const * | filename | ) |
Client API: Returns true if the specified file is a known playlist file type.
filename | Name of file to examine. |
size_t LSX_API sox_num_comments | ( | LSX_PARAM_IN_OPT sox_comments_t | comments | ) |
Client API: Returns the number of items in the metadata block.
comments | Metadata block. |
LSX_RETURN_OPT sox_format_t *LSX_API sox_open_mem_read | ( | LSX_PARAM_IN_BYTECOUNT(buffer_size) void * | buffer, |
size_t | buffer_size, | ||
LSX_PARAM_IN_OPT sox_signalinfo_t const * | signal, | ||
LSX_PARAM_IN_OPT sox_encodinginfo_t const * | encoding, | ||
LSX_PARAM_IN_OPT_Z char const * | filetype | ||
) |
Client API: Opens a decoding session for a memory buffer.
Returned handle must be closed with sox_close().
buffer | Pointer to audio data buffer (required). |
buffer_size | Number of bytes to read from audio data buffer. |
signal | Information already known about audio stream, or NULL if none. |
encoding | Information already known about sample encoding, or NULL if none. |
filetype | Previously-determined file type, or NULL to auto-detect. |
LSX_RETURN_OPT sox_format_t *LSX_API sox_open_mem_write | ( | LSX_PARAM_OUT_BYTECAP(buffer_size) void * | buffer, |
LSX_PARAM_IN size_t | buffer_size, | ||
LSX_PARAM_IN sox_signalinfo_t const * | signal, | ||
LSX_PARAM_IN_OPT sox_encodinginfo_t const * | encoding, | ||
LSX_PARAM_IN_OPT_Z char const * | filetype, | ||
LSX_PARAM_IN_OPT sox_oob_t const * | oob | ||
) |
Client API: Opens an encoding session for a memory buffer.
Returned handle must be closed with sox_close().
buffer | Pointer to audio data buffer that receives data (required). |
buffer_size | Maximum number of bytes to write to audio data buffer. |
signal | Information about desired audio stream (required). |
encoding | Information about desired sample encoding, or NULL to use defaults. |
filetype | Previously-determined file type, or NULL to auto-detect. |
oob | Out-of-band data to add to file, or NULL if none. |
LSX_RETURN_OPT sox_format_t *LSX_API sox_open_memstream_write | ( | LSX_PARAM_OUT char ** | buffer_ptr, |
LSX_PARAM_OUT size_t * | buffer_size_ptr, | ||
LSX_PARAM_IN sox_signalinfo_t const * | signal, | ||
LSX_PARAM_IN_OPT sox_encodinginfo_t const * | encoding, | ||
LSX_PARAM_IN_OPT_Z char const * | filetype, | ||
LSX_PARAM_IN_OPT sox_oob_t const * | oob | ||
) |
Client API: Opens an encoding session for a memstream buffer.
Returned handle must be closed with sox_close().
buffer_ptr | Receives pointer to audio data buffer that receives data (required). |
buffer_size_ptr | Receives size of data written to audio data buffer (required). |
signal | Information about desired audio stream (required). |
encoding | Information about desired sample encoding, or NULL to use defaults. |
filetype | Previously-determined file type, or NULL to auto-detect. |
oob | Out-of-band data to add to file, or NULL if none. |
LSX_RETURN_OPT sox_format_t *LSX_API sox_open_read | ( | LSX_PARAM_IN_Z char const * | path, |
LSX_PARAM_IN_OPT sox_signalinfo_t const * | signal, | ||
LSX_PARAM_IN_OPT sox_encodinginfo_t const * | encoding, | ||
LSX_PARAM_IN_OPT_Z char const * | filetype | ||
) |
Client API: Opens a decoding session for a file.
Returned handle must be closed with sox_close().
path | Path to file to be opened (required). |
signal | Information already known about audio stream, or NULL if none. |
encoding | Information already known about sample encoding, or NULL if none. |
filetype | Previously-determined file type, or NULL to auto-detect. |
LSX_RETURN_OPT sox_format_t *LSX_API sox_open_write | ( | LSX_PARAM_IN_Z char const * | path, |
LSX_PARAM_IN sox_signalinfo_t const * | signal, | ||
LSX_PARAM_IN_OPT sox_encodinginfo_t const * | encoding, | ||
LSX_PARAM_IN_OPT_Z char const * | filetype, | ||
LSX_PARAM_IN_OPT sox_oob_t const * | oob, | ||
LSX_PARAM_IN_OPT | sox_boolLSX_API *overwrite_permitted)(LSX_PARAM_IN_Z char const *filename | ||
) |
Client API: Opens an encoding session for a file.
Returned handle must be closed with sox_close().
path | Path to file to be written (required). |
signal | Information about desired audio stream (required). |
encoding | Information about desired sample encoding, or NULL to use defaults. |
filetype | Previously-determined file type, or NULL to auto-detect. |
oob | Out-of-band data to add to file, or NULL if none. |
sox_bool | Called if file exists to determine whether overwrite is ok. |
int LSX_API sox_parse_playlist | ( | LSX_PARAM_IN sox_playlist_callback_t | callback, |
void * | p, | ||
LSX_PARAM_IN char const *const | listname | ||
) |
Client API: Parses the specified playlist file.
callback | Callback to call for each item in the playlist. |
p | Data to pass to callback. |
listname | Filename of playlist file. |
LSX_RETURN_OPT sox_effect_t *LSX_API sox_pop_effect_last | ( | LSX_PARAM_INOUT sox_effects_chain_t * | chain | ) |
Client API: Removes and returns an effect from the end of the chain.
chain | Effects chain from which to remove an effect. |
LSX_RETURN_PURE unsigned LSX_API sox_precision | ( | sox_encoding_t | encoding, |
unsigned | bits_per_sample | ||
) |
Client API: Given an encoding (for example, SIGN2) and the encoded bits_per_sample (for example, 16), returns the number of useful bits per sample in the decoded data (for example, 16), or returns 0 to indicate that the value returned by the format handler should be used instead of a pre-determined precision.
encoding | Encoding for which to lookup precision information. |
bits_per_sample | The number of encoded bits per sample. |
void LSX_API sox_push_effect_last | ( | LSX_PARAM_INOUT sox_effects_chain_t * | chain, |
LSX_PARAM_INOUT sox_effect_t * | effp | ||
) |
Client API: Adds an already-initialized effect to the end of the chain.
chain | Effects chain to which effect should be added. |
effp | Effect to be added. |
int LSX_API sox_quit | ( | void | ) |
Client API: Close effects library and unload format handler plugins.
size_t LSX_API sox_read | ( | LSX_PARAM_INOUT sox_format_t * | ft, |
LSX_PARAM_OUT_CAP_POST_COUNT(len, return) sox_sample_t * | buf, | ||
size_t | len | ||
) |
Client API: Reads samples from a decoding session into a sample buffer.
ft | Format pointer. |
buf | Buffer from which to read samples. |
len | Number of samples available in buf. |
int LSX_API sox_seek | ( | LSX_PARAM_INOUT sox_format_t * | ft, |
sox_uint64_t | offset, | ||
int | whence | ||
) |
Client API: Sets the location at which next samples will be decoded.
Returns SOX_SUCCESS if successful.
ft | Format pointer. |
offset | Sample offset at which to position reader. |
whence | Set to SOX_SEEK_SET. |
sox_uint64_t LSX_API sox_stop_effect | ( | LSX_PARAM_INOUT_COUNT(effp->flows) sox_effect_t * | effp | ) |
Client API: Shuts down an effect (calls stop on each of its flows).
effp | Effect to stop. |
LSX_RETURN_VALID_Z LSX_RETURN_PURE char const *LSX_API sox_strerror | ( | int | sox_errno | ) |
Client API: Converts a SoX error code into an error string.
sox_errno | Error code to look up. |
void LSX_API sox_trim_clear_start | ( | LSX_PARAM_INOUT sox_effect_t * | effp | ) |
Client API: Clears the start of the trim to 0.
effp | Trim effect. |
sox_uint64_t LSX_API sox_trim_get_start | ( | LSX_PARAM_IN sox_effect_t * | effp | ) |
Client API: Gets the sample offset of the start of the trim, useful for efficiently skipping the part that will be trimmed anyway (get trim start, seek, then clear trim start).
effp | Trim effect. |
LSX_RETURN_VALID_Z char const *LSX_API sox_version | ( | void | ) |
Client API: Returns version number string of libSoX, for example, "14.4.0".
LSX_RETURN_VALID LSX_RETURN_PURE sox_version_info_t const *LSX_API sox_version_info | ( | void | ) |
Client API: Returns information about this build of libsox.
size_t LSX_API sox_write | ( | LSX_PARAM_INOUT sox_format_t * | ft, |
LSX_PARAM_IN_COUNT(len) sox_sample_t const * | buf, | ||
size_t | len | ||
) |
Client API: Writes samples to an encoding session from a sample buffer.
ft | Format pointer. |
buf | Buffer from which to read samples. |
len | Number of samples available in buf. |
LSX_RETURN_OPT sox_format_handler_t const *LSX_API sox_write_handler | ( | LSX_PARAM_IN_OPT_Z char const * | path, |
LSX_PARAM_IN_OPT_Z char const * | filetype, | ||
LSX_PARAM_OUT_OPT char const ** | filetype1 | ||
) |
Client API: Gets the format handler for a specified file type.
path | Path to file (required if filetype is NULL). |
filetype | Filetype for which handler is needed, or NULL to use extension from path. |
filetype1 | Receives the filetype that was detected. Pass NULL if not needed. |