SoX - Sound eXchange
Audio file processing tool.
Classes | Macros | Typedefs | Enumerations | Functions
sox.h File Reference

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_APIsox_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_APIsox_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_APIsox_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_APIsox_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_APIsox_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_APIsox_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_APIsox_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_APIsox_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_APIsox_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_APIsox_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_APIsox_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_APIsox_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_APIsox_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_APIsox_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_APIsox_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_APIsox_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_APIsox_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_APIsox_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...
 

Enumerations

enum  sox_bool { sox_bool_dummy = -1 , sox_false , sox_true }
 Client API: Boolean type, assignment (but not necessarily binary) compatible with C++ bool. More...
 
enum  sox_option_t { sox_option_no , sox_option_yes , sox_option_default }
 Client API: no, yes, or default (default usually implies some kind of auto-detect logic). More...
 
enum  sox_error_t {
  SOX_SUCCESS = 0 , SOX_EOF = -1 , SOX_EHDR = 2000 , SOX_EFMT ,
  SOX_ENOMEM , SOX_EPERM , SOX_ENOTSUP , SOX_EINVAL
}
 Client API: The libSoX-specific error codes. More...
 
enum  sox_version_flags_t {
  sox_version_none = 0 , sox_version_have_popen = 1 , sox_version_have_magic = 2 , sox_version_have_threads = 4 ,
  sox_version_have_memopen = 8
}
 Client API: Flags indicating whether optional features are present in this build of libSoX. More...
 
enum  sox_encoding_t {
  SOX_ENCODING_UNKNOWN , SOX_ENCODING_SIGN2 , SOX_ENCODING_UNSIGNED , SOX_ENCODING_FLOAT ,
  SOX_ENCODING_FLOAT_TEXT , SOX_ENCODING_FLAC , SOX_ENCODING_HCOM , SOX_ENCODING_WAVPACK ,
  SOX_ENCODING_WAVPACKF , SOX_ENCODING_ULAW , SOX_ENCODING_ALAW , SOX_ENCODING_G721 ,
  SOX_ENCODING_G723 , SOX_ENCODING_CL_ADPCM , SOX_ENCODING_CL_ADPCM16 , SOX_ENCODING_MS_ADPCM ,
  SOX_ENCODING_IMA_ADPCM , SOX_ENCODING_OKI_ADPCM , SOX_ENCODING_DPCM , SOX_ENCODING_DWVW ,
  SOX_ENCODING_DWVWN , SOX_ENCODING_GSM , SOX_ENCODING_MP3 , SOX_ENCODING_VORBIS ,
  SOX_ENCODING_AMR_WB , SOX_ENCODING_AMR_NB , SOX_ENCODING_CVSD , SOX_ENCODING_LPC10 ,
  SOX_ENCODING_OPUS , SOX_ENCODINGS
}
 Client API: Format of sample data. More...
 
enum  sox_encodings_flags_t { sox_encodings_none = 0 , sox_encodings_lossy1 = 1 , sox_encodings_lossy2 = 2 }
 Client API: Flags for sox_encodings_info_t: lossless/lossy1/lossy2. More...
 
enum  sox_plot_t { sox_plot_off , sox_plot_octave , sox_plot_gnuplot , sox_plot_data }
 Client API: Type of plot. More...
 
enum  sox_loop_flags_t {
  sox_loop_none = 0 , sox_loop_forward = 1 , sox_loop_forward_back = 2 , sox_loop_8 = 32 ,
  sox_loop_sustain_decay = 64
}
 Client API: Loop modes: upper 4 bits mask the loop blass, lower 4 bits describe the loop behaviour, for example single shot, bidirectional etc. More...
 
enum  lsx_io_type { lsx_io_file , lsx_io_pipe , lsx_io_url }
 Plugins API: Is file a real file, a pipe, or a url? More...
 
enum  { lsx_find_enum_item_none = 0 , lsx_find_enum_item_case_sensitive = 1 }
 Plugins API: Flags for use with lsx_find_enum_item. More...
 
enum  lsx_option_arg_t { lsx_option_arg_none , lsx_option_arg_required , lsx_option_arg_optional }
 Plugins API: Is option argument unsupported, required, or optional. More...
 
enum  lsx_getopt_flags_t { lsx_getopt_flag_none = 0 , lsx_getopt_flag_opterr = 1 , lsx_getopt_flag_longonly = 2 }
 Plugins API: lsx_getopt_init options. 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...
 

Detailed Description

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.

Macro Definition Documentation

◆ LSX_ENUM_ITEM

#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.

Parameters
prefixThe prefix to prepend to the item in the enumeration symbolic name.
itemThe user-visible text name of the item (must also be a valid C symbol name).

◆ LSX_PARAM_IN_BYTECOUNT

#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.

Parameters
lenThe parameter that contains the number of bytes in the array.

◆ LSX_PARAM_IN_COUNT

#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.

Parameters
lenThe parameter that contains the number of elements in the array.

◆ LSX_PARAM_INOUT

#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.

◆ LSX_PARAM_INOUT_COUNT

#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.

Parameters
lenThe parameter that contains the number of elements in the array.

◆ LSX_PARAM_OUT

