/* libSoX Library Public Interface * * Copyright 1999-2012 Chris Bagwell and SoX Contributors. * * This source code is freely redistributable and may be used for * any purpose. This copyright notice must be maintained. * Chris Bagwell And SoX Contributors are not responsible for * the consequences of using this software. */ /** @fileContains the interface exposed to clients of the libSoX library.Symbols starting with "sox_" or "SOX_" are part of the public interface forlibSoX 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.*/ #ifndef SOX_H#define SOX_H /**< Client API: This macro is defined if sox.h has been included. */ #include <limits.h>#include <stdarg.h>#include <stddef.h>#include <stdint.h> #if defined(__cplusplus)extern "C" {#endif /* Suppress warnings from use of type long long. */#if defined __GNUC__#pragma GCC system_header#endif #if defined __GNUC__#define LSX_GCC(maj, min) \ ((__GNUC__ > (maj)) || (__GNUC__ == (maj) && __GNUC_MINOR__ >= (min)))#else#define LSX_GCC(maj, min) 0#endif #if LSX_GCC(4,9)#define _Ret_ __attribute__ ((returns_nonnull))#define _Ret_valid_ _Ret_#define _Ret_z_ _Ret_#endif /*****************************************************************************API decoration macros:Mostly for documentation purposes. For some compilers, decorations also affectcode generation, influence compiler warnings or activate compileroptimizations.*****************************************************************************/ /**Plugins API:Attribute required on all functions exported by libSoX and on all functionpointer types used by the libSoX API.*/#if defined __GNUC__ && defined __i386__#define LSX_API __attribute__ ((cdecl)) /* libSoX function */#elif _MSC_VER#define LSX_API __cdecl /* libSoX function */#else#define LSX_API /* libSoX function */#endif /**Plugins API:Attribute applied to a parameter or local variable to suppress warnings aboutthe variable being unused (especially in macro-generated code).*/#ifdef __GNUC__#define LSX_UNUSED __attribute__ ((unused)) /* Parameter or local variable is intentionally unused. */#else#define LSX_UNUSED /* Parameter or local variable is intentionally unused. */#endif /**Plugins API:LSX_PRINTF12: Attribute applied to a function to indicate that it requiresa printf-style format string for arg1 and that printf parameters start atarg2.*/#ifdef __GNUC__#define LSX_PRINTF12 __attribute__ ((format (printf, 1, 2))) /* Function has printf-style arguments. */#else#define LSX_PRINTF12 /* Function has printf-style arguments. */#endif /**Plugins API:Attribute applied to a function to indicate that it has no side effects anddepends only its input parameters and global memory. If called repeatedly, itreturns the same result each time.*/#ifdef __GNUC__#define LSX_RETURN_PURE __attribute__ ((pure)) /* Function is pure. */#else#define LSX_RETURN_PURE /* Function is pure. */#endif /**Plugins API:Attribute applied to a function to indicate that thereturn value is always a pointer to a valid object (never NULL).*/#ifdef _Ret_#define LSX_RETURN_VALID _Ret_ /* Function always returns a valid object (never NULL). */#else#define LSX_RETURN_VALID /* Function always returns a valid object (never NULL). */#endif /**Plugins API:Attribute applied to a function to indicate that the return value is always apointer to a valid array (never NULL).*/#ifdef _Ret_valid_#define LSX_RETURN_ARRAY _Ret_valid_ /* Function always returns a valid array (never NULL). */#else#define LSX_RETURN_ARRAY /* Function always returns a valid array (never NULL). */#endif /**Plugins API:Attribute applied to a function to indicate that the return value is always apointer to a valid 0-terminated array (never NULL).*/#ifdef _Ret_z_#define LSX_RETURN_VALID_Z _Ret_z_ /* Function always returns a 0-terminated array (never NULL). */#else#define LSX_RETURN_VALID_Z /* Function always returns a 0-terminated array (never NULL). */#endif /**Plugins API:Attribute applied to a function to indicate that the returned pointer may benull.*/#ifdef _Ret_opt_#define LSX_RETURN_OPT _Ret_opt_ /* Function may return NULL. */#else#define LSX_RETURN_OPT /* Function may return NULL. */#endif /**Plugins API:Attribute applied to a parameter to indicate that the parameter is a validpointer to one const element of the pointed-to type (never NULL).*/#ifdef _In_#define LSX_PARAM_IN _In_ /* Required const pointer to a valid object (never NULL). */#else#define LSX_PARAM_IN /* Required const pointer to a valid object (never NULL). */#endif /**Plugins API:Attribute applied to a parameter to indicate that the parameter is a validpointer to a const 0-terminated string (never NULL).*/#ifdef _In_z_#define LSX_PARAM_IN_Z _In_z_ /* Required const pointer to 0-terminated string (never NULL). */#else#define LSX_PARAM_IN_Z /* Required const pointer to 0-terminated string (never NULL). */#endif /**Plugins API:Attribute applied to a parameter to indicate that the parameter is a constpointer to a 0-terminated printf format string.*/#ifdef _Printf_format_string_#define LSX_PARAM_IN_PRINTF _Printf_format_string_ /* Required const pointer to 0-terminated printf format string (never NULL). */#else#define LSX_PARAM_IN_PRINTF /* Required const pointer to 0-terminated printf format string (never NULL). */#endif /**Plugins API:Attribute applied to a parameter to indicate that the parameter is a validpointer to (len) const initialized elements of the pointed-to type, where(len) is the name of another parameter.@param len The parameter that contains the number of elements in the array.*/#ifdef _In_count_#define LSX_PARAM_IN_COUNT(len) _In_count_(len) /* Required const pointer to (len) valid objects (never NULL). */#else#define LSX_PARAM_IN_COUNT(len) /* Required const pointer to (len) valid objects (never NULL). */#endif /**Plugins API:Attribute applied to a parameter to indicate that the parameter is a validpointer to (len) const bytes of initialized data, where (len) is the name ofanother parameter.@param len The parameter that contains the number of bytes in the array.*/#ifdef _In_bytecount_#define LSX_PARAM_IN_BYTECOUNT(len) _In_bytecount_(len) /* Required const pointer to (len) bytes of data (never NULL). */#else#define LSX_PARAM_IN_BYTECOUNT(len) /* Required const pointer to (len) bytes of data (never NULL). */#endif /**Plugins API:Attribute applied to a parameter to indicate that the parameter is either NULLor a valid pointer to one const element of the pointed-to type.*/#ifdef _In_opt_#define LSX_PARAM_IN_OPT _In_opt_ /* Optional const pointer to a valid object (may be NULL). */#else#define LSX_PARAM_IN_OPT /* Optional const pointer to a valid object (may be NULL). */#endif /**Plugins API:Attribute applied to a parameter to indicate that the parameter is either NULLor a valid pointer to a const 0-terminated string.*/#ifdef _In_opt_z_#define LSX_PARAM_IN_OPT_Z _In_opt_z_ /* Optional const pointer to 0-terminated string (may be NULL). */#else#define LSX_PARAM_IN_OPT_Z /* Optional const pointer to 0-terminated string (may be NULL). */#endif /**Plugins API:Attribute applied to a parameter to indicate that the parameter is a validpointer to one initialized element of the pointed-to type (never NULL). Thefunction may modify the element.*/#ifdef _Inout_#define LSX_PARAM_INOUT _Inout_ /* Required pointer to a valid object (never NULL). */#else#define LSX_PARAM_INOUT /* Required pointer to a valid object (never NULL). */#endif /**Plugins API:Attribute applied to a parameter to indicate that the parameter is a validpointer to (len) initialized elements of the pointed-to type (never NULL). Thefunction may modify the elements.@param len The parameter that contains the number of elements in the array.*/#ifdef _Inout_count_x_#define LSX_PARAM_INOUT_COUNT(len) _Inout_count_x_(len) /* Required pointer to (len) valid objects (never NULL). */#else#define LSX_PARAM_INOUT_COUNT(len) /* Required pointer to (len) valid objects (never NULL). */#endif /**Plugins API:Attribute applied to a parameter to indicate that the parameter is a validpointer to memory sufficient for one element of the pointed-to type (neverNULL). The function will initialize the element.*/#ifdef _Out_#define LSX_PARAM_OUT _Out_ /* Required pointer to an object to be initialized (never NULL). */#else#define LSX_PARAM_OUT /* Required pointer to an object to be initialized (never NULL). */#endif /**Plugins API:Attribute applied to a parameter to indicate that the parameter is a validpointer 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 ofdata to this memory.@param len The parameter that contains the number of bytes in the array.*/#ifdef _Out_bytecap_#define LSX_PARAM_OUT_BYTECAP(len) _Out_bytecap_(len) /* Required pointer to writable buffer with room for len bytes. */#else#define LSX_PARAM_OUT_BYTECAP(len) /* Required pointer to writable buffer with room for len bytes. */#endif /**Plugins API:Attribute applied to a parameter to indicate that the parameter is a validpointer to memory sufficient for (len) elements of the pointed-to type (neverNULL), where (len) is the name of another parameter. On return, (filled)elements will have been initialized, where (filled) is either the dereferenceof another pointer parameter (for example "*written") or the "return"parameter (indicating that the function returns the number of elementswritten).@param len The parameter that contains the number of elements in the array.@param filled The dereference of the parameter that receives the number of elements written to the array, or "return" if the value is returned.*/#ifdef _Out_cap_post_count_#define LSX_PARAM_OUT_CAP_POST_COUNT(len,filled) _Out_cap_post_count_(len,filled) /* Required pointer to buffer for (len) elements (never NULL); on return, (filled) elements will have been initialized. */#else#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. */#endif /**Plugins API:Attribute applied to a parameter to indicate that the parameter is a validpointer to memory sufficient for (len) elements of the pointed-to type (neverNULL), where (len) is the name of another parameter. On return, (filled+1)elements will have been initialized, with the last element having beeninitialized to 0, where (filled) is either the dereference of another pointerparameter (for example, "*written") or the "return" parameter (indicating thatthe function returns the number of elements written).@param len The parameter that contains the number of elements in the array.@param filled The dereference of the parameter that receives the number of elements written to the array (not counting the terminating null), or "return" if the value is returned.*/#ifdef _Out_z_cap_post_count_#define LSX_PARAM_OUT_Z_CAP_POST_COUNT(len,filled) _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. */#else#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. */#endif /**Plugins API:Attribute applied to a parameter to indicate that the parameter is either NULLor a valid pointer to memory sufficient for one element of the pointed-totype. The function will initialize the element.*/#ifdef _Out_opt_#define LSX_PARAM_OUT_OPT _Out_opt_ /* Optional pointer to an object to be initialized (may be NULL). */#else#define LSX_PARAM_OUT_OPT /* Optional pointer to an object to be initialized (may be NULL). */#endif /**Plugins API:Attribute applied to a parameter to indicate that the parameter is a validpointer (never NULL) to another pointer which may be NULL when the function isinvoked.*/#ifdef _Deref_pre_maybenull_#define LSX_PARAM_DEREF_PRE_MAYBENULL _Deref_pre_maybenull_ /* Required pointer (never NULL) to another pointer (may be NULL). */#else#define LSX_PARAM_DEREF_PRE_MAYBENULL /* Required pointer (never NULL) to another pointer (may be NULL). */#endif /**Plugins API:Attribute applied to a parameter to indicate that the parameter is a validpointer (never NULL) to another pointer which will be NULL when the functionreturns.*/#ifdef _Deref_post_null_#define LSX_PARAM_DEREF_POST_NULL _Deref_post_null_ /* Required pointer (never NULL) to another pointer, which will be NULL on exit. */#else#define LSX_PARAM_DEREF_POST_NULL /* Required pointer (never NULL) to another pointer, which will be NULL on exit. */#endif /**Plugins API:Attribute applied to a parameter to indicate that the parameter is a validpointer (never NULL) to another pointer which will be non-NULL when thefunction returns.*/#ifdef _Deref_post_notnull_#define LSX_PARAM_DEREF_POST_NOTNULL _Deref_post_notnull_ /* Required pointer (never NULL) to another pointer, which will be valid (not NULL) on exit. */#else#define LSX_PARAM_DEREF_POST_NOTNULL /* Required pointer (never NULL) to another pointer, which will be valid (not NULL) on exit. */#endif /**Plugins API:Expression that "uses" a potentially-unused variable to avoid compilerwarnings (especially in macro-generated code).*/#ifdef _PREFAST_#define LSX_USE_VAR(x) ((void)(x=0)) /* During static analysis, initialize unused variables to 0. */#else#define LSX_USE_VAR(x) ((void)(x)) /* Parameter or variable is intentionally unused. */#endif /**Plugins API:Compile-time assertion. Causes a compile error if the expression is false.@param e The expression to test. If expression is false, compilation will fail.@param f A unique identifier for the test, for example foo_must_not_be_zero.*/#define lsx_static_assert(e,f) enum {lsx_static_assert_##f = 1/((e) ? 1 : 0)} /*****************************************************************************Basic typedefs:*****************************************************************************/ /**Client API:Signed twos-complement 8-bit type. Typically defined as signed char.*/typedef int8_t sox_int8_t; /**Client API:Unsigned 8-bit type. Typically defined as unsigned char.*/typedef uint8_t sox_uint8_t; /**Client API:Signed twos-complement 16-bit type. Typically defined as short.*/typedef int16_t sox_int16_t; /**Client API:Unsigned 16-bit type. Typically defined as unsigned short.*/typedef uint16_t sox_uint16_t; /**Client API:Signed twos-complement 32-bit type. Typically defined as int.*/typedef int32_t sox_int32_t; /**Client API:Unsigned 32-bit type. Typically defined as unsigned int.*/typedef uint32_t sox_uint32_t; /**Client API:Signed twos-complement 64-bit type. Typically defined as long or long long.*/typedef int64_t sox_int64_t; /**Client API:Unsigned 64-bit type. Typically defined as unsigned long or unsigned long long.*/typedef uint64_t sox_uint64_t; /**Client API:Alias for sox_int32_t (beware of the extra byte).*/typedef sox_int32_t sox_int24_t; /**Client API:Alias for sox_uint32_t (beware of the extra byte).*/typedef sox_uint32_t sox_uint24_t; /**Client API:Native SoX audio sample type (alias for sox_int32_t).*/typedef sox_int32_t sox_sample_t; /**Client API:Samples per second is stored as a double.*/typedef double sox_rate_t; /**Client API:File's metadata, access via sox_*_comments functions.*/typedef char * * sox_comments_t; /*****************************************************************************Enumerations:*****************************************************************************/ /**Client API:Boolean type, assignment (but not necessarily binary) compatible with C++ bool.*/typedef enum sox_bool { sox_bool_dummy = -1, /* Ensure a signed type */ sox_false, /**< False = 0. */ sox_true /**< True = 1. */} sox_bool; /**Client API:no, yes, or default (default usually implies some kind of auto-detect logic).*/typedef enum sox_option_t { sox_option_no, /**< Option specified as no = 0. */ sox_option_yes, /**< Option specified as yes = 1. */ sox_option_default /**< Option unspecified = 2. */} sox_option_t; /**Client API:The libSoX-specific error codes.libSoX functions may return these codes or others that map from errno codes.*/enum sox_error_t { SOX_SUCCESS = 0, /**< Function succeeded = 0 */ SOX_EOF = -1, /**< End Of File or other error = -1 */ SOX_EHDR = 2000, /**< Invalid Audio Header = 2000 */ SOX_EFMT, /**< Unsupported data format = 2001 */ SOX_ENOMEM, /**< Can't alloc memory = 2002 */ SOX_EPERM, /**< Operation not permitted = 2003 */Lines 1–500 of 2605. Load more
/* libSoX Library Public Interface * * Copyright 1999-2012 Chris Bagwell and SoX Contributors. * * This source code is freely redistributable and may be used for * any purpose. This copyright notice must be maintained. * Chris Bagwell And SoX Contributors are not responsible for * the consequences of using this software. */ /** @file 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. */ #ifndef SOX_H #define SOX_H /**< Client API: This macro is defined if sox.h has been included. */ #include <limits.h> #include <stdarg.h> #include <stddef.h> #include <stdint.h> #if defined(__cplusplus) extern "C" { #endif /* Suppress warnings from use of type long long. */ #if defined __GNUC__ #pragma GCC system_header #endif #if defined __GNUC__ #define LSX_GCC(maj, min) \ ((__GNUC__ > (maj)) || (__GNUC__ == (maj) && __GNUC_MINOR__ >= (min))) #else #define LSX_GCC(maj, min) 0 #endif #if LSX_GCC(4,9) #define _Ret_ __attribute__ ((returns_nonnull)) #define _Ret_valid_ _Ret_ #define _Ret_z_ _Ret_ #endif /***************************************************************************** API decoration macros: Mostly for documentation purposes. For some compilers, decorations also affect code generation, influence compiler warnings or activate compiler optimizations. *****************************************************************************/ /** Plugins API: Attribute required on all functions exported by libSoX and on all function pointer types used by the libSoX API. */ #if defined __GNUC__ && defined __i386__ #define LSX_API __attribute__ ((cdecl)) /* libSoX function */ #elif _MSC_VER #define LSX_API __cdecl /* libSoX function */ #else #define LSX_API /* libSoX function */ #endif /** Plugins API: Attribute applied to a parameter or local variable to suppress warnings about the variable being unused (especially in macro-generated code). */ #ifdef __GNUC__ #define LSX_UNUSED __attribute__ ((unused)) /* Parameter or local variable is intentionally unused. */ #else #define LSX_UNUSED /* Parameter or local variable is intentionally unused. */ #endif /** 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. */ #ifdef __GNUC__ #define LSX_PRINTF12 __attribute__ ((format (printf, 1, 2))) /* Function has printf-style arguments. */ #else #define LSX_PRINTF12 /* Function has printf-style arguments. */ #endif /** 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. */ #ifdef __GNUC__ #define LSX_RETURN_PURE __attribute__ ((pure)) /* Function is pure. */ #else #define LSX_RETURN_PURE /* Function is pure. */ #endif /** Plugins API: Attribute applied to a function to indicate that the return value is always a pointer to a valid object (never NULL). */ #ifdef _Ret_ #define LSX_RETURN_VALID _Ret_ /* Function always returns a valid object (never NULL). */ #else #define LSX_RETURN_VALID /* Function always returns a valid object (never NULL). */ #endif /** Plugins API: Attribute applied to a function to indicate that the return value is always a pointer to a valid array (never NULL). */ #ifdef _Ret_valid_ #define LSX_RETURN_ARRAY _Ret_valid_ /* Function always returns a valid array (never NULL). */ #else #define LSX_RETURN_ARRAY /* Function always returns a valid array (never NULL). */ #endif /** 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). */ #ifdef _Ret_z_ #define LSX_RETURN_VALID_Z _Ret_z_ /* Function always returns a 0-terminated array (never NULL). */ #else #define LSX_RETURN_VALID_Z /* Function always returns a 0-terminated array (never NULL). */ #endif /** Plugins API: Attribute applied to a function to indicate that the returned pointer may be null. */ #ifdef _Ret_opt_ #define LSX_RETURN_OPT _Ret_opt_ /* Function may return NULL. */ #else #define LSX_RETURN_OPT /* Function may return NULL. */ #endif /** 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). */ #ifdef _In_ #define LSX_PARAM_IN _In_ /* Required const pointer to a valid object (never NULL). */ #else #define LSX_PARAM_IN /* Required const pointer to a valid object (never NULL). */ #endif /** Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to a const 0-terminated string (never NULL). */ #ifdef _In_z_ #define LSX_PARAM_IN_Z _In_z_ /* Required const pointer to 0-terminated string (never NULL). */ #else #define LSX_PARAM_IN_Z /* Required const pointer to 0-terminated string (never NULL). */ #endif /** Plugins API: Attribute applied to a parameter to indicate that the parameter is a const pointer to a 0-terminated printf format string. */ #ifdef _Printf_format_string_ #define LSX_PARAM_IN_PRINTF _Printf_format_string_ /* Required const pointer to 0-terminated printf format string (never NULL). */ #else #define LSX_PARAM_IN_PRINTF /* Required const pointer to 0-terminated printf format string (never NULL). */ #endif /** 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. @param len The parameter that contains the number of elements in the array. */ #ifdef _In_count_ #define LSX_PARAM_IN_COUNT(len) _In_count_(len) /* Required const pointer to (len) valid objects (never NULL). */ #else #define LSX_PARAM_IN_COUNT(len) /* Required const pointer to (len) valid objects (never NULL). */ #endif /** 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. @param len The parameter that contains the number of bytes in the array. */ #ifdef _In_bytecount_ #define LSX_PARAM_IN_BYTECOUNT(len) _In_bytecount_(len) /* Required const pointer to (len) bytes of data (never NULL). */ #else #define LSX_PARAM_IN_BYTECOUNT(len) /* Required const pointer to (len) bytes of data (never NULL). */ #endif /** 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. */ #ifdef _In_opt_ #define LSX_PARAM_IN_OPT _In_opt_ /* Optional const pointer to a valid object (may be NULL). */ #else #define LSX_PARAM_IN_OPT /* Optional const pointer to a valid object (may be NULL). */ #endif /** 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. */ #ifdef _In_opt_z_ #define LSX_PARAM_IN_OPT_Z _In_opt_z_ /* Optional const pointer to 0-terminated string (may be NULL). */ #else #define LSX_PARAM_IN_OPT_Z /* Optional const pointer to 0-terminated string (may be NULL). */ #endif /** 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. */ #ifdef _Inout_ #define LSX_PARAM_INOUT _Inout_ /* Required pointer to a valid object (never NULL). */ #else #define LSX_PARAM_INOUT /* Required pointer to a valid object (never NULL). */ #endif /** 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. @param len The parameter that contains the number of elements in the array. */ #ifdef _Inout_count_x_ #define LSX_PARAM_INOUT_COUNT(len) _Inout_count_x_(len) /* Required pointer to (len) valid objects (never NULL). */ #else #define LSX_PARAM_INOUT_COUNT(len) /* Required pointer to (len) valid objects (never NULL). */ #endif /** 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. */ #ifdef _Out_ #define LSX_PARAM_OUT _Out_ /* Required pointer to an object to be initialized (never NULL). */ #else #define LSX_PARAM_OUT /* Required pointer to an object to be initialized (never NULL). */ #endif /** 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. @param len The parameter that contains the number of bytes in the array. */ #ifdef _Out_bytecap_ #define LSX_PARAM_OUT_BYTECAP(len) _Out_bytecap_(len) /* Required pointer to writable buffer with room for len bytes. */ #else #define LSX_PARAM_OUT_BYTECAP(len) /* Required pointer to writable buffer with room for len bytes. */ #endif /** 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). @param len The parameter that contains the number of elements in the array. @param filled The dereference of the parameter that receives the number of elements written to the array, or "return" if the value is returned. */ #ifdef _Out_cap_post_count_ #define LSX_PARAM_OUT_CAP_POST_COUNT(len,filled) _Out_cap_post_count_(len,filled) /* Required pointer to buffer for (len) elements (never NULL); on return, (filled) elements will have been initialized. */ #else #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. */ #endif /** 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). @param len The parameter that contains the number of elements in the array. @param filled The dereference of the parameter that receives the number of elements written to the array (not counting the terminating null), or "return" if the value is returned. */ #ifdef _Out_z_cap_post_count_ #define LSX_PARAM_OUT_Z_CAP_POST_COUNT(len,filled) _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. */ #else #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. */ #endif /** 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. */ #ifdef _Out_opt_ #define LSX_PARAM_OUT_OPT _Out_opt_ /* Optional pointer to an object to be initialized (may be NULL). */ #else #define LSX_PARAM_OUT_OPT /* Optional pointer to an object to be initialized (may be NULL). */ #endif /** 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. */ #ifdef _Deref_pre_maybenull_ #define LSX_PARAM_DEREF_PRE_MAYBENULL _Deref_pre_maybenull_ /* Required pointer (never NULL) to another pointer (may be NULL). */ #else #define LSX_PARAM_DEREF_PRE_MAYBENULL /* Required pointer (never NULL) to another pointer (may be NULL). */ #endif /** 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. */ #ifdef _Deref_post_null_ #define LSX_PARAM_DEREF_POST_NULL _Deref_post_null_ /* Required pointer (never NULL) to another pointer, which will be NULL on exit. */ #else #define LSX_PARAM_DEREF_POST_NULL /* Required pointer (never NULL) to another pointer, which will be NULL on exit. */ #endif /** 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. */ #ifdef _Deref_post_notnull_ #define LSX_PARAM_DEREF_POST_NOTNULL _Deref_post_notnull_ /* Required pointer (never NULL) to another pointer, which will be valid (not NULL) on exit. */ #else #define LSX_PARAM_DEREF_POST_NOTNULL /* Required pointer (never NULL) to another pointer, which will be valid (not NULL) on exit. */ #endif /** Plugins API: Expression that "uses" a potentially-unused variable to avoid compiler warnings (especially in macro-generated code). */ #ifdef _PREFAST_ #define LSX_USE_VAR(x) ((void)(x=0)) /* During static analysis, initialize unused variables to 0. */ #else #define LSX_USE_VAR(x) ((void)(x)) /* Parameter or variable is intentionally unused. */ #endif /** Plugins API: Compile-time assertion. Causes a compile error if the expression is false. @param e The expression to test. If expression is false, compilation will fail. @param f A unique identifier for the test, for example foo_must_not_be_zero. */ #define lsx_static_assert(e,f) enum {lsx_static_assert_##f = 1/((e) ? 1 : 0)} /***************************************************************************** Basic typedefs: *****************************************************************************/ /** Client API: Signed twos-complement 8-bit type. Typically defined as signed char. */ typedef int8_t sox_int8_t; /** Client API: Unsigned 8-bit type. Typically defined as unsigned char. */ typedef uint8_t sox_uint8_t; /** Client API: Signed twos-complement 16-bit type. Typically defined as short. */ typedef int16_t sox_int16_t; /** Client API: Unsigned 16-bit type. Typically defined as unsigned short. */ typedef uint16_t sox_uint16_t; /** Client API: Signed twos-complement 32-bit type. Typically defined as int. */ typedef int32_t sox_int32_t; /** Client API: Unsigned 32-bit type. Typically defined as unsigned int. */ typedef uint32_t sox_uint32_t; /** Client API: Signed twos-complement 64-bit type. Typically defined as long or long long. */ typedef int64_t sox_int64_t; /** Client API: Unsigned 64-bit type. Typically defined as unsigned long or unsigned long long. */ typedef uint64_t sox_uint64_t; /** Client API: Alias for sox_int32_t (beware of the extra byte). */ typedef sox_int32_t sox_int24_t; /** Client API: Alias for sox_uint32_t (beware of the extra byte). */ typedef sox_uint32_t sox_uint24_t; /** Client API: Native SoX audio sample type (alias for sox_int32_t). */ typedef sox_int32_t sox_sample_t; /** Client API: Samples per second is stored as a double. */ typedef double sox_rate_t; /** Client API: File's metadata, access via sox_*_comments functions. */ typedef char * * sox_comments_t; /***************************************************************************** Enumerations: *****************************************************************************/ /** Client API: Boolean type, assignment (but not necessarily binary) compatible with C++ bool. */ typedef enum sox_bool { sox_bool_dummy = -1, /* Ensure a signed type */ sox_false, /**< False = 0. */ sox_true /**< True = 1. */ } sox_bool; /** Client API: no, yes, or default (default usually implies some kind of auto-detect logic). */ typedef enum sox_option_t { sox_option_no, /**< Option specified as no = 0. */ sox_option_yes, /**< Option specified as yes = 1. */ sox_option_default /**< Option unspecified = 2. */ } sox_option_t; /** Client API: The libSoX-specific error codes. libSoX functions may return these codes or others that map from errno codes. */ enum sox_error_t { SOX_SUCCESS = 0, /**< Function succeeded = 0 */ SOX_EOF = -1, /**< End Of File or other error = -1 */ SOX_EHDR = 2000, /**< Invalid Audio Header = 2000 */ SOX_EFMT, /**< Unsupported data format = 2001 */ SOX_ENOMEM, /**< Can't alloc memory = 2002 */ SOX_EPERM, /**< Operation not permitted = 2003 */