SoX - Sound eXchange
Audio file processing tool.
Loading...
Searching...
No Matches
sox_ng.h
Go to the documentation of this file.
1/* libSoX Library Public Interface
2 *
3 * Copyright 1999-2012 Chris Bagwell and SoX Contributors.
4 *
5 * This source code is freely redistributable and may be used for
6 * any purpose. This copyright notice must be maintained.
7 * Chris Bagwell And SoX Contributors are not responsible for
8 * the consequences of using this software.
9 */
10
19#ifndef SOX_H
20#define SOX_H
22#include <stdarg.h> /* For va_list */
23#include <stddef.h> /* To define size_t */
24#include <stdint.h> /* To automatically determine appropriate
25 * 8, 16, 32 and 64 bit types */
26#include <limits.h> /* For UINT_MAX etc. to help with the above */
27
28#if defined(__cplusplus)
29extern "C" {
30#endif
31
32/* Suppress warnings from use of type long long. */
33#if defined __GNUC__
34#pragma GCC system_header
35#endif
36
37/*****************************************************************************
38API decoration macros:
39Mostly for documentation purposes. For some compilers, decorations also affect
40code generation, influence compiler warnings or activate compiler
41optimizations.
42*****************************************************************************/
43
49#ifdef __GNUC__
50#define LSX_API __attribute__ ((cdecl)) /* libSoX function */
51#elif _MSC_VER
52#define LSX_API __cdecl /* libSoX function */
53#else
54#define LSX_API /* libSoX function */
55#endif
56
62#ifdef __GNUC__
63#define LSX_UNUSED __attribute__ ((unused)) /* Parameter or local variable is intentionally unused. */
64#else
65#define LSX_UNUSED /* Parameter or local variable is intentionally unused. */
66#endif
67
74#ifdef __GNUC__
75#define LSX_PRINTF12 __attribute__ ((format (printf, 1, 2))) /* Function has printf-style arguments. */
76#else
77#define LSX_PRINTF12 /* Function has printf-style arguments. */
78#endif
79
86/* gcc 2.95.3 on Haiku blurts many warnings about ignoring pure */
87#if defined(__GNUC__) && __GNUC__ > 2
88#define LSX_RETURN_PURE __attribute__ ((pure)) /* Function is pure. */
89#else
90#define LSX_RETURN_PURE /* Function is pure. */
91#endif
92
98#ifdef _Ret_
99#define LSX_RETURN_VALID _Ret_ /* Function always returns a valid object (never NULL). */
100#else
101#define LSX_RETURN_VALID /* Function always returns a valid object (never NULL). */
102#endif
103
109#ifdef _Ret_valid_
110#define LSX_RETURN_ARRAY _Ret_valid_ /* Function always returns a valid array (never NULL). */
111#else
112#define LSX_RETURN_ARRAY /* Function always returns a valid array (never NULL). */
113#endif
114
120#ifdef _Ret_z_
121#define LSX_RETURN_VALID_Z _Ret_z_ /* Function always returns a 0-terminated array (never NULL). */
122#else
123#define LSX_RETURN_VALID_Z /* Function always returns a 0-terminated array (never NULL). */
124#endif
125
131#ifdef _Ret_opt_
132#define LSX_RETURN_OPT _Ret_opt_ /* Function may return NULL. */
133#else
134#define LSX_RETURN_OPT /* Function may return NULL. */
135#endif
136
142#ifdef _In_
143#define LSX_PARAM_IN _In_ /* Required const pointer to a valid object (never NULL). */
144#else
145#define LSX_PARAM_IN /* Required const pointer to a valid object (never NULL). */
146#endif
147
153#ifdef _In_z_
154#define LSX_PARAM_IN_Z _In_z_ /* Required const pointer to 0-terminated string (never NULL). */
155#else
156#define LSX_PARAM_IN_Z /* Required const pointer to 0-terminated string (never NULL). */
157#endif
158
164#ifdef _Printf_format_string_
165#define LSX_PARAM_IN_PRINTF _Printf_format_string_ /* Required const pointer to 0-terminated printf format string (never NULL). */
166#else
167#define LSX_PARAM_IN_PRINTF /* Required const pointer to 0-terminated printf format string (never NULL). */
168#endif
169
177#ifdef _In_count_
178#define LSX_PARAM_IN_COUNT(len) _In_count_(len) /* Required const pointer to (len) valid objects (never NULL). */
179#else
180#define LSX_PARAM_IN_COUNT(len) /* Required const pointer to (len) valid objects (never NULL). */
181#endif
182
190#ifdef _In_bytecount_
191#define LSX_PARAM_IN_BYTECOUNT(len) _In_bytecount_(len) /* Required const pointer to (len) bytes of data (never NULL). */
192#else
193#define LSX_PARAM_IN_BYTECOUNT(len) /* Required const pointer to (len) bytes of data (never NULL). */
194#endif
195
201#ifdef _In_opt_
202#define LSX_PARAM_IN_OPT _In_opt_ /* Optional const pointer to a valid object (may be NULL). */
203#else
204#define LSX_PARAM_IN_OPT /* Optional const pointer to a valid object (may be NULL). */
205#endif
206
212#ifdef _In_opt_z_
213#define LSX_PARAM_IN_OPT_Z _In_opt_z_ /* Optional const pointer to 0-terminated string (may be NULL). */
214#else
215#define LSX_PARAM_IN_OPT_Z /* Optional const pointer to 0-terminated string (may be NULL). */
216#endif
217
224#ifdef _Inout_
225#define LSX_PARAM_INOUT _Inout_ /* Required pointer to a valid object (never NULL). */
226#else
227#define LSX_PARAM_INOUT /* Required pointer to a valid object (never NULL). */
228#endif
229
237#ifdef _Inout_count_x_
238#define LSX_PARAM_INOUT_COUNT(len) _Inout_count_x_(len) /* Required pointer to (len) valid objects (never NULL). */
239#else
240#define LSX_PARAM_INOUT_COUNT(len) /* Required pointer to (len) valid objects (never NULL). */
241#endif
242
249#ifdef _Out_
250#define LSX_PARAM_OUT _Out_ /* Required pointer to an object to be initialized (never NULL). */
251#else
252#define LSX_PARAM_OUT /* Required pointer to an object to be initialized (never NULL). */
253#endif
254
263#ifdef _Out_bytecap_
264#define LSX_PARAM_OUT_BYTECAP(len) _Out_bytecap_(len) /* Required pointer to writable buffer with room for len bytes. */
265#else
266#define LSX_PARAM_OUT_BYTECAP(len) /* Required pointer to writable buffer with room for len bytes. */
267#endif
268
281#ifdef _Out_cap_post_count_
282#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. */
283#else
284#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. */
285#endif
286
299#ifdef _Out_z_cap_post_count_
300#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. */
301#else
302#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. */
303#endif
304
311#ifdef _Out_opt_
312#define LSX_PARAM_OUT_OPT _Out_opt_ /* Optional pointer to an object to be initialized (may be NULL). */
313#else
314#define LSX_PARAM_OUT_OPT /* Optional pointer to an object to be initialized (may be NULL). */
315#endif
316
323#ifdef _Deref_pre_maybenull_
324#define LSX_PARAM_DEREF_PRE_MAYBENULL _Deref_pre_maybenull_ /* Required pointer (never NULL) to another pointer (may be NULL). */
325#else
326#define LSX_PARAM_DEREF_PRE_MAYBENULL /* Required pointer (never NULL) to another pointer (may be NULL). */
327#endif
328
335#ifdef _Deref_post_null_
336#define LSX_PARAM_DEREF_POST_NULL _Deref_post_null_ /* Required pointer (never NULL) to another pointer, which will be NULL on exit. */
337#else
338#define LSX_PARAM_DEREF_POST_NULL /* Required pointer (never NULL) to another pointer, which will be NULL on exit. */
339#endif
340
347#ifdef _Deref_post_notnull_
348#define LSX_PARAM_DEREF_POST_NOTNULL _Deref_post_notnull_ /* Required pointer (never NULL) to another pointer, which will be valid (not NULL) on exit. */
349#else
350#define LSX_PARAM_DEREF_POST_NOTNULL /* Required pointer (never NULL) to another pointer, which will be valid (not NULL) on exit. */
351#endif
352
358#ifdef _PREFAST_
359#define LSX_USE_VAR(x) ((void)(x=0)) /* During static analysis, initialize unused variables to 0. */
360#else
361#define LSX_USE_VAR(x) ((void)(x)) /* Parameter or variable is intentionally unused. */
362#endif
363
370#define lsx_static_assert(e,f) enum {lsx_static_assert_##f = 1/((e) ? 1 : 0)}
371
372/*****************************************************************************
373Basic typedefs:
374*****************************************************************************/
375
380typedef int8_t sox_int8_t;
381
386typedef uint8_t sox_uint8_t;
387
392typedef int16_t sox_int16_t;
393
398typedef uint16_t sox_uint16_t;
399
404typedef int32_t sox_int32_t;
405
410typedef uint32_t sox_uint32_t;
411
416typedef int64_t sox_int64_t;
417
422typedef uint64_t sox_uint64_t;
423
429
435
440/* If this ever changes to a floating point type,
441 * move case SOX_SAMPLE in lsx_generate_wave_table()
442 */
444
449typedef double sox_rate_t;
450
455typedef char * * sox_comments_t;
456
457/*****************************************************************************
458Enumerations:
459*****************************************************************************/
460
465typedef enum sox_bool {
466 sox_bool_dummy = -1, /* Ensure a signed type */
468 sox_true
470
480
486/* The order of the entries from SOX_EHDR onward must correspond to
487 * the entries in sox_strerror()'s errors[] array. */
500
512
517/* Must match the entries in formats.c:s_sox_encodings_info[] */
555
565
576
589
600
601/*****************************************************************************
602Macros:
603*****************************************************************************/
604
613#define SOX_LIB_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
614
621#define SOX_LIB_VERSION_CODE SOX_LIB_VERSION(14, 8, 0)
622
632#define SOX_INT_MIN(bits) (1 <<((bits)-1))
633
643#define SOX_INT_MAX(bits) (((unsigned)-1)>>(33-(bits)))
644
654#define SOX_UINT_MAX(bits) (SOX_INT_MIN(bits)|SOX_INT_MAX(bits))
655
660#define SOX_INT8_MAX SOX_INT_MAX(8)
661
666#define SOX_INT16_MAX SOX_INT_MAX(16)
667
672#define SOX_INT24_MAX SOX_INT_MAX(24)
673
678#define SOX_INT32_MAX SOX_INT_MAX(32)
679
684#define SOX_SAMPLE_PRECISION 32
685
690#define SOX_SAMPLE_MAX (sox_sample_t)SOX_INT_MAX(32)
691
696#define SOX_SAMPLE_MIN (sox_sample_t)SOX_INT_MIN(32)
697
698
699/* Conversions: Linear PCM <--> sox_sample_t
700 *
701 * I/O Input sox_sample_t Clips? Input sox_sample_t Clips?
702 * Format Minimum Minimum I O Maximum Maximum I O
703 * ------ --------- ------------ -- -- -------- ------------ -- --
704 * Float -inf -1 y n inf 1 - 5e-10 y n
705 * Int8 -128 -128 n n 127 127.9999999 n y
706 * Int16 -32768 -32768 n n 32767 32767.99998 n y
707 * Int24 -8388608 -8388608 n n 8388607 8388607.996 n y
708 * Int32 -2147483648 -2147483648 n n 2147483647 2147483647 n n
709 *
710 * Conversions are as accurate as possible (with rounding).
711 *
712 * Rounding: halves toward +inf, all others to nearest integer.
713 *
714 * Clips? shows whether on not there is the possibility of a conversion
715 * clipping to the minimum or maximum value when inputing from or outputing
716 * to a given type.
717 *
718 * Unsigned integers are converted to and from signed integers by flipping
719 * the upper-most bit then treating them as signed integers.
720 */
721
727#define SOX_SAMPLE_LOCALS sox_sample_t sox_macro_temp_sample LSX_UNUSED; \
728 double sox_macro_temp_double LSX_UNUSED
729
734#define SOX_SAMPLE_NEG SOX_INT_MIN(32)
735
744#define SOX_SAMPLE_TO_UNSIGNED(bits,d,clips) \
745 (sox_uint##bits##_t)(SOX_SAMPLE_TO_SIGNED(bits,d,clips)^SOX_INT_MIN(bits))
746
755#define SOX_SAMPLE_TO_SIGNED(bits,d,clips) \
756 (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))
757
765#define SOX_SIGNED_TO_SAMPLE(bits,d)((sox_sample_t)(d)<<(32-bits))
766
774#define SOX_UNSIGNED_TO_SAMPLE(bits,d)(SOX_SIGNED_TO_SAMPLE(bits,d)^SOX_SAMPLE_NEG)
775
783#define SOX_UNSIGNED_8BIT_TO_SAMPLE(d,clips) SOX_UNSIGNED_TO_SAMPLE(8,d)
784
792#define SOX_SIGNED_8BIT_TO_SAMPLE(d,clips) SOX_SIGNED_TO_SAMPLE(8,d)
793
801#define SOX_UNSIGNED_16BIT_TO_SAMPLE(d,clips) SOX_UNSIGNED_TO_SAMPLE(16,d)
802
810#define SOX_SIGNED_16BIT_TO_SAMPLE(d,clips) SOX_SIGNED_TO_SAMPLE(16,d)
811
819#define SOX_UNSIGNED_24BIT_TO_SAMPLE(d,clips) SOX_UNSIGNED_TO_SAMPLE(24,d)
820
828#define SOX_SIGNED_24BIT_TO_SAMPLE(d,clips) SOX_SIGNED_TO_SAMPLE(24,d)
829
837#define SOX_UNSIGNED_32BIT_TO_SAMPLE(d,clips) ((sox_sample_t)(d)^SOX_SAMPLE_NEG)
838
846#define SOX_SIGNED_32BIT_TO_SAMPLE(d,clips) (sox_sample_t)(d)
847#define SOX_SIGNED_32BIT_TO_SAMPLE_NOCLIPS(d) (sox_sample_t)(d)
848
856#define SOX_FLOAT_32BIT_TO_SAMPLE(d,clips) (sox_sample_t)(LSX_USE_VAR(sox_macro_temp_sample),sox_macro_temp_double=(d)*(SOX_SAMPLE_MAX+1.),sox_macro_temp_double<SOX_SAMPLE_MIN?++(clips),SOX_SAMPLE_MIN:sox_macro_temp_double>=SOX_SAMPLE_MAX+1.?sox_macro_temp_double>SOX_SAMPLE_MAX+1.?++(clips),SOX_SAMPLE_MAX:SOX_SAMPLE_MAX:sox_macro_temp_double)
857
865#define SOX_FLOAT_64BIT_TO_SAMPLE(d,clips) (sox_sample_t)(LSX_USE_VAR(sox_macro_temp_sample),sox_macro_temp_double=(d)*(SOX_SAMPLE_MAX+1.),sox_macro_temp_double<0?sox_macro_temp_double<=SOX_SAMPLE_MIN-.5?++(clips),SOX_SAMPLE_MIN:sox_macro_temp_double-.5:sox_macro_temp_double>=SOX_SAMPLE_MAX+.5?sox_macro_temp_double>SOX_SAMPLE_MAX+1.?++(clips),SOX_SAMPLE_MAX:SOX_SAMPLE_MAX:sox_macro_temp_double+.5)
866
867#define SOX_FLOAT_64BIT_TO_SAMPLE_NOCLIPS(d) (sox_sample_t)(LSX_USE_VAR(sox_macro_temp_sample),sox_macro_temp_double=(d)*(SOX_SAMPLE_MAX+1.),sox_macro_temp_double<0?sox_macro_temp_double<=SOX_SAMPLE_MIN-.5?SOX_SAMPLE_MIN:sox_macro_temp_double-.5:sox_macro_temp_double>=SOX_SAMPLE_MAX+.5?sox_macro_temp_double>SOX_SAMPLE_MAX+1.?SOX_SAMPLE_MAX:SOX_SAMPLE_MAX:sox_macro_temp_double+.5)
868
875#define SOX_SAMPLE_TO_UNSIGNED_8BIT(d,clips) SOX_SAMPLE_TO_UNSIGNED(8,d,clips)
876
883#define SOX_SAMPLE_TO_SIGNED_8BIT(d,clips) SOX_SAMPLE_TO_SIGNED(8,d,clips)
884
891#define SOX_SAMPLE_TO_UNSIGNED_16BIT(d,clips) SOX_SAMPLE_TO_UNSIGNED(16,d,clips)
892
899#define SOX_SAMPLE_TO_SIGNED_16BIT(d,clips) SOX_SAMPLE_TO_SIGNED(16,d,clips)
900
907#define SOX_SAMPLE_TO_UNSIGNED_24BIT(d,clips) SOX_SAMPLE_TO_UNSIGNED(24,d,clips)
908
915#define SOX_SAMPLE_TO_SIGNED_24BIT(d,clips) SOX_SAMPLE_TO_SIGNED(24,d,clips)
916
923#define SOX_SAMPLE_TO_UNSIGNED_32BIT(d,clips) (sox_uint32_t)((d)^SOX_SAMPLE_NEG)
924#define SOX_SAMPLE_TO_UNSIGNED_32BIT_NOCLIPS(d) (sox_uint32_t)((d)^SOX_SAMPLE_NEG)
925
932#define SOX_SAMPLE_TO_SIGNED_32BIT(d,clips) (sox_int32_t)(d)
933#define SOX_SAMPLE_TO_SIGNED_32BIT_NOCLIPS(d) (sox_int32_t)(d)
934
941#define SOX_SAMPLE_TO_FLOAT_32BIT(d,clips) (LSX_USE_VAR(sox_macro_temp_double),sox_macro_temp_sample=(d),sox_macro_temp_sample>SOX_SAMPLE_MAX-64?++(clips),1:(((sox_macro_temp_sample+64)&~127)*(1./(SOX_SAMPLE_MAX+1.))))
942
943#define SOX_SAMPLE_TO_FLOAT_32BIT_NOCLIPS(d) (LSX_USE_VAR(sox_macro_temp_double),sox_macro_temp_sample=(d),sox_macro_temp_sample>SOX_SAMPLE_MAX-64?1:(((sox_macro_temp_sample+64)&~127)*(1./(SOX_SAMPLE_MAX+1.))))
944
951#define SOX_SAMPLE_TO_FLOAT_64BIT(d,clips) ((d)*(1./(SOX_SAMPLE_MAX+1.)))
952#define SOX_SAMPLE_TO_FLOAT_64BIT_NOCLIPS(d) ((d)*(1./(SOX_SAMPLE_MAX+1.)))
953
961#define SOX_SAMPLE_CLIP_COUNT(samp, clips) \
962 do { \
963 if (samp > SOX_SAMPLE_MAX) \
964 { samp = SOX_SAMPLE_MAX; clips++; } \
965 else if (samp < SOX_SAMPLE_MIN) \
966 { samp = SOX_SAMPLE_MIN; clips++; } \
967 } while (0)
968
977#define SOX_ROUND_CLIP_COUNT(d, clips) \
978 ((d) < 0? (d) <= SOX_SAMPLE_MIN - 0.5? ++(clips), SOX_SAMPLE_MIN: (d) - 0.5 \
979 : (d) >= SOX_SAMPLE_MAX + 0.5? ++(clips), SOX_SAMPLE_MAX: (d) + 0.5)
980
990#define SOX_INTEGER_CLIP_COUNT(bits,i,clips) ( \
991 (i) >(int)((unsigned)1 << ((bits)-1))- 1 ? ++(clips),((unsigned)1 << ((bits)-1))- 1 : \
992 (i) <(int)((unsigned)-1 << ((bits)-1)) ? ++(clips),(unsigned)-1 << ((bits)-1) : (i))
993
1002#define SOX_16BIT_CLIP_COUNT(i,clips) SOX_INTEGER_CLIP_COUNT(16,i,clips)
1003
1012#define SOX_24BIT_CLIP_COUNT(i,clips) SOX_INTEGER_CLIP_COUNT(24,i,clips)
1013
1014#define SOX_SIZE_MAX ((size_t)(-1))
1016#define SOX_UNSPEC 0
1017#define SOX_UNKNOWN_LEN (sox_uint64_t)(-1)
1018#define SOX_IGNORE_LENGTH (sox_uint64_t)(-2)
1020#define SOX_DEFAULT_CHANNELS 2
1021#define SOX_DEFAULT_RATE 48000
1022#define SOX_DEFAULT_PRECISION 16
1023#define SOX_DEFAULT_ENCODING SOX_ENCODING_SIGN2
1025#define SOX_LOOP_NONE ((unsigned char)sox_loop_none)
1026#define SOX_LOOP_8 ((unsigned char)sox_loop_8)
1027#define SOX_LOOP_SUSTAIN_DECAY ((unsigned char)sox_loop_sustain_decay)
1029#define SOX_MAX_NLOOPS 8
1031#define SOX_FILE_NOSTDIO 0x0001
1032#define SOX_FILE_DEVICE 0x0002
1033#define SOX_FILE_PHONY 0x0004
1034#define SOX_FILE_REWIND 0x0008
1035#define SOX_FILE_BIT_REV 0x0010
1036#define SOX_FILE_NIB_REV 0x0020
1037#define SOX_FILE_ENDIAN 0x0040
1038#define SOX_FILE_ENDBIG 0x0080
1039#define SOX_FILE_MONO 0x0100
1040#define SOX_FILE_STEREO 0x0200
1041#define SOX_FILE_QUAD 0x0400
1043#define SOX_FILE_CHANS (SOX_FILE_MONO | SOX_FILE_STEREO | SOX_FILE_QUAD)
1044#define SOX_FILE_LIT_END (SOX_FILE_ENDIAN | 0)
1045#define SOX_FILE_BIG_END (SOX_FILE_ENDIAN | SOX_FILE_ENDBIG)
1047#define SOX_EFF_CHAN 1
1048#define SOX_EFF_RATE 2
1049#define SOX_EFF_PREC 4
1050#define SOX_EFF_LENGTH 8
1051#define SOX_EFF_MCHAN 16
1052#define SOX_EFF_NULL 32
1053#define SOX_EFF_DEPRECATED 64 /* No longer used */
1054#define SOX_EFF_GAIN 128
1055#define SOX_EFF_MODIFY 256
1056#define SOX_EFF_ALPHA 512 /* No longer used */
1057#define SOX_EFF_INTERNAL 1024
1064#define SOX_SEEK_SET 0
1065
1066/*****************************************************************************
1067Forward declarations:
1068*****************************************************************************/
1069
1070typedef struct sox_format sox_format_t;
1071typedef struct sox_effect sox_effect_t;
1072typedef struct sox_effect_handler sox_effect_handler_t;
1073typedef struct sox_format_handler sox_format_handler_t;
1074
1075/*****************************************************************************
1076Function pointers:
1077*****************************************************************************/
1078
1085 unsigned level,
1086 LSX_PARAM_IN_Z char const * filename,
1087 LSX_PARAM_IN_PRINTF char const * fmt,
1088 LSX_PARAM_IN va_list ap
1089 );
1090
1097typedef sox_format_handler_t const * (LSX_API * sox_format_fn_t)(void);
1098
1105typedef sox_effect_handler_t const * (LSX_API *sox_effect_fn_t)(void);
1106
1114 LSX_PARAM_INOUT sox_format_t * ft
1115 );
1116
1124 LSX_PARAM_INOUT sox_format_t * ft,
1126 size_t len
1127 );
1128
1136 LSX_PARAM_INOUT sox_format_t * ft
1137 );
1138
1146 LSX_PARAM_INOUT sox_format_t * ft
1147 );
1148
1156 LSX_PARAM_INOUT sox_format_t * ft,
1157 LSX_PARAM_IN_COUNT(len) sox_sample_t const * buf,
1158 size_t len
1159 );
1160
1168 LSX_PARAM_INOUT sox_format_t * ft
1169 );
1170
1178 LSX_PARAM_INOUT sox_format_t * ft,
1179 sox_uint64_t offset
1180 );
1181
1189 LSX_PARAM_INOUT sox_effect_t * effp,
1190 int argc,
1191 LSX_PARAM_IN_COUNT(argc) char *argv[]
1192 );
1193
1201 LSX_PARAM_INOUT sox_effect_t * effp
1202 );
1203
1211 LSX_PARAM_INOUT sox_effect_t * effp,
1212 LSX_PARAM_IN_COUNT(*isamp) sox_sample_t const * ibuf,
1213 LSX_PARAM_OUT_CAP_POST_COUNT(*osamp,*osamp) sox_sample_t * obuf,
1214 LSX_PARAM_INOUT size_t *isamp,
1215 LSX_PARAM_INOUT size_t *osamp
1216 );
1217
1225 LSX_PARAM_INOUT sox_effect_t * effp,
1226 LSX_PARAM_OUT_CAP_POST_COUNT(*osamp,*osamp) sox_sample_t *obuf,
1227 LSX_PARAM_INOUT size_t *osamp
1228 );
1229
1237 LSX_PARAM_INOUT sox_effect_t * effp
1238 );
1239
1247 LSX_PARAM_INOUT sox_effect_t * effp
1248 );
1249
1257 sox_bool all_done,
1258 void * client_data
1259 );
1260
1268 void * callback_data,
1269 LSX_PARAM_IN_Z char const * filename
1270 );
1271
1272/*****************************************************************************
1273Structures:
1274*****************************************************************************/
1275
1281typedef struct sox_version_info {
1282 size_t size;
1285 char const * version;
1286 char const * version_extra;
1287 char const * distro;
1288 char const * compiler;
1289 char const * arch;
1290 /* new info should be added at the end for version backwards-compatibility. */
1292
1293
1298typedef struct {
1299 char *key; /* String name of the bound key, like "D" */
1300 char *effect; /* Effect whose parameter this changes */
1301 char *field; /* Parameter changed in the effect's priv_t */
1302 char op; /* How to adjust the parameter: '+', '-', '*', '/' or '=' */
1303 double step; /* How much to add or subtract, to multiply or divide by */
1304} sox_keymap_t;
1305
1306
1312/* The public fields must correspond to the order in sox_globals */
1313typedef struct {
1314/* public: */
1315 char * myname;
1316 unsigned verbosity;
1324 size_t bufsiz;
1325
1331
1334 char const * stdin_in_use_by;
1335 char const * stdout_in_use_by;
1336 char const * subsystem;
1337 char * tmp_path;
1346
1348 float A4;
1349
1350 /* Stuff for --keymap */
1351 sox_keymap_t *keymaps;
1352 unsigned keymap_count;
1354
1359typedef struct sox_signalinfo {
1361 unsigned channels;
1362 unsigned precision;
1364 double * mult;
1366
1376
1412
1417typedef struct sox_loopinfo {
1420 unsigned count;
1421 unsigned char type;
1423
1428typedef struct sox_instrinfo {
1429 signed char MIDInote;
1430 signed char MIDIlow;
1431 signed char MIDIhi;
1432 unsigned char loopmode;
1433 unsigned nloops;
1435
1440typedef struct sox_fileinfo {
1441 char *buf;
1442 size_t size;
1443 size_t count;
1444 size_t pos;
1446
1492
1497typedef struct sox_oob {
1498 /* Decoded: */
1503 /* TBD: Non-decoded chunks, etc: */
1504} sox_oob_t;
1505
1554
1561typedef struct sox_format_tab {
1562 char const *name;
1565
1574
1575/*
1576 * The type of functions to read or write the value of an effect's parameters
1577 * while it's running.
1578 *
1579 * The second argument is the name of the parameter and
1580 * _set's third argument is the new value as text ("%g" is suggested).
1581 *
1582 * get functions return:
1583 * - the current value as text in mallocked memory that the caller must free or
1584 * - NULL if there is no such readable parameter or the value is garbage
1585 *
1586 * set functions return:
1587 * - a mallocked string version of the actual value that was set
1588 * - NULL if there is no such writable parameter or the value is garbage
1589 *
1590 * The return values are sprintfed as "%g" so, if the caller does the same
1591 * it can strcmp() the strings to see it it was set to the same or different.
1592 */
1599typedef char *(*sox_effect_handler_get)(sox_effect_t *effp, char *);
1607typedef char *(*sox_effect_handler_set)(sox_effect_t *effp, char *, char *);
1608
1614 char const * name;
1615 char const * usage;
1616 unsigned int flags;
1623 size_t priv_size;
1624 /* Add new fields here at the end so that existing effects get NULL
1625 * when they say "static sox_effect_handler_t foo = {..., sizeof(priv_t)};"
1626 * Additions should be accompanied by increasing SHLIB_VERSION by one in
1627 * configure.ac
1628 */
1629 char const * const * extra_usage;
1632};
1633
1644 sox_effect_handler_t handler;
1646 size_t flows;
1647 size_t flow;
1648 void * priv;
1649 /* The following items are private to the libSoX effects chain functions. */
1651 size_t obeg;
1652 size_t oend;
1653 size_t imin;
1654};
1655
1660typedef struct sox_effects_chain {
1661 sox_effect_t **effects;
1662 size_t length;
1666 /* The following items are private to the libSoX effects chain functions. */
1667 size_t table_size;
1670
1671/*****************************************************************************
1672Functions:
1673*****************************************************************************/
1674
1681char const *
1682LSX_API
1684
1691sox_version_info_t const *
1692LSX_API
1694
1702LSX_API
1704
1710#define sox_globals (*sox_get_globals())
1711
1716extern void sox_keymap_add(char *key, char *effect, char *field,
1717 char op, double step);
1722extern sox_bool sox_is_keymapped(char *key);
1723
1733extern int sox_keymap_apply(sox_effects_chain_t *effp, char *key);
1738extern void sox_keymap_free(void);
1739
1748LSX_API
1750
1756#define sox_encodings_info (sox_get_encodings_info())
1757
1762void
1763LSX_API
1766 );
1767
1779unsigned
1780LSX_API
1782 sox_encoding_t encoding,
1783 unsigned bits_per_sample
1784 );
1785
1791size_t
1792LSX_API
1795 );
1796
1801void
1802LSX_API
1805 LSX_PARAM_IN_Z char const * item
1806 );
1807
1812void
1813LSX_API
1816 LSX_PARAM_IN_Z char const * items
1817 );
1818
1826LSX_API
1829 );
1830
1835void
1836LSX_API
1839 );
1840
1847char const *
1848LSX_API
1851 LSX_PARAM_IN_Z char const * id
1852 );
1853
1859int
1860LSX_API
1862
1867void
1868LSX_API
1870
1876int
1877LSX_API
1879
1885int
1886LSX_API
1888
1895sox_format_tab_t const *
1896LSX_API
1898
1903#define sox_format_fns (sox_get_format_fns())
1904
1911sox_format_t *
1912LSX_API
1914 LSX_PARAM_IN_Z char const * path,
1915 LSX_PARAM_IN_OPT sox_signalinfo_t const * signal,
1916 LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,
1917 LSX_PARAM_IN_OPT_Z char const * filetype
1918 );
1919
1926sox_format_t *
1927LSX_API
1929 LSX_PARAM_IN_BYTECOUNT(buffer_size) void * buffer,
1930 size_t buffer_size,
1931 LSX_PARAM_IN_OPT sox_signalinfo_t const * signal,
1932 LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,
1933 LSX_PARAM_IN_OPT_Z char const * filetype
1934 );
1935
1942LSX_API
1944 LSX_PARAM_IN_OPT_Z char const * path,
1945 LSX_PARAM_IN_OPT_Z char const * filetype,
1946 LSX_PARAM_IN sox_encodinginfo_t const * encoding
1947 );
1948
1955sox_format_handler_t const *
1956LSX_API
1958 LSX_PARAM_IN_OPT_Z char const * path,
1959 LSX_PARAM_IN_OPT_Z char const * filetype,
1960 LSX_PARAM_OUT_OPT char const * * filetype1
1961 );
1962
1969sox_format_t *
1970LSX_API
1972 LSX_PARAM_IN_Z char const * path,
1973 LSX_PARAM_IN sox_signalinfo_t const * signal,
1974 LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,
1975 LSX_PARAM_IN_OPT_Z char const * filetype,
1976 LSX_PARAM_IN_OPT sox_oob_t const * oob,
1977 LSX_PARAM_IN_OPT sox_bool (LSX_API * overwrite_permitted)(LSX_PARAM_IN_Z char const * filename)
1978 );
1979
1986sox_format_t *
1987LSX_API
1989 LSX_PARAM_OUT_BYTECAP(buffer_size) void * buffer,
1990 LSX_PARAM_IN size_t buffer_size,
1991 LSX_PARAM_IN sox_signalinfo_t const * signal,
1992 LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,
1993 LSX_PARAM_IN_OPT_Z char const * filetype,
1994 LSX_PARAM_IN_OPT sox_oob_t const * oob
1995 );
1996
2003sox_format_t *
2004LSX_API
2006 LSX_PARAM_OUT char * * buffer_ptr,
2007 LSX_PARAM_OUT size_t * buffer_size_ptr,
2008 LSX_PARAM_IN sox_signalinfo_t const * signal,
2009 LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,
2010 LSX_PARAM_IN_OPT_Z char const * filetype,
2011 LSX_PARAM_IN_OPT sox_oob_t const * oob
2012 );
2013
2019size_t
2020LSX_API
2022 LSX_PARAM_INOUT sox_format_t * ft,
2024 size_t len
2025 );
2026
2032size_t
2033LSX_API
2035 LSX_PARAM_INOUT sox_format_t * ft,
2036 LSX_PARAM_IN_COUNT(len) sox_sample_t const * buf,
2037 size_t len
2038 );
2039
2045int
2046LSX_API
2048 LSX_PARAM_INOUT sox_format_t * ft
2049 );
2050
2056int
2057LSX_API
2059 LSX_PARAM_INOUT sox_format_t * ft,
2060 sox_uint64_t offset,
2061 int whence
2062 );
2063
2070sox_format_handler_t const *
2071LSX_API
2073 LSX_PARAM_IN_Z char const * name,
2074 sox_bool ignore_devices
2075 );
2076
2084LSX_API
2086
2091#define sox_effects_globals (*sox_get_effects_globals())
2092
2099sox_effect_handler_t const *
2100LSX_API
2102 LSX_PARAM_IN_Z char const * name
2103 );
2104
2111sox_effect_t *
2112LSX_API
2114 LSX_PARAM_IN sox_effect_handler_t const * eh
2115 );
2116
2122int
2123LSX_API
2125 LSX_PARAM_IN sox_effect_t *effp,
2126 int argc,
2127 LSX_PARAM_IN_COUNT(argc) char * const argv[]
2128 );
2129
2136sox_effect_fn_t const *
2137LSX_API
2139
2144#define sox_effect_fns (sox_get_effect_fns())
2145
2153LSX_API
2155 LSX_PARAM_IN sox_encodinginfo_t const * in_enc,
2156 LSX_PARAM_IN sox_encodinginfo_t const * out_enc
2157 );
2158
2163void
2164LSX_API
2167 );
2168
2174int
2175LSX_API
2178 LSX_PARAM_INOUT sox_effect_t * effp,
2180 LSX_PARAM_IN sox_signalinfo_t const * out
2181 );
2182
2188int
2189LSX_API
2193 LSX_PARAM_IN_OPT void * client_data
2194 );
2195
2202LSX_API
2205 );
2206
2213LSX_API
2215 LSX_PARAM_INOUT_COUNT(effp->flows) sox_effect_t * effp
2216 );
2217
2222void
2223LSX_API
2226 LSX_PARAM_INOUT sox_effect_t * effp
2227 );
2228
2235sox_effect_t *
2236LSX_API
2239 );
2240
2245void
2246LSX_API
2248 LSX_PARAM_INOUT_COUNT(effp->flows) sox_effect_t *effp
2249 );
2250
2255void
2256LSX_API
2259 );
2260
2265void
2266LSX_API
2269 );
2270
2279LSX_API
2281 LSX_PARAM_IN sox_effect_t * effp
2282 );
2283
2288void
2289LSX_API
2291 LSX_PARAM_INOUT sox_effect_t * effp
2292 );
2293
2300LSX_API
2302 LSX_PARAM_IN_Z char const * filename
2303 );
2304
2310int
2311LSX_API
2314 void * p,
2315 LSX_PARAM_IN char const * const listname
2316 );
2317
2325char const *
2326LSX_API
2328 int sox_errno
2329 );
2330
2338size_t
2339LSX_API
2341 LSX_PARAM_OUT_Z_CAP_POST_COUNT(base_buffer_len,return) char * base_buffer,
2342 size_t base_buffer_len,
2343 LSX_PARAM_IN_Z char const * filename
2344 );
2345
2346/*****************************************************************************
2347Internal API:
2348WARNING - The items in this section are subject to instability. They only
2349exist in the public header because sox (the application) currently uses them.
2350These may be changed or removed in future versions of libSoX.
2351*****************************************************************************/
2352
2357void
2358LSX_API
2360 LSX_PARAM_IN_PRINTF char const * fmt,
2361 ...)
2363
2368void
2369LSX_API
2371 LSX_PARAM_IN_PRINTF char const * fmt,
2372 ...)
2374
2379void
2380LSX_API
2382 LSX_PARAM_IN_PRINTF char const * fmt,
2383 ...)
2385
2390void
2391LSX_API
2393 LSX_PARAM_IN_PRINTF char const * fmt,
2394 ...)
2396
2401#define lsx_fail sox_get_globals()->subsystem=__FILE__,lsx_fail_impl
2402
2407#define lsx_warn sox_get_globals()->subsystem=__FILE__,lsx_warn_impl
2408
2413#define lsx_report sox_get_globals()->subsystem=__FILE__,lsx_report_impl
2414
2419#define lsx_debug sox_get_globals()->subsystem=__FILE__,lsx_debug_impl
2420
2426typedef struct lsx_enum_item {
2427 char const *text;
2428 unsigned value;
2430
2438#define LSX_ENUM_ITEM(prefix, item) {#item, prefix##item},
2439
2444enum
2445{
2449
2456lsx_enum_item const *
2457LSX_API
2459 LSX_PARAM_IN_Z char const * text,
2460 LSX_PARAM_IN lsx_enum_item const * lsx_enum_items,
2461 int flags
2462 );
2463
2470lsx_enum_item const *
2471LSX_API
2473 unsigned value,
2474 LSX_PARAM_IN lsx_enum_item const * lsx_enum_items
2475 );
2476
2485int
2486LSX_API
2488 int c,
2489 LSX_PARAM_IN_Z char const * arg,
2490 LSX_PARAM_IN lsx_enum_item const * items
2491 );
2492
2500LSX_API
2502 LSX_PARAM_IN_Z char const * str,
2503 LSX_PARAM_IN_Z char const * end
2504 );
2505
2513char const *
2514LSX_API
2516 LSX_PARAM_IN_Z char const * pathname
2517 );
2518
2527char const *
2528LSX_API
2530 double number
2531 );
2532
2541char const *
2542LSX_API
2544 double percentage
2545 );
2546
2554void *
2555LSX_API
2557 LSX_PARAM_IN_OPT void *ptr,
2558 size_t newsize
2559 );
2560
2567int
2568LSX_API
2570 LSX_PARAM_IN_Z char const * s1,
2571 LSX_PARAM_IN_Z char const * s2
2572 );
2573
2580int
2581LSX_API
2583 LSX_PARAM_IN_Z char const * s1,
2584 LSX_PARAM_IN_Z char const * s2,
2585 size_t n
2586 );
2587
2594double
2595LSX_API
2597 LSX_PARAM_IN_Z char const * nptr,
2598 LSX_PARAM_OUT_OPT char ** endptr
2599 );
2600
2610
2620
2625typedef struct lsx_option {
2626 char const * name;
2628 int * flag;
2629 int val;
2630} lsx_option_t;
2631
2636typedef struct lsx_getopt {
2637 int argc;
2638 char * const * argv;
2639 char const * shortopts;
2642 char const * curpos;
2643 int ind;
2644 int opt;
2645 char const * arg;
2647} lsx_getopt_t;
2648
2653void
2654LSX_API
2656 LSX_PARAM_IN int argc,
2657 LSX_PARAM_IN_COUNT(argc) char * const * argv,
2658 LSX_PARAM_IN_Z char const * shortopts,
2659 LSX_PARAM_IN_OPT lsx_option_t const * longopts,
2661 LSX_PARAM_IN int first,
2663 );
2664
2676int
2677LSX_API
2680 );
2681
2688LSX_API
2690 LSX_PARAM_IN sox_format_t * ft
2691 );
2692
2693/* WARNING END */
2694
2695#if defined(__cplusplus)
2696}
2697#endif
2698
2699#endif /* SOX_H */
@ lsx_find_enum_item_none
Default parameters (case-insensitive).
Definition sox_ng.h:2446
@ lsx_find_enum_item_case_sensitive
Enable case-sensitive search.
Definition sox_ng.h:2447
#define LSX_PARAM_OUT_Z_CAP_POST_COUNT(len, filled)
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to me...
Definition sox_ng.h:302
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.
LSX_RETURN_VALID_Z LSX_RETURN_PURE sox_effect_fn_t const *LSX_API sox_get_effect_fns(void)
Client API: Returns an array containing the known effect handlers.
LSX_RETURN_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.
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.
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 suff...
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.
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.
#define LSX_PARAM_DEREF_PRE_MAYBENULL
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer (neve...
Definition sox_ng.h:326
int LSX_API sox_quit(void)
Client API: Close the effects library and unload format handler plugins.
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.
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.
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.
#define LSX_PARAM_IN_BYTECOUNT(len)
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to (l...
Definition sox_ng.h:193
uint64_t sox_uint64_t
Client API: Unsigned 64-bit type.
Definition sox_ng.h:422
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.
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.
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 terminate...
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...
int sox_keymap_apply(sox_effects_chain_t *effp, char *key)
Client API: Apply a keymap Returns: SOX_SUCCESS on successful application, SOX_ENOEFFECT if the effec...
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.
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_han...
Definition sox_ng.h:1188
sox_int32_t sox_sample_t
Client API: Native SoX audio sample type (alias for sox_int32_t).
Definition sox_ng.h:443
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....
Definition sox_ng.h:1123
#define LSX_PARAM_DEREF_POST_NULL
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer (neve...
Definition sox_ng.h:338
uint16_t sox_uint16_t
Client API: Unsigned 16-bit type.
Definition sox_ng.h:398
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.
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....
Definition sox_ng.h:1236
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.
Definition sox_ng.h:1210
int LSX_API sox_close(LSX_PARAM_INOUT sox_format_t *ft)
Client API: Closes an encoding or decoding session.
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.
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.
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.
lsx_getopt_flags_t
Plugins API: lsx_getopt_init options.
Definition sox_ng.h:2615
@ lsx_getopt_flag_none
no flags (no output, not long-only)
Definition sox_ng.h:2616
@ lsx_getopt_flag_longonly
if set, recognize -option as a long option
Definition sox_ng.h:2618
@ lsx_getopt_flag_opterr
if set, invalid options trigger lsx_warn output
Definition sox_ng.h:2617
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.
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.
#define LSX_PARAM_IN_Z
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to a ...
Definition sox_ng.h:156
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.
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.
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).
uint8_t sox_uint8_t
Client API: Unsigned 8-bit type.
Definition sox_ng.h:386
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....
Definition sox_ng.h:1224
char ** sox_comments_t
Client API: File's metadata, access via sox_*_comments functions.
Definition sox_ng.h:455
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.
sox_option_t
Client API: no, yes, or default (default usually implies some kind of auto-detect logic).
Definition sox_ng.h:475
@ sox_option_default
Option unspecified = 2.
Definition sox_ng.h:478
@ sox_option_yes
Option specified as yes = 1.
Definition sox_ng.h:477
@ sox_option_no
Option specified as no = 0.
Definition sox_ng.h:476
void LSX_API lsx_fail_impl(LSX_PARAM_IN_PRINTF char const *fmt,...) LSX_PRINTF12
Plugins API: Print a fatal error in libSoX.
char *(* sox_effect_handler_get)(sox_effect_t *effp, char *)
Client API: Callback to read the current value of an effect's parameter, returning NULL if the parame...
Definition sox_ng.h:1599
sox_bool
Client API: Boolean type, assignment (but not necessarily binary) compatible with C++ bool.
Definition sox_ng.h:465
@ sox_true
True = 1.
Definition sox_ng.h:468
@ sox_false
False = 0.
Definition sox_ng.h:467
#define sox_effects_globals
Client API: Deprecated macro that returns global parameters for effects.
Definition sox_ng.h:2091
#define LSX_RETURN_ARRAY
Plugins API: Attribute applied to a function to indicate that the return value is always a pointer to...
Definition sox_ng.h:112
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.
#define LSX_PARAM_IN_COUNT(len)
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to (l...
Definition sox_ng.h:180
sox_uint32_t sox_uint24_t
Client API: Alias for sox_uint32_t (beware of the extra byte).
Definition sox_ng.h:434
int64_t sox_int64_t
Client API: Signed twos-complement 64-bit type.
Definition sox_ng.h:416
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.
Definition sox_ng.h:1135
int LSX_API sox_init(void)
Client API: Initialize the effects library.
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.
void LSX_API sox_delete_effect(LSX_PARAM_INOUT_COUNT(effp->flows) sox_effect_t *effp)
Client API: Shut down and delete an effect.
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.
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.
#define LSX_RETURN_VALID_Z
Plugins API: Attribute applied to a function to indicate that the return value is always a pointer to...
Definition sox_ng.h:123
#define LSX_PARAM_IN
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to on...
Definition sox_ng.h:145
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....
Definition sox_ng.h:1200
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....
Definition sox_ng.h:1097
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.
#define LSX_PARAM_DEREF_POST_NOTNULL
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer (neve...
Definition sox_ng.h:350
LSX_RETURN_VALID LSX_RETURN_PURE sox_globals_t *LSX_API sox_get_globals(void)
Client API: Returns a pointer to the structure with libSoX's global settings.
int LSX_API sox_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.
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....
Definition sox_ng.h:1155
int32_t sox_int32_t
Client API: Signed twos-complement 32-bit type.
Definition sox_ng.h:404
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.
sox_bool sox_is_keymapped(char *key)
Client API: See if a key or an effect.field is used in a keymap.
#define LSX_PARAM_OUT_CAP_POST_COUNT(len, filled)
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to me...
Definition sox_ng.h:284
LSX_RETURN_VALID LSX_RETURN_PURE sox_effects_globals_t *LSX_API sox_get_effects_globals(void)
Client API: Returns global parameters for effects.
LSX_RETURN_VALID_Z char const *LSX_API sox_version(void)
Client API: Returns version number string of libSoX, for example, "14.4.0".
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.
uint32_t sox_uint32_t
Client API: Unsigned 32-bit type.
Definition sox_ng.h:410
void LSX_API sox_format_quit(void)
Client API: Unload format handler plugins.
#define LSX_API
Plugins API: Attribute required on all functions exported by libSoX and on all function pointer types...
Definition sox_ng.h:54
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.
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.
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....
#define LSX_PARAM_IN_OPT_Z
Plugins API: Attribute applied to a parameter to indicate that the parameter is either NULL or a vali...
Definition sox_ng.h:215
#define LSX_PARAM_INOUT_COUNT(len)
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to (l...
Definition sox_ng.h:240
lsx_option_arg_t
Plugins API: Is option argument unsupported, required, or optional.
Definition sox_ng.h:2605
@ lsx_option_arg_optional
Option can optionally be followed by an argument.
Definition sox_ng.h:2608
@ lsx_option_arg_required
Option requires an argument.
Definition sox_ng.h:2607
@ lsx_option_arg_none
Option does not have an argument.
Definition sox_ng.h:2606
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_...
Definition sox_ng.h:1105
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.
#define LSX_PARAM_IN_OPT
Plugins API: Attribute applied to a parameter to indicate that the parameter is either NULL or a vali...
Definition sox_ng.h:204
sox_error_t
Client API: The libSoX-specific error codes.
Definition sox_ng.h:488
@ SOX_EPERM
Operation not permitted = 2003.
Definition sox_ng.h:494
@ SOX_ENOMEM
Can't allocate memory = 2002.
Definition sox_ng.h:493
@ SOX_EHDR
Invalid Audio Header = 2000.
Definition sox_ng.h:491
@ SOX_ENOTSUP
Operation not supported = 2004.
Definition sox_ng.h:495
@ SOX_ENOKEYMAP
No such keymap = 2006.
Definition sox_ng.h:497
@ SOX_EINVAL
Invalid argument = 2005.
Definition sox_ng.h:496
@ SOX_SUCCESS
Function succeeded = 0.
Definition sox_ng.h:489
@ SOX_EOF
End Of File or other error = -1.
Definition sox_ng.h:490
@ SOX_EFMT
Unsupported data format = 2001.
Definition sox_ng.h:492
@ SOX_ENOEFFECT
No such effect = 2007.
Definition sox_ng.h:498
sox_loop_flags_t
Client API: Loop modes: upper 4 bits mask the loop blass, lower 4 bits describe the loop behaviour,...
Definition sox_ng.h:582
@ sox_loop_none
single-shot = 0
Definition sox_ng.h:583
@ sox_loop_sustain_decay
AIFF style, one sustain & one decay loop = 64.
Definition sox_ng.h:587
@ sox_loop_8
8 loops (??) = 32
Definition sox_ng.h:586
@ sox_loop_forward
forward loop = 1
Definition sox_ng.h:584
@ sox_loop_forward_back
forward/back loop = 2
Definition sox_ng.h:585
#define SOX_MAX_NLOOPS
Client API: Maximum number of loops supported by sox_oob_t = 8.
Definition sox_ng.h:1029
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.
#define LSX_PRINTF12
Plugins API: LSX_PRINTF12: Attribute applied to a function to indicate that it requires a printf-styl...
Definition sox_ng.h:77
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.
#define LSX_PARAM_OUT_BYTECAP(len)
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to me...
Definition sox_ng.h:266
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.
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.
void sox_keymap_add(char *key, char *effect, char *field, char op, double step)
Client API: Add a keymap.
void LSX_API lsx_warn_impl(LSX_PARAM_IN_PRINTF char const *fmt,...) LSX_PRINTF12
Plugins API: Print a warning in libSoX.
double LSX_API lsx_strtod(LSX_PARAM_IN_Z char const *nptr, LSX_PARAM_OUT_OPT char **endptr)
Plugins API: Like strtod, but checking for broken strtod() at runtime and disallowing NaN.
#define LSX_PARAM_OUT
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to me...
Definition sox_ng.h:252
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 enc...
sox_int32_t sox_int24_t
Client API: Alias for sox_int32_t (beware of the extra byte).
Definition sox_ng.h:428
#define LSX_RETURN_VALID
Plugins API: Attribute applied to a function to indicate that the return value is always a pointer to...
Definition sox_ng.h:101
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.
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.
Definition sox_ng.h:1177
void sox_keymap_free(void)
Client API: Free keymap memory.
sox_encoding_t
Client API: Format of sample data.
Definition sox_ng.h:518
@ SOX_ENCODING_DPCM
Differential PCM: Fasttracker 2 (xi)
Definition sox_ng.h:538
@ SOX_ENCODING_G723
G.723 3 or 5 bit ADPCM.
Definition sox_ng.h:532
@ SOX_ENCODING_OPUS
Opus compression.
Definition sox_ng.h:550
@ SOX_ENCODING_SIGN2
signed linear 2's comp: Mac
Definition sox_ng.h:521
@ SOX_ENCODING_AMR_WB
AMR-WB compression.
Definition sox_ng.h:546
@ SOX_ENCODING_ALAW
A-law signed logs: non-US telephony, Psion.
Definition sox_ng.h:530
@ SOX_ENCODINGS
End of list marker.
Definition sox_ng.h:553
@ SOX_ENCODING_ULAW
u-law signed logs: US telephony, SPARC
Definition sox_ng.h:529
@ SOX_ENCODING_WAVPACKF
WavPack with float samples.
Definition sox_ng.h:528
@ SOX_ENCODING_UNKNOWN
encoding has not yet been determined
Definition sox_ng.h:519
@ SOX_ENCODING_MP3
MPEG 1 Layer 3 compression.
Definition sox_ng.h:544
@ SOX_ENCODING_DSD
Direct Stream Digital.
Definition sox_ng.h:551
@ SOX_ENCODING_G721
G.721 4-bit ADPCM.
Definition sox_ng.h:531
@ SOX_ENCODING_CVSD
Continuously Variable Slope Delta modulation.
Definition sox_ng.h:548
@ SOX_ENCODING_FLOAT_TEXT
floating point (text format)
Definition sox_ng.h:524
@ SOX_ENCODING_MP1
MPEG 1 Layer 1 compression.
Definition sox_ng.h:542
@ SOX_ENCODING_MS_ADPCM
Microsoft Compressed PCM.
Definition sox_ng.h:535
@ SOX_ENCODING_GSM
GSM 6.10 33byte frame lossy compression.
Definition sox_ng.h:541
@ SOX_ENCODING_FLAC
FLAC compression.
Definition sox_ng.h:525
@ SOX_ENCODING_DWVWN
Delta Width Variable Word N-bit.
Definition sox_ng.h:540
@ SOX_ENCODING_VORBIS
Vorbis compression.
Definition sox_ng.h:545
@ SOX_ENCODING_CL_ADPCM16
Creative Labs 16 --> 4 bit Compressed PCM.
Definition sox_ng.h:534
@ SOX_ENCODING_UNSIGNED
unsigned linear: Sound Blaster
Definition sox_ng.h:522
@ SOX_ENCODING_CL_ADPCM
Creative Labs 8 --> 2,3,4 bit Compressed PCM.
Definition sox_ng.h:533
@ SOX_ENCODING_HCOM
Mac FSSD files with Huffman compression.
Definition sox_ng.h:526
@ SOX_ENCODING_AMR_NB
AMR-NB compression.
Definition sox_ng.h:547
@ SOX_ENCODING_DWVW
Delta Width Variable Word.
Definition sox_ng.h:539
@ SOX_ENCODING_LPC10
Linear Predictive Coding.
Definition sox_ng.h:549
@ SOX_ENCODING_WAVPACK
WavPack with integer samples.
Definition sox_ng.h:527
@ SOX_ENCODING_FLOAT
floating point (binary format)
Definition sox_ng.h:523
@ SOX_ENCODING_IMA_ADPCM
IMA Compressed PCM.
Definition sox_ng.h:536
@ SOX_ENCODING_MP2
MPEG 1 Layer 2 compression.
Definition sox_ng.h:543
@ SOX_ENCODING_OKI_ADPCM
Dialogic/OKI Compressed PCM.
Definition sox_ng.h:537
#define LSX_RETURN_OPT
Plugins API: Attribute applied to a function to indicate that the returned pointer may be null.
Definition sox_ng.h:134
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.
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...
sox_encodings_flags_t
Client API: Flags for sox_encodings_info_t: lossless/lossy1/lossy2.
Definition sox_ng.h:560
@ sox_encodings_lossy2
encode, decode, encode, decode: lossy twice = 2.
Definition sox_ng.h:563
@ sox_encodings_none
no flags specified (implies lossless encoding) = 0.
Definition sox_ng.h:561
@ sox_encodings_lossy1
encode, decode: lossy once = 1.
Definition sox_ng.h:562
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 funct...
Definition sox_ng.h:1267
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....
Definition sox_ng.h:1246
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.
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.
int LSX_API sox_format_init(void)
Client API: Find and load format handler plugins.
#define sox_encodings_info
Client API: Deprecated macro that returns the list of available encodings.
Definition sox_ng.h:1756
int16_t sox_int16_t
Client API: Signed twos-complement 16-bit type.
Definition sox_ng.h:392
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.
Definition sox_ng.h:1145
void LSX_API lsx_report_impl(LSX_PARAM_IN_PRINTF char const *fmt,...) LSX_PRINTF12
Plugins API: Print an informational message in libSoX.
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.
Definition sox_ng.h:1113
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.
#define LSX_RETURN_PURE
Plugins API: Attribute applied to a function to indicate that it has no side effects and depends only...
Definition sox_ng.h:90
sox_version_flags_t
Client API: Flags indicating whether optional features are present in this build of libSoX.
Definition sox_ng.h:505
@ sox_version_have_threads
threads = 4.
Definition sox_ng.h:509
@ sox_version_have_popen
popen = 1.
Definition sox_ng.h:507
@ sox_version_have_memopen
memopen = 8.
Definition sox_ng.h:510
@ sox_version_have_magic
magic = 2.
Definition sox_ng.h:508
@ sox_version_none
No special features = 0.
Definition sox_ng.h:506
char *(* sox_effect_handler_set)(sox_effect_t *effp, char *, char *)
Client API: Callback to set the value of an effect's parameter while it is running,...
Definition sox_ng.h:1607
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.
void LSX_API sox_delete_effects_chain(LSX_PARAM_INOUT sox_effects_chain_t *ecp)
Client API: Closes an effects chain.
void LSX_API lsx_debug_impl(LSX_PARAM_IN_PRINTF char const *fmt,...) LSX_PRINTF12
Plugins API: Print a debug message in libSoX.
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....
Definition sox_ng.h:1256
int LSX_API lsx_getopt(LSX_PARAM_INOUT lsx_getopt_t *state)
Plugins API: Gets the next option.
lsx_io_type
Plugins API: Is file a real file, a pipe, or a url?
Definition sox_ng.h:595
@ lsx_io_file
File is a real file = 0.
Definition sox_ng.h:596
@ lsx_io_pipe
File is a pipe (no seeking) = 1.
Definition sox_ng.h:597
@ lsx_io_url
File is a URL (no seeking) = 2.
Definition sox_ng.h:598
double sox_rate_t
Client API: Samples per second is stored as a double.
Definition sox_ng.h:449
#define LSX_PARAM_IN_PRINTF
Plugins API: Attribute applied to a parameter to indicate that the parameter is a const pointer to a ...
Definition sox_ng.h:167
#define LSX_PARAM_INOUT
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to on...
Definition sox_ng.h:227
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),...
Definition sox_ng.h:1084
sox_plot_t
Client API: Type of plot.
Definition sox_ng.h:570
@ sox_plot_octave
Octave plot = 1.
Definition sox_ng.h:572
@ sox_plot_gnuplot
Gnuplot plot = 2.
Definition sox_ng.h:573
@ sox_plot_off
No plot = 0.
Definition sox_ng.h:571
@ sox_plot_data
Plot data = 3.
Definition sox_ng.h:574
void LSX_API sox_trim_clear_start(LSX_PARAM_INOUT sox_effect_t *effp)
Client API: Clears the start of the trim to 0.
void LSX_API sox_init_encodinginfo(LSX_PARAM_OUT sox_encodinginfo_t *e)
Client API: Fills in an encodinginfo with default values.
int8_t sox_int8_t
Client API: Signed twos-complement 8-bit type.
Definition sox_ng.h:380
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,...
#define LSX_PARAM_OUT_OPT
Plugins API: Attribute applied to a parameter to indicate that the parameter is either NULL or a vali...
Definition sox_ng.h:314
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.
Definition sox_ng.h:1167
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).
Plugins API: String name and integer values for enumerated types (type metadata), for use with LSX_EN...
Definition sox_ng.h:2426
char const * text
String name of enumeration.
Definition sox_ng.h:2427
unsigned value
Integer value of enumeration.
Definition sox_ng.h:2428
Plugins API: lsx_getopt session information (initialization data and state).
Definition sox_ng.h:2636
char const * shortopts
IN shortopts: Short option characters.
Definition sox_ng.h:2639
int opt
OUT optopt: Receives the option character that caused error.
Definition sox_ng.h:2644
int lngind
OUT lngind: Receives the index of the matched long option or -1 if not a long option.
Definition sox_ng.h:2646
char const * curpos
INOUT curpos: Maintains state between calls to lsx_getopt.
Definition sox_ng.h:2642
int ind
INOUT optind: Maintains the index of next element to be processed.
Definition sox_ng.h:2643
lsx_option_t const * longopts
IN longopts: Array of long option descriptors.
Definition sox_ng.h:2640
char const * arg
OUT optarg: Receives the value of the option's argument.
Definition sox_ng.h:2645
lsx_getopt_flags_t flags
IN flags: Flags for longonly and opterr.
Definition sox_ng.h:2641
char *const * argv
IN argv: Array of arguments.
Definition sox_ng.h:2638
int argc
IN argc: Number of arguments in argv.
Definition sox_ng.h:2637
Plugins API: lsx_getopt long option descriptor.
Definition sox_ng.h:2625
lsx_option_arg_t has_arg
Whether the long option supports an argument and, if so, whether the argument is required or optional...
Definition sox_ng.h:2627
int * flag
Flag to set if argument is present.
Definition sox_ng.h:2628
char const * name
Name of the long option.
Definition sox_ng.h:2626
int val
Value to put in flag if argument is present.
Definition sox_ng.h:2629
Client API: Effect handler information.
Definition sox_ng.h:1613
sox_effect_handler_kill kill
Called to shut down effect (called once per effect).
Definition sox_ng.h:1622
char const * usage
Short explanation of parameters accepted by effect.
Definition sox_ng.h:1615
sox_effect_handler_getopts getopts
Called to parse command-line arguments (called once per effect).
Definition sox_ng.h:1617
sox_effect_handler_flow flow
Called to process samples.
Definition sox_ng.h:1619
sox_effect_handler_drain drain
Called to finish getting output after input is complete.
Definition sox_ng.h:1620
sox_effect_handler_set set
Called to change the value of a parameter.
Definition sox_ng.h:1631
char const * name
Effect name.
Definition sox_ng.h:1614
size_t priv_size
Size of private data SoX should pre-allocate for effect.
Definition sox_ng.h:1623
sox_effect_handler_start start
Called to initialize effect (called once per flow).
Definition sox_ng.h:1618
sox_effect_handler_get get
Called to read the value of a parameter.
Definition sox_ng.h:1630
sox_effect_handler_stop stop
Called to shut down effect (called once per flow).
Definition sox_ng.h:1621
char const *const * extra_usage
Additional lines of usage.
Definition sox_ng.h:1629
unsigned int flags
Combination of SOX_EFF_* flags.
Definition sox_ng.h:1616
Client API: Effect information.
Definition sox_ng.h:1638
size_t flow
flow number
Definition sox_ng.h:1647
sox_effects_globals_t * global_info
global effect parameters
Definition sox_ng.h:1639
sox_encodinginfo_t const * out_encoding
Information about the outgoing data encoding.
Definition sox_ng.h:1643
size_t flows
1 if MCHAN, number of chans otherwise
Definition sox_ng.h:1646
sox_signalinfo_t out_signal
Information about the outgoing data stream.
Definition sox_ng.h:1641
sox_encodinginfo_t const * in_encoding
Information about the incoming data encoding.
Definition sox_ng.h:1642
sox_signalinfo_t in_signal
Information about the incoming data stream.
Definition sox_ng.h:1640
void * priv
Effect's private data area (each flow has a separate copy)
Definition sox_ng.h:1648
size_t imin
minimum input buffer content required for calling this effect's flow function; set via lsx_effect_set...
Definition sox_ng.h:1653
sox_uint64_t clips
increment if clipping occurs
Definition sox_ng.h:1645
sox_effect_handler_t handler
The handler for this effect.
Definition sox_ng.h:1644
size_t oend
output buffer: one past valid data section (oend-obeg is length of current content)
Definition sox_ng.h:1652
size_t obeg
output buffer: start of valid data section
Definition sox_ng.h:1651
sox_sample_t * obuf
output buffer
Definition sox_ng.h:1650
Client API: Chain of effects to be applied to a stream.
Definition sox_ng.h:1660
sox_encodinginfo_t const * out_enc
Output encoding.
Definition sox_ng.h:1665
sox_effect_t ** effects
Table of effects to be applied to a stream.
Definition sox_ng.h:1661
sox_encodinginfo_t const * in_enc
Input encoding.
Definition sox_ng.h:1664
size_t table_size
Size of effects table (including unused entries)
Definition sox_ng.h:1667
sox_sample_t * il_buf
Channel interleave buffer.
Definition sox_ng.h:1668
sox_effects_globals_t global_info
Copy of global effects settings.
Definition sox_ng.h:1663
size_t length
Number of effects to be applied.
Definition sox_ng.h:1662
Client API: Global parameters for effects.
Definition sox_ng.h:1570
sox_plot_t plot
To help the user choose effect & options.
Definition sox_ng.h:1571
sox_globals_t * global_info
Pointer to associated SoX globals.
Definition sox_ng.h:1572
Client API: Encoding parameters.
Definition sox_ng.h:1381
sox_option_t reverse_nibbles
Should nibbles be reversed? If this is default during sox_open_read or sox_open_write,...
Definition sox_ng.h:1398
sox_bool opposite_endian
If set to true, the format should reverse its default endianness.
Definition sox_ng.h:1410
sox_option_t reverse_bits
Should bits be reversed? If this is default during sox_open_read or sox_open_write,...
Definition sox_ng.h:1405
sox_encoding_t encoding
format of sample numbers
Definition sox_ng.h:1382
sox_option_t reverse_bytes
Should bytes be reversed? If this is default during sox_open_read or sox_open_write,...
Definition sox_ng.h:1391
double compression
compression factor (where applicable)
Definition sox_ng.h:1384
unsigned bits_per_sample
0 if unknown or variable; uncompressed value if lossless; compressed value if lossy
Definition sox_ng.h:1383
Client API: Basic information about an encoding.
Definition sox_ng.h:1371
char const * name
encoding name.
Definition sox_ng.h:1373
sox_encodings_flags_t flags
lossy once (lossy1), lossy twice (lossy2), or lossless (none).
Definition sox_ng.h:1372
char const * desc
encoding description.
Definition sox_ng.h:1374
Client API: File buffer info.
Definition sox_ng.h:1440
char * buf
Pointer to data buffer.
Definition sox_ng.h:1441
size_t pos
Position in buffer.
Definition sox_ng.h:1444
size_t count
Count read into buffer.
Definition sox_ng.h:1443
size_t size
Size of buffer in bytes.
Definition sox_ng.h:1442
Client API: Handler structure defined by each format.
Definition sox_ng.h:1451
unsigned const * write_formats
Array of values indicating the encodings and precisions supported for writing (encoding).
Definition sox_ng.h:1475
sox_format_handler_stopwrite stopwrite
called to close writer (decoder); may be null if no closing necessary
Definition sox_ng.h:1461
sox_format_handler_startread startread
called to initialize reader (decoder)
Definition sox_ng.h:1456
sox_format_handler_stopread stopread
called to close reader (decoder); may be null if no closing necessary
Definition sox_ng.h:1458
sox_format_handler_startwrite startwrite
called to initialize writer (encoder)
Definition sox_ng.h:1459
sox_format_handler_write write
called to write (encode) a block of samples
Definition sox_ng.h:1460
size_t priv_size
SoX will automatically allocate a buffer in which the handler can store data.
Definition sox_ng.h:1490
sox_format_handler_read read
called to read (decode) a block of samples
Definition sox_ng.h:1457
sox_format_handler_seek seek
called to reposition reader; may be null if not supported
Definition sox_ng.h:1462
unsigned sox_lib_version_code
Checked on load; must be 1st in struct.
Definition sox_ng.h:1452
unsigned int flags
File flags (SOX_FILE_* values).
Definition sox_ng.h:1455
sox_rate_t const * write_rates
Array of sample rates (samples per second) supported for writing (encoding).
Definition sox_ng.h:1481
char const *const * names
null-terminated array of filename extensions that are handled by this format
Definition sox_ng.h:1454
char const * description
short description of format
Definition sox_ng.h:1453
Client API: Information about a loaded format handler, including the format name and a function point...
Definition sox_ng.h:1561
char const * name
Name of format handler.
Definition sox_ng.h:1562
sox_format_fn_t fn
Function to call to get format handler's information.
Definition sox_ng.h:1563
Client API: Data passed to/from the format handler.
Definition sox_ng.h:1510
char mode
Read or write mode ('r' or 'w')
Definition sox_ng.h:1539
char sox_errstr[256]
Failure error text.
Definition sox_ng.h:1543
sox_uint8_t * pending_bytes
Bytes read but not returned yet.
Definition sox_ng.h:1546
char * filetype
Type of file, as determined by header inspection or libmagic.
Definition sox_ng.h:1535
int sox_errno
Failure error code.
Definition sox_ng.h:1542
sox_signalinfo_t signal
Signal specifications for reader (decoder) or writer (encoder): sample rate, number of channels,...
Definition sox_ng.h:1525
sox_encodinginfo_t encoding
Encoding specifications for reader (decoder) or writer (encoder): encoding (sample format),...
Definition sox_ng.h:1533
lsx_io_type io_type
Stores whether this is a file, pipe or URL.
Definition sox_ng.h:1548
sox_oob_t oob
comments, instrument info, loop info (out-of-band data)
Definition sox_ng.h:1536
void * priv
Format handler's private data area.
Definition sox_ng.h:1552
sox_uint64_t olength
Samples * chans written to file.
Definition sox_ng.h:1540
void * fp
File stream pointer.
Definition sox_ng.h:1544
sox_bool seekable
Can seek on this file.
Definition sox_ng.h:1537
sox_uint64_t clips
Incremented if clipping occurs.
Definition sox_ng.h:1541
sox_format_handler_t handler
Format handler for this file.
Definition sox_ng.h:1551
sox_bool last_byte_was_zero
The last byte written was a zero.
Definition sox_ng.h:1538
sox_uint8_t * pending_buffer
Buffer of bytes read but not returned.
Definition sox_ng.h:1545
size_t pending_count
How many bytes read but not returned.
Definition sox_ng.h:1547
sox_uint64_t data_start
Offset at which headers end and sound data begins (set by lsx_check_read_params)
Definition sox_ng.h:1550
sox_uint64_t tell_off
Current offset within file.
Definition sox_ng.h:1549
char * filename
File name.
Definition sox_ng.h:1511
Client API: Global parameters (for effects & formats), returned from the sox_get_globals function.
Definition sox_ng.h:1313
sox_bool repeatable
true to use pre-determined timestamps and PRNG seed
Definition sox_ng.h:1318
sox_bool use_threads
Private: true if client has requested parallel effects processing.
Definition sox_ng.h:1339
char * myname
argv[0]
Definition sox_ng.h:1315
size_t bufsiz
Default size (in bytes) used by libSoX for blocks of sample data.
Definition sox_ng.h:1324
char * tmp_path
Private: client-configured path to use for temporary files.
Definition sox_ng.h:1337
char const * stdout_in_use_by
Private: tracks the name of the handler currently using stdout.
Definition sox_ng.h:1335
char const * stdin_in_use_by
Private: tracks the name of the handler currently using stdin.
Definition sox_ng.h:1334
unsigned verbosity
messages are only written if globals.verbosity >= message.level
Definition sox_ng.h:1316
size_t input_bufsiz
Default size (in bytes) used by libSoX for blocks of input sample data.
Definition sox_ng.h:1330
sox_bool use_magic
Private: true if client has requested use of 'magic' file-type detection.
Definition sox_ng.h:1338
sox_output_message_handler_t output_message_handler
client-specified message output callback
Definition sox_ng.h:1317
float A4
The frequency of A above middle C, usually 440.
Definition sox_ng.h:1348
size_t log2_dft_min_size
Log to base 2 of minimum size (in bytes) used by libSoX for DFT (filtering).
Definition sox_ng.h:1345
char const * subsystem
Private: tracks the name of the handler currently writing an output message.
Definition sox_ng.h:1336
sox_int32_t ranqd1
Can be used to re-seed libSoX's PRNG.
Definition sox_ng.h:1332
Client API: Instrument information.
Definition sox_ng.h:1428
signed char MIDIlow
MIDI pitch-bend low range.
Definition sox_ng.h:1430
unsigned nloops
number of active loops (max SOX_MAX_NLOOPS).
Definition sox_ng.h:1433
signed char MIDInote
for unity pitch playback
Definition sox_ng.h:1429
signed char MIDIhi
MIDI pitch-bend high range.
Definition sox_ng.h:1431
unsigned char loopmode
0=no, 1=forward, 2=forward/back (see sox_loop_* values)
Definition sox_ng.h:1432
Client API: Internal representation of –keymap bindings.
Definition sox_ng.h:1298
Client API: Looping parameters (out-of-band data).
Definition sox_ng.h:1417
sox_uint64_t length
length
Definition sox_ng.h:1419
unsigned count
number of repeats, 0=forever
Definition sox_ng.h:1420
sox_uint64_t start
first sample
Definition sox_ng.h:1418
unsigned char type
0=no, 1=forward, 2=forward/back (see sox_loop_* for valid values).
Definition sox_ng.h:1421
Client API: Comments, instrument info, loop info (out-of-band data).
Definition sox_ng.h:1497
sox_comments_t comments
Comment strings in id=value format.
Definition sox_ng.h:1499
sox_instrinfo_t instr
Instrument specification.
Definition sox_ng.h:1500
Client API: Signal parameters; members should be set to SOX_UNSPEC (= 0) if unknown.
Definition sox_ng.h:1359
unsigned channels
number of sound channels, 0 if unknown
Definition sox_ng.h:1361
unsigned precision
bits per sample, 0 if unknown
Definition sox_ng.h:1362
double * mult
Effects headroom multiplier; may be null.
Definition sox_ng.h:1364
sox_uint64_t length
samples * chans in file, 0 if unknown, -1 if unspecified
Definition sox_ng.h:1363
sox_rate_t rate
samples per second, 0 if unknown
Definition sox_ng.h:1360
Client API: Information about a build of libSoX, returned from the sox_version_info function.
Definition sox_ng.h:1281
char const * arch
arch, for example, "1248 48 44 L OMP"
Definition sox_ng.h:1289
sox_version_flags_t flags
feature flags = popen | magic | threads | memopen
Definition sox_ng.h:1283
char const * version
version string = sox_version(), for example, "14.4.2"
Definition sox_ng.h:1285
sox_uint32_t version_code
version number = 0x0E0402
Definition sox_ng.h:1284
char const * distro
distro or null = "DISTRO", for example, "Debian"
Definition sox_ng.h:1287
char const * version_extra
version extra info or null = "PACKAGE_EXTRA", for example, "beta"
Definition sox_ng.h:1286
size_t size
structure size = sizeof(sox_version_info_t)
Definition sox_ng.h:1282
char const * compiler
compiler info or null, for example, "msvc 160040219"
Definition sox_ng.h:1288