#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.

◆ LSX_PARAM_OUT_BYTECAP

#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.

Parameters
lenThe parameter that contains the number of bytes in the array.

◆ LSX_PARAM_OUT_CAP_POST_COUNT

#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).

Parameters
lenThe parameter that contains the number of elements in the array.
filledThe dereference of the parameter that receives the number of elements written to the array, or "return" if the value is returned.

◆ LSX_PARAM_OUT_OPT

#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.

◆ LSX_PARAM_OUT_Z_CAP_POST_COUNT

#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).

Parameters
lenThe parameter that contains the number of elements in the array.
filledThe 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.

◆ LSX_RETURN_PURE

#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.

◆ lsx_static_assert

#define lsx_static_assert (   e,
 
)    enum {lsx_static_assert_##f = 1/((e) ? 1 : 0)}

Plugins API: Compile-time assertion.

Causes a compile error if the expression is false.

Parameters
eThe expression to test. If expression is false, compilation will fail.
fA unique identifier for the test, for example foo_must_not_be_zero.

◆ SOX_16BIT_CLIP_COUNT

#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.

Parameters
iValue (rvalue) to be clipped.
clipsValue (lvalue) that is incremented if clipping is needed.
Returns
Clipped value.

◆ SOX_24BIT_CLIP_COUNT

#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.

Parameters
iValue (rvalue) to be clipped.
clipsValue (lvalue) that is incremented if clipping is needed.
Returns
Clipped value.

◆ sox_encodings_info

#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.

◆ SOX_FLOAT_32BIT_TO_SAMPLE

#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.

Parameters
dInput sample to be converted, range [-1, 1).
clipsVariable to increment if the input sample is too large or too small.
Returns
SoX native sample value.

◆ SOX_FLOAT_64BIT_TO_SAMPLE

#define SOX_FLOAT_64BIT_TO_SAMPLE (   d,
  clips 
)
Value:
LSX_USE_VAR(sox_macro_temp_sample), \
sox_macro_temp_double = (d) * (SOX_SAMPLE_MAX + 1.0), \
sox_macro_temp_double < 0 ? \
sox_macro_temp_double <= SOX_SAMPLE_MIN - 0.5 ? \
++(clips), SOX_SAMPLE_MIN : \
sox_macro_temp_double - 0.5 : \
sox_macro_temp_double >= SOX_SAMPLE_MAX + 0.5 ? \
sox_macro_temp_double > SOX_SAMPLE_MAX + 1.0 ? \
++(clips), SOX_SAMPLE_MAX : \
SOX_SAMPLE_MAX : \
sox_macro_temp_double + 0.5 \
)
#define LSX_USE_VAR(x)
Plugins API: Expression that "uses" a potentially-unused variable to avoid compiler warnings (especia...
Definition: sox.h:372
sox_int32_t sox_sample_t
Client API: Native SoX audio sample type (alias for sox_int32_t).
Definition: sox.h:451
#define SOX_SAMPLE_MIN
Client API: Min value for sox_sample_t = 0x80000000.
Definition: sox.h:696
#define SOX_SAMPLE_MAX
Client API: Max value for sox_sample_t = 0x7FFFFFFF.
Definition: sox.h:690

Client API: Converts 64-bit float to sox_sample_t.

Parameters
dInput sample to be converted, range [-1, 1).
clipsVariable to increment if the input sample is too large or too small.
Returns
SoX native sample value.

◆ SOX_INT_MAX

#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.

Parameters
bitsSize of value for which to calculate maximum.
Returns
the largest (positive) value storable in a twos-complement signed integer with the specified number of bits, cast to an unsigned integer.

◆ SOX_INT_MIN

#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.

Parameters
bitsSize of value for which to calculate minimum.
Returns
the smallest (negative) value storable in a twos-complement signed integer with the specified number of bits, cast to an unsigned integer.

◆ SOX_INTEGER_CLIP_COUNT

#define SOX_INTEGER_CLIP_COUNT (   bits,
  i,
  clips 
)
Value:
( \
(i) >(1 << ((bits)-1))- 1? ++(clips),(1 << ((bits)-1))- 1 : \
(i) <-1 << ((bits)-1) ? ++(clips),-1 << ((bits)-1) : (i))

Client API: Clips a value to the limits of a signed integer of the specified width and increment a counter if clipping occurs.

Parameters
bitsWidth (in bits) of target integer type.
iValue (rvalue) to be clipped.
clipsValue (lvalue) that is incremented if clipping is needed.
Returns
Clipped value.

◆ SOX_LIB_VERSION

#define SOX_LIB_VERSION (   a,
  b,
 
)    (((a) << 16) + ((b) << 8) + (c))

Client API: Compute a 32-bit integer API version from three 8-bit parts.

Parameters
aMajor version.
bMinor version.
cRevision or build number.
Returns
32-bit integer API version 0x000a0b0c.

◆ SOX_LIB_VERSION_CODE

#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.

◆ SOX_ROUND_CLIP_COUNT

#define SOX_ROUND_CLIP_COUNT (   d,
  clips 
)
Value:
((d) < 0? (d) <= SOX_SAMPLE_MIN - 0.5? ++(clips), SOX_SAMPLE_MIN: (d) - 0.5 \
: (d) >= SOX_SAMPLE_MAX + 0.5? ++(clips), SOX_SAMPLE_MAX: (d) + 0.5)

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.

Parameters
dValue (rvalue) to be clipped.
clipsValue (lvalue) that is incremented if clipping is needed.
Returns
Clipped value.

◆ SOX_SAMPLE_CLIP_COUNT

#define SOX_SAMPLE_CLIP_COUNT (   samp,
  clips 
)
Value:
do { \
if (samp > SOX_SAMPLE_MAX) \
{ samp = SOX_SAMPLE_MAX; clips++; } \
else if (samp < SOX_SAMPLE_MIN) \
{ samp = SOX_SAMPLE_MIN; clips++; } \
} while (0)

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.

Parameters
sampValue (lvalue) to be clipped, updated as necessary.
clipsValue (lvalue) that is incremented if clipping is needed.

◆ SOX_SAMPLE_LOCALS

#define SOX_SAMPLE_LOCALS
Value:
sox_sample_t sox_macro_temp_sample LSX_UNUSED; \
double sox_macro_temp_double LSX_UNUSED
#define LSX_UNUSED
Plugins API: Attribute applied to a parameter or local variable to suppress warnings about the variab...
Definition: sox.h:77

Client API: Declares the temporary local variables that are required when using SOX conversion macros.

◆ SOX_SAMPLE_TO_FLOAT_32BIT

#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.

Parameters
dInput sample to be converted.
clipsThe parameter is not used.

◆ SOX_SAMPLE_TO_FLOAT_64BIT

#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.

Parameters
dInput sample to be converted.
clipsThe parameter is not used.

◆ SOX_SAMPLE_TO_SIGNED

#define SOX_SAMPLE_TO_SIGNED (   bits,
  d,
  clips 
)
Value:
(sox_int##bits##_t)( \
LSX_USE_VAR(sox_macro_temp_double), \
sox_macro_temp_sample = (d), \
sox_macro_temp_sample > SOX_SAMPLE_MAX - (1 << (31-bits)) ? \
++(clips), SOX_INT_MAX(bits) : \
((sox_uint32_t)(sox_macro_temp_sample + (1 << (31-bits)))) >> (32-bits))
uint32_t sox_uint32_t
Client API: Unsigned 32-bit type.
Definition: sox.h:421
#define SOX_INT_MAX(bits)
Client API: Returns the largest (positive) value storable in a twos-complement signed integer with th...
Definition: sox.h:643

Client API: Converts sox_sample_t to a signed integer of width (bits).

Parameters
bitsWidth of resulting sample (1 through 32).
dInput sample to be converted.
clipsVariable that is incremented if the result is too big.
Returns
Signed integer of width (bits).

◆ SOX_SAMPLE_TO_SIGNED_16BIT

#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.

Parameters
dInput sample to be converted.
clipsVariable to increment if input sample is too large.

◆ SOX_SAMPLE_TO_SIGNED_24BIT

#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.

Parameters
dInput sample to be converted.
clipsVariable to increment if input sample is too large.

◆ SOX_SAMPLE_TO_SIGNED_32BIT

#define SOX_SAMPLE_TO_SIGNED_32BIT (   d,
  clips 
)    (sox_int32_t)(d)

Client API: Converts SoX native sample to a signed 32-bit integer.

Parameters
dInput sample to be converted.
clipsThe parameter is not used.

◆ SOX_SAMPLE_TO_SIGNED_8BIT

#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.

Parameters
dInput sample to be converted.
clipsVariable to increment if input sample is too large.

◆ SOX_SAMPLE_TO_UNSIGNED

#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).

Parameters
bitsWidth of resulting sample (1 through 32).
dInput sample to be converted.
clipsVariable that is incremented if the result is too big.
Returns
Unsigned integer of width (bits).

◆ SOX_SAMPLE_TO_UNSIGNED_16BIT

#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.

Parameters
dInput sample to be converted.
clipsVariable to increment if input sample is too large.

◆ SOX_SAMPLE_TO_UNSIGNED_24BIT

#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.

Parameters
dInput sample to be converted.
clipsVariable to increment if input sample is too large.

◆ SOX_SAMPLE_TO_UNSIGNED_32BIT

#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.

Parameters
dInput sample to be converted.
clipsThe parameter is not used.

◆ SOX_SAMPLE_TO_UNSIGNED_8BIT

#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.

Parameters
dInput sample to be converted.
clipsVariable to increment if input sample is too large.

◆ SOX_SIGNED_16BIT_TO_SAMPLE

#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.

Parameters
dInput sample to be converted.
clipsThe parameter is not used.
Returns
SoX native sample value.

◆ SOX_SIGNED_24BIT_TO_SAMPLE

#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.

Parameters
dInput sample to be converted.
clipsThe parameter is not used.
Returns
SoX native sample value.

◆ SOX_SIGNED_32BIT_TO_SAMPLE

#define SOX_SIGNED_32BIT_TO_SAMPLE (   d,
  clips 
)    (sox_sample_t)(d)

Client API: Converts signed 32-bit integer to sox_sample_t.

Parameters
dInput sample to be converted.
clipsThe parameter is not used.
Returns
SoX native sample value.

◆ SOX_SIGNED_8BIT_TO_SAMPLE

#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.

Parameters
dInput sample to be converted.
clipsThe parameter is not used.
Returns
SoX native sample value.

◆ SOX_SIGNED_TO_SAMPLE

#define SOX_SIGNED_TO_SAMPLE (   bits,
 
)    ((sox_sample_t)(d) << (32-bits))

Client API: Converts signed integer of width (bits) to sox_sample_t.

Parameters
bitsWidth of input sample (1 through 32).
dInput sample to be converted.
Returns
SoX native sample value.

◆ SOX_UINT_MAX

#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.

Parameters
bitsSize of value for which to calculate maximum.
Returns
the largest value storable in an unsigned integer with the specified number of bits.

◆ SOX_UNKNOWN_LEN

#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.

◆ SOX_UNSIGNED_16BIT_TO_SAMPLE

#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.

Parameters
dInput sample to be converted.
clipsThe parameter is not used.
Returns
SoX native sample value.

◆ SOX_UNSIGNED_24BIT_TO_SAMPLE

#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.

Parameters
dInput sample to be converted.
clipsThe parameter is not used.
Returns
SoX native sample value.

◆ SOX_UNSIGNED_32BIT_TO_SAMPLE

#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.

Parameters
dInput sample to be converted.
clipsThe parameter is not used.
Returns
SoX native sample value.

◆ SOX_UNSIGNED_8BIT_TO_SAMPLE

#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.

Parameters
dInput sample to be converted.
clipsThe parameter is not used.
Returns
SoX native sample value.

◆ SOX_UNSIGNED_TO_SAMPLE

#define SOX_UNSIGNED_TO_SAMPLE (   bits,
 
)     (SOX_SIGNED_TO_SAMPLE(bits,d) ^ SOX_SAMPLE_NEG)

Client API: Converts unsigned integer of width (bits) to sox_sample_t.

Parameters
bitsWidth of input sample (1 through 32).
dInput sample to be converted.
Returns
SoX native sample value.

Typedef Documentation

◆ sox_effect_fn_t

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).

Returns
Pointer to information about an effect handler.

◆ sox_effect_handler_drain

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.

Returns
SOX_SUCCESS if successful.
Parameters
effpEffect pointer.
obufBuffer to which samples are written.
osampOn entry, contains capacity of obuf; on exit, contains number of samples written.

◆ sox_effect_handler_flow

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.

Returns
SOX_SUCCESS if successful.
Parameters
effpEffect pointer.
ibufBuffer from which to read samples.
obufBuffer to which samples are written.
isampOn entry, contains capacity of ibuf; on exit, contains number of samples consumed.
osampOn entry, contains capacity of obuf; on exit, contains number of samples written.

◆ sox_effect_handler_getopts

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.

Returns
SOX_SUCCESS if successful.
Parameters
effpEffect pointer.
argcNumber of arguments in argv.
argvArray of command-line arguments.

◆ sox_effect_handler_kill

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.

Returns
SOX_SUCCESS if successful.
Parameters
effpEffect pointer.

◆ sox_effect_handler_start

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.

Returns
SOX_SUCCESS if successful.
Parameters
effpEffect pointer.

◆ sox_effect_handler_stop

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.

Returns
SOX_SUCCESS if successful.
Parameters
effpEffect pointer.

◆ sox_flow_effects_callback

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.

Returns
SOX_SUCCESS to continue, other value to abort flow.

◆ sox_format_fn_t

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.

Returns
format handler information.

◆ sox_format_handler_read

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.

Returns
number of samples read, or 0 if unsuccessful.
Parameters
ftFormat pointer.
bufBuffer from which to read samples.
lenNumber of samples available in buf.

◆ sox_format_handler_seek

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.

Returns
SOX_SUCCESS if successful.
Parameters
ftFormat pointer.
offsetSample offset to which reader should be positioned.

◆ sox_format_handler_startread

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.

Returns
SOX_SUCCESS if successful.
Parameters
ftFormat pointer.

◆ sox_format_handler_startwrite

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.

Returns
SOX_SUCCESS if successful.
Parameters
ftFormat pointer.

◆ sox_format_handler_stopread

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.

Returns
SOX_SUCCESS if successful.
Parameters
ftFormat pointer.

◆ sox_format_handler_stopwrite

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.

Returns
SOX_SUCCESS if successful.
Parameters
ftFormat pointer.

◆ sox_format_handler_write

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.

Returns
number of samples written, or 0 if unsuccessful.
Parameters
ftFormat pointer.
bufBuffer to which samples are written.
lenCapacity of buf, measured in samples.

◆ sox_int16_t

typedef int16_t sox_int16_t

Client API: Signed twos-complement 16-bit type.

Typically defined as short.

◆ sox_int32_t

typedef int32_t sox_int32_t

Client API: Signed twos-complement 32-bit type.

Typically defined as int.

◆ sox_int64_t

typedef int64_t sox_int64_t

Client API: Signed twos-complement 64-bit type.

Typically defined as long or long long.

◆ sox_int8_t

typedef int8_t sox_int8_t

Client API: Signed twos-complement 8-bit type.

Typically defined as signed char.

◆ sox_output_message_handler_t

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.

Parameters
level1 = FAIL, 2 = WARN, 3 = INFO, 4 = DEBUG, 5 = DEBUG_MORE, 6 = DEBUG_MOST.
filenameSource code FILENAME from which message originates.
fmtMessage format string.
apMessage format parameters.

◆ sox_playlist_callback_t

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.

Returns
SOX_SUCCESS if successful, any other value to abort playlist enumeration.

◆ sox_uint16_t

typedef uint16_t sox_uint16_t

Client API: Unsigned 16-bit type.

Typically defined as unsigned short.

◆ sox_uint32_t

typedef uint32_t sox_uint32_t

Client API: Unsigned 32-bit type.

Typically defined as unsigned int.

◆ sox_uint64_t

typedef uint64_t sox_uint64_t

Client API: Unsigned 64-bit type.

Typically defined as unsigned long or unsigned long long.

◆ sox_uint8_t

typedef uint8_t sox_uint8_t

Client API: Unsigned 8-bit type.

Typically defined as unsigned char.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Plugins API: Flags for use with lsx_find_enum_item.

Enumerator
lsx_find_enum_item_none 

Default parameters (case-insensitive).

lsx_find_enum_item_case_sensitive 

Enable case-sensitive search.

◆ lsx_getopt_flags_t

Plugins API: lsx_getopt_init options.

Enumerator
lsx_getopt_flag_none 

no flags (no output, not long-only)

lsx_getopt_flag_opterr 

if set, invalid options trigger lsx_warn output

lsx_getopt_flag_longonly 

if set, recognize -option as a long option

◆ lsx_io_type

Plugins API: Is file a real file, a pipe, or a url?

Enumerator
lsx_io_file 

File is a real file = 0.

lsx_io_pipe 

File is a pipe (no seeking) = 1.

lsx_io_url 

File is a URL (no seeking) = 2.

◆ lsx_option_arg_t

Plugins API: Is option argument unsupported, required, or optional.

Enumerator
lsx_option_arg_none 

Option does not have an argument.

lsx_option_arg_required 

Option requires an argument.

lsx_option_arg_optional 

Option can optionally be followed by an argument.

◆ sox_bool

enum sox_bool

Client API: Boolean type, assignment (but not necessarily binary) compatible with C++ bool.

Enumerator
sox_false 

False = 0.

sox_true 

True = 1.

◆ sox_encoding_t

Client API: Format of sample data.

Enumerator
SOX_ENCODING_UNKNOWN 

encoding has not yet been determined

SOX_ENCODING_SIGN2 

signed linear 2's comp: Mac

SOX_ENCODING_UNSIGNED 

unsigned linear: Sound Blaster

SOX_ENCODING_FLOAT 

floating point (binary format)

SOX_ENCODING_FLOAT_TEXT 

floating point (text format)

SOX_ENCODING_FLAC 

FLAC compression.

SOX_ENCODING_HCOM 

Mac FSSD files with Huffman compression.

SOX_ENCODING_WAVPACK 

WavPack with integer samples.

SOX_ENCODING_WAVPACKF 

WavPack with float samples.

SOX_ENCODING_ULAW 

u-law signed logs: US telephony, SPARC

SOX_ENCODING_ALAW 

A-law signed logs: non-US telephony, Psion.

SOX_ENCODING_G721 

G.721 4-bit ADPCM.

SOX_ENCODING_G723 

G.723 3 or 5 bit ADPCM.

SOX_ENCODING_CL_ADPCM 

Creative Labs 8 --> 2,3,4 bit Compressed PCM.

SOX_ENCODING_CL_ADPCM16 

Creative Labs 16 --> 4 bit Compressed PCM.

SOX_ENCODING_MS_ADPCM 

Microsoft Compressed PCM.

SOX_ENCODING_IMA_ADPCM 

IMA Compressed PCM.

SOX_ENCODING_OKI_ADPCM 

Dialogic/OKI Compressed PCM.

SOX_ENCODING_DPCM 

Differential PCM: Fasttracker 2 (xi)

SOX_ENCODING_DWVW 

Delta Width Variable Word.

SOX_ENCODING_DWVWN 

Delta Width Variable Word N-bit.

SOX_ENCODING_GSM 

GSM 6.10 33byte frame lossy compression.

SOX_ENCODING_MP3 

MP3 compression.

SOX_ENCODING_VORBIS 

Vorbis compression.

SOX_ENCODING_AMR_WB 

AMR-WB compression.

SOX_ENCODING_AMR_NB 

AMR-NB compression.

SOX_ENCODING_CVSD 

Continuously Variable Slope Delta modulation.

SOX_ENCODING_LPC10 

Linear Predictive Coding.

SOX_ENCODING_OPUS 

Opus compression.

SOX_ENCODINGS 

End of list marker.

◆ sox_encodings_flags_t

Client API: Flags for sox_encodings_info_t: lossless/lossy1/lossy2.

Enumerator
sox_encodings_none 

no flags specified (implies lossless encoding) = 0.

sox_encodings_lossy1 

encode, decode: lossy once = 1.

sox_encodings_lossy2 

encode, decode, encode, decode: lossy twice = 2.

◆ sox_error_t

Client API: The libSoX-specific error codes.

libSoX functions may return these codes or others that map from errno codes.

Enumerator
SOX_SUCCESS 

Function succeeded = 0.

SOX_EOF 

End Of File or other error = -1.

SOX_EHDR 

Invalid Audio Header = 2000.

SOX_EFMT 

Unsupported data format = 2001.

SOX_ENOMEM 

Can't alloc memory = 2002.

SOX_EPERM 

Operation not permitted = 2003.

SOX_ENOTSUP 

Operation not supported = 2004.

SOX_EINVAL 

Invalid argument = 2005.

◆ 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.

Enumerator
sox_loop_none 

single-shot = 0

sox_loop_forward 

forward loop = 1

sox_loop_forward_back 

forward/back loop = 2

sox_loop_8 

8 loops (??) = 32

sox_loop_sustain_decay 

AIFF style, one sustain & one decay loop = 64.

◆ sox_option_t

Client API: no, yes, or default (default usually implies some kind of auto-detect logic).

Enumerator
sox_option_no 

Option specified as no = 0.

sox_option_yes 

Option specified as yes = 1.

sox_option_default 

Option unspecified = 2.

◆ sox_plot_t

enum sox_plot_t

Client API: Type of plot.

Enumerator
sox_plot_off 

No plot = 0.

sox_plot_octave 

Octave plot = 1.

sox_plot_gnuplot 

Gnuplot plot = 2.

sox_plot_data 

Plot data = 3.

◆ sox_version_flags_t

Client API: Flags indicating whether optional features are present in this build of libSoX.

Enumerator
sox_version_none 

No special features = 0.

sox_version_have_popen 

popen = 1.

sox_version_have_magic 

magic = 2.

sox_version_have_threads 

threads = 4.

sox_version_have_memopen 

memopen = 8.

Function Documentation

◆ lsx_debug_impl()

void LSX_API lsx_debug_impl ( LSX_PARAM_IN_PRINTF char const *  fmt,
  ... 
)

Plugins API: Print a debug message in libSoX.

Parameters
fmtprintf-style format string.

◆ lsx_enum_option()

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.

Returns
The enumeration value corresponding to the matching enumeration, or INT_MAX if the argument does not match any enumeration name.
Parameters
cOption character to which arg is associated, for example with -a, c would be 'a'.
argArgument to find in enumeration list.
itemsArray of items to search, with text == NULL for last item.

◆ lsx_fail_impl()

void LSX_API lsx_fail_impl ( LSX_PARAM_IN_PRINTF char const *  fmt,
  ... 
)

Plugins API: Print a fatal error in libSoX.

Parameters
fmtprintf-style format string.

◆ lsx_filelength()

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.

Returns
The file length, or 0 if the file is not seekable/normal.

◆ lsx_find_enum_text()

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.

Returns
the corresponding item, or null if not found.
Parameters
textName of enumeration to find.
lsx_enum_itemsArray of items to search, with text == NULL for last item.
flagsSearch flags: 0 (case-insensitive) or lsx_find_enum_item_case_sensitive (case-sensitive).

◆ lsx_find_enum_value()

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.

Returns
the corresponding item, or null if not found.
Parameters
valueEnumeration value to find.
lsx_enum_itemsArray of items to search, with text == NULL for last item.

◆ lsx_find_file_extension()

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.

Returns
the file extension, not including the '.', or null if filename does not have an extension.
Parameters
pathnameFilename to search for extension.

◆ lsx_getopt()

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.

Returns
option character (short), val or 0 (long), or -1 (no more).
Parameters
stateThe getopt state pointer.

◆ lsx_getopt_init()

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.

Parameters
argcNumber of arguments in argv
argvArray of arguments
shortoptsShort options, for example ":abc:def::ghi" (+/- not supported)
longoptsArray of long option descriptors
flagsFlags for longonly and opterr
firstFirst argv to check (usually 1)
stateState object to be initialized

◆ lsx_realloc()

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.

Returns
New buffer, or null if buffer was freed.
Parameters
ptrPointer to be freed or resized, or null if allocating a new buffer.
newsizeNew size for buffer, or 0 to free the buffer.

◆ lsx_report_impl()

void LSX_API lsx_report_impl ( LSX_PARAM_IN_PRINTF char const *  fmt,
  ... 
)

Plugins API: Print an informational message in libSoX.

Parameters
fmtprintf-style format string.

◆ lsx_sigfigs3()

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.

Returns
A static buffer with the formatted number, valid until the next time this function is called (note: not thread safe).
Parameters
numberNumber to be formatted.

◆ lsx_sigfigs3p()

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.

Returns
A static buffer with the formatted number, valid until the next time this function is called (note: not thread safe).
Parameters
percentageNumber to be formatted.

◆ lsx_strcasecmp()

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.

Returns
0 (s1 == s2), negative (s1 < s2), or positive (s1 > s2).
Parameters
s1First string.
s2Second string.

◆ lsx_strends()

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).

Returns
true if the specified string ends with the specified suffix.
Parameters
strString to search.
endSuffix to search for.

◆ lsx_strncasecmp()

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.

Returns
0 (s1 == s2), negative (s1 < s2), or positive (s1 > s2).
Parameters
s1First string.
s2Second string.
nMaximum number of characters to examine.

◆ lsx_warn_impl()

void LSX_API lsx_warn_impl ( LSX_PARAM_IN_PRINTF char const *  fmt,
  ... 
)

Plugins API: Print a warning in libSoX.

Parameters
fmtprintf-style format string.

◆ sox_add_effect()

Client API: Adds an effect to the effects chain, returns SOX_SUCCESS if successful.

Returns
SOX_SUCCESS if successful.
Parameters
chainEffects chain to which effect should be added .
effpEffect to be added.
inInput format.
outOutput format.

◆ sox_append_comment()

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.

Parameters
commentsMetadata block.
itemItem to be added in "id=value" format.

◆ sox_append_comments()

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.

Parameters
commentsMetadata block.
itemsNewline-separated list of items to be added, for example "id1=value1\\nid2=value2".

◆ sox_basename()

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".

Returns
the number of characters written to base_buffer, excluding the null, or 0 on failure.
Parameters
base_bufferBuffer into which basename should be written.
base_buffer_lenSize of base_buffer, in bytes.
filenameFilename from which to extract basename.

◆ sox_close()

int LSX_API sox_close ( LSX_PARAM_INOUT sox_format_t ft)

Client API: Closes an encoding or decoding session.

Returns
SOX_SUCCESS if successful.
Parameters
ftFormat pointer.

◆ sox_copy_comments()

Client API: Duplicates the metadata block.

Returns
the copied metadata block.
Parameters
commentsMetadata block to copy.

◆ sox_create_effect()

Client API: Creates an effect using the given handler.

Returns
The new effect, or null if not found.
Parameters
ehHandler to use for effect.

◆ sox_create_effects_chain()

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().

Returns
Handle, or null on failure.
Parameters
in_encInput encoding.
out_encOutput encoding.

◆ sox_delete_comments()

Client API: Frees the metadata block.

Parameters
commentsMetadata block.

◆ sox_delete_effect()

void LSX_API sox_delete_effect ( LSX_PARAM_INOUT_COUNT(effp->flows) sox_effect_t effp)

Client API: Shut down and delete an effect.

Parameters
effpEffect to be deleted.

◆ sox_delete_effect_last()

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.

Parameters
chainEffects chain from which to remove the last effect.

◆ sox_delete_effects()

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.

Parameters
chainEffects chain from which to delete effects.

◆ sox_delete_effects_chain()

void LSX_API sox_delete_effects_chain ( LSX_PARAM_INOUT sox_effects_chain_t ecp)

Client API: Closes an effects chain.

Parameters
ecpEffects chain pointer.

◆ sox_effect_options()

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.

Returns
the number of arguments consumed.
Parameters
effpEffect pointer on which to set options.
argcNumber of arguments in argv.
argvArray of command-line options.

◆ sox_effects_clips()

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.

Returns
the number of clips that occurred while running an effects chain.
Parameters
chainEffects chain from which to read clip information.

◆ sox_find_comment()

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.

Returns
value, or null if value not found.
Parameters
commentsMetadata block in which to search.
idId for which to search

◆ sox_find_effect()

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.

Returns
Effect pointer, or null if not found.
Parameters
nameName of effect to find.

◆ sox_find_format()

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.

Returns
Format handler data, or null if not found.
Parameters
nameName of format handler to find.
ignore_devicesSet to true to ignore device names.

◆ sox_flow_effects()

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.

Returns
SOX_SUCCESS if successful.
Parameters
chainEffects chain to run.
callbackCallback for monitoring flow progress.
client_dataData to pass into callback.

◆ sox_format_init()

int LSX_API sox_format_init ( void  )

Client API: Find and load format handler plugins.

Returns
SOX_SUCCESS if successful.

◆ sox_format_supports_encoding()

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.

Returns
true if the format handler for the specified file type supports the specified encoding.
Parameters
pathPath to file to be examined (required if filetype is NULL).
filetypePreviously-determined file type, or NULL to use extension from path.
encodingEncoding for which format handler should be queried.

◆ sox_get_effect_fns()

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.

Returns
An array containing the known effect handlers.

◆ sox_get_effects_globals()

LSX_RETURN_VALID LSX_RETURN_PURE sox_effects_globals_t *LSX_API sox_get_effects_globals ( void  )

Client API: Returns global parameters for effects.

Returns
global parameters for effects.

◆ sox_get_encodings_info()

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.

Returns
pointer to the list of available encodings.

◆ sox_get_format_fns()

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.

Returns
the table of format handler names and functions.

◆ sox_get_globals()

Client API: Returns a pointer to the structure with libSoX's global settings.

Returns
a pointer to the structure with libSoX's global settings.

◆ sox_init()

int LSX_API sox_init ( void  )

Client API: Initialize effects library.

Returns
SOX_SUCCESS if successful.

◆ sox_init_encodinginfo()

void LSX_API sox_init_encodinginfo ( LSX_PARAM_OUT sox_encodinginfo_t e)

Client API: Fills in an encodinginfo with default values.

Parameters
ePointer to uninitialized encoding info structure to be initialized.

◆ sox_is_playlist()

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.

Returns
true if the specified file is a known playlist file type.
Parameters
filenameName of file to examine.

◆ sox_num_comments()

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.

Returns
the number of items in the metadata block.
Parameters
commentsMetadata block.

◆ sox_open_mem_read()

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().

Returns
The handle for the new session, or null on failure.
Parameters
bufferPointer to audio data buffer (required).
buffer_sizeNumber of bytes to read from audio data buffer.
signalInformation already known about audio stream, or NULL if none.
encodingInformation already known about sample encoding, or NULL if none.
filetypePreviously-determined file type, or NULL to auto-detect.

◆ sox_open_mem_write()

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().

Returns
The new session handle, or null on failure.
Parameters
bufferPointer to audio data buffer that receives data (required).
buffer_sizeMaximum number of bytes to write to audio data buffer.
signalInformation about desired audio stream (required).
encodingInformation about desired sample encoding, or NULL to use defaults.
filetypePreviously-determined file type, or NULL to auto-detect.
oobOut-of-band data to add to file, or NULL if none.

◆ sox_open_memstream_write()

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().

Returns
The new session handle, or null on failure.
Parameters
buffer_ptrReceives pointer to audio data buffer that receives data (required).
buffer_size_ptrReceives size of data written to audio data buffer (required).
signalInformation about desired audio stream (required).
encodingInformation about desired sample encoding, or NULL to use defaults.
filetypePreviously-determined file type, or NULL to auto-detect.
oobOut-of-band data to add to file, or NULL if none.

◆ sox_open_read()

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().

Returns
The handle for the new session, or null on failure.
Parameters
pathPath to file to be opened (required).
signalInformation already known about audio stream, or NULL if none.
encodingInformation already known about sample encoding, or NULL if none.
filetypePreviously-determined file type, or NULL to auto-detect.

◆ sox_open_write()

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().

Returns
The new session handle, or null on failure.
Parameters
pathPath to file to be written (required).
signalInformation about desired audio stream (required).
encodingInformation about desired sample encoding, or NULL to use defaults.
filetypePreviously-determined file type, or NULL to auto-detect.
oobOut-of-band data to add to file, or NULL if none.
sox_boolCalled if file exists to determine whether overwrite is ok.

◆ sox_parse_playlist()

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.

Returns
SOX_SUCCESS if successful.
Parameters
callbackCallback to call for each item in the playlist.
pData to pass to callback.
listnameFilename of playlist file.

◆ sox_pop_effect_last()

Client API: Removes and returns an effect from the end of the chain.

Returns
the removed effect, or null if no effects.
Parameters
chainEffects chain from which to remove an effect.

◆ sox_precision()

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.

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.
Parameters
encodingEncoding for which to lookup precision information.
bits_per_sampleThe number of encoded bits per sample.

◆ sox_push_effect_last()

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.

Parameters
chainEffects chain to which effect should be added.
effpEffect to be added.

◆ sox_quit()

int LSX_API sox_quit ( void  )

Client API: Close effects library and unload format handler plugins.

Returns
SOX_SUCCESS if successful.

◆ sox_read()

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.

Returns
Number of samples decoded, or 0 for EOF.
Parameters
ftFormat pointer.
bufBuffer from which to read samples.
lenNumber of samples available in buf.

◆ sox_seek()

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.

Returns
SOX_SUCCESS if successful.
Parameters
ftFormat pointer.
offsetSample offset at which to position reader.
whenceSet to SOX_SEEK_SET.

◆ sox_stop_effect()

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).

Returns
the number of clips from all flows.
Parameters
effpEffect to stop.

◆ sox_strerror()

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.

Returns
error string corresponding to the specified error code, or a generic message if the error code is not recognized.
Parameters
sox_errnoError code to look up.

◆ sox_trim_clear_start()

void LSX_API sox_trim_clear_start ( LSX_PARAM_INOUT sox_effect_t effp)

Client API: Clears the start of the trim to 0.

Parameters
effpTrim effect.

◆ sox_trim_get_start()

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).

Returns
the sample offset of the start of the trim.
Parameters
effpTrim effect.

◆ sox_version()

LSX_RETURN_VALID_Z char const *LSX_API sox_version ( void  )

Client API: Returns version number string of libSoX, for example, "14.4.0".

Returns
The version number string of libSoX, for example, "14.4.0".

◆ sox_version_info()

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.

Returns
Pointer to a version information structure.

◆ sox_write()

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.

Returns
Number of samples encoded.
Parameters
ftFormat pointer.
bufBuffer from which to read samples.
lenNumber of samples available in buf.

◆ sox_write_handler()

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.

Returns
The found format handler, or null if not found.
Parameters
pathPath to file (required if filetype is NULL).
filetypeFiletype for which handler is needed, or NULL to use extension from path.
filetype1Receives the filetype that was detected. Pass NULL if not needed.