SoX - Sound eXchange
Audio file processing tool.
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 <limits.h>
23#include <stdarg.h>
24#include <stddef.h>
25#include <stdint.h>
26
27#if defined(__cplusplus)
28extern "C" {
29#endif
30
31/* Suppress warnings from use of type long long. */
32#if defined __GNUC__
33#pragma GCC system_header
34#endif
35
36/*****************************************************************************
37API decoration macros:
38Mostly for documentation purposes. For some compilers, decorations also affect
39code generation, influence compiler warnings or activate compiler
40optimizations.
41*****************************************************************************/
42
48#ifdef __GNUC__
49#define LSX_API __attribute__ ((cdecl)) /* libSoX function */
50#elif _MSC_VER
51#define LSX_API __cdecl /* libSoX function */
52#else
53#define LSX_API /* libSoX function */
54#endif
55
61#ifdef __GNUC__
62#define LSX_UNUSED __attribute__ ((unused)) /* Parameter or local variable is intentionally unused. */
63#else
64#define LSX_UNUSED /* Parameter or local variable is intentionally unused. */
65#endif
66
73#ifdef __GNUC__
74#define LSX_PRINTF12 __attribute__ ((format (printf, 1, 2))) /* Function has printf-style arguments. */
75#else
76#define LSX_PRINTF12 /* Function has printf-style arguments. */
77#endif
78
85/* gcc 2.95.3 on Haiku blurts many warnings about ignoring pure */
86#if defined(__GNUC__) && __GNUC__ > 2
87#define LSX_RETURN_PURE __attribute__ ((pure)) /* Function is pure. */
88#else
89#define LSX_RETURN_PURE /* Function is pure. */
90#endif
91
97#ifdef _Ret_
98#define LSX_RETURN_VALID _Ret_ /* Function always returns a valid object (never NULL). */
99#else
100#define LSX_RETURN_VALID /* Function always returns a valid object (never NULL). */
101#endif
102
108#ifdef _Ret_valid_
109#define LSX_RETURN_ARRAY _Ret_valid_ /* Function always returns a valid array (never NULL). */
110#else
111#define LSX_RETURN_ARRAY /* Function always returns a valid array (never NULL). */
112#endif
113
119#ifdef _Ret_z_
120#define LSX_RETURN_VALID_Z _Ret_z_ /* Function always returns a 0-terminated array (never NULL). */
121#else
122#define LSX_RETURN_VALID_Z /* Function always returns a 0-terminated array (never NULL). */
123#endif
124
130#ifdef _Ret_opt_
131#define LSX_RETURN_OPT _Ret_opt_ /* Function may return NULL. */
132#else
133#define LSX_RETURN_OPT /* Function may return NULL. */
134#endif
135
141#ifdef _In_
142#define LSX_PARAM_IN _In_ /* Required const pointer to a valid object (never NULL). */
143#else
144#define LSX_PARAM_IN /* Required const pointer to a valid object (never NULL). */
145#endif
146
152#ifdef _In_z_
153#define LSX_PARAM_IN_Z _In_z_ /* Required const pointer to 0-terminated string (never NULL). */
154#else
155#define LSX_PARAM_IN_Z /* Required const pointer to 0-terminated string (never NULL). */
156#endif
157
163#ifdef _Printf_format_string_
164#define LSX_PARAM_IN_PRINTF _Printf_format_string_ /* Required const pointer to 0-terminated printf format string (never NULL). */
165#else
166#define LSX_PARAM_IN_PRINTF /* Required const pointer to 0-terminated printf format string (never NULL). */
167#endif
168
176#ifdef _In_count_
177#define LSX_PARAM_IN_COUNT(len) _In_count_(len) /* Required const pointer to (len) valid objects (never NULL). */
178#else
179#define LSX_PARAM_IN_COUNT(len) /* Required const pointer to (len) valid objects (never NULL). */
180#endif
181
189#ifdef _In_bytecount_
190#define LSX_PARAM_IN_BYTECOUNT(len) _In_bytecount_(len) /* Required const pointer to (len) bytes of data (never NULL). */
191#else
192#define LSX_PARAM_IN_BYTECOUNT(len) /* Required const pointer to (len) bytes of data (never NULL). */
193#endif
194
200#ifdef _In_opt_
201#define LSX_PARAM_IN_OPT _In_opt_ /* Optional const pointer to a valid object (may be NULL). */
202#else
203#define LSX_PARAM_IN_OPT /* Optional const pointer to a valid object (may be NULL). */
204#endif
205
211#ifdef _In_opt_z_
212#define LSX_PARAM_IN_OPT_Z _In_opt_z_ /* Optional const pointer to 0-terminated string (may be NULL). */
213#else
214#define LSX_PARAM_IN_OPT_Z /* Optional const pointer to 0-terminated string (may be NULL). */
215#endif
216
223#ifdef _Inout_
224#define LSX_PARAM_INOUT _Inout_ /* Required pointer to a valid object (never NULL). */
225#else
226#define LSX_PARAM_INOUT /* Required pointer to a valid object (never NULL). */
227#endif
228
236#ifdef _Inout_count_x_
237#define LSX_PARAM_INOUT_COUNT(len) _Inout_count_x_(len) /* Required pointer to (len) valid objects (never NULL). */
238#else
239#define LSX_PARAM_INOUT_COUNT(len) /* Required pointer to (len) valid objects (never NULL). */
240#endif
241
248#ifdef _Out_
249#define LSX_PARAM_OUT _Out_ /* Required pointer to an object to be initialized (never NULL). */
250#else
251#define LSX_PARAM_OUT /* Required pointer to an object to be initialized (never NULL). */
252#endif
253
262#ifdef _Out_bytecap_
263#define LSX_PARAM_OUT_BYTECAP(len) _Out_bytecap_(len) /* Required pointer to writable buffer with room for len bytes. */
264#else
265#define LSX_PARAM_OUT_BYTECAP(len) /* Required pointer to writable buffer with room for len bytes. */
266#endif
267
280#ifdef _Out_cap_post_count_
281#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. */
282#else
283#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. */
284#endif
285
298#ifdef _Out_z_cap_post_count_
299#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. */
300#else
301#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. */
302#endif
303
310#ifdef _Out_opt_
311#define LSX_PARAM_OUT_OPT _Out_opt_ /* Optional pointer to an object to be initialized (may be NULL). */
312#else
313#define LSX_PARAM_OUT_OPT /* Optional pointer to an object to be initialized (may be NULL). */
314#endif
315
322#ifdef _Deref_pre_maybenull_
323#define LSX_PARAM_DEREF_PRE_MAYBENULL _Deref_pre_maybenull_ /* Required pointer (never NULL) to another pointer (may be NULL). */
324#else
325#define LSX_PARAM_DEREF_PRE_MAYBENULL /* Required pointer (never NULL) to another pointer (may be NULL). */
326#endif
327
334#ifdef _Deref_post_null_
335#define LSX_PARAM_DEREF_POST_NULL _Deref_post_null_ /* Required pointer (never NULL) to another pointer, which will be NULL on exit. */
336#else
337#define LSX_PARAM_DEREF_POST_NULL /* Required pointer (never NULL) to another pointer, which will be NULL on exit. */
338#endif
339
346#ifdef _Deref_post_notnull_
347#define LSX_PARAM_DEREF_POST_NOTNULL _Deref_post_notnull_ /* Required pointer (never NULL) to another pointer, which will be valid (not NULL) on exit. */
348#else
349#define LSX_PARAM_DEREF_POST_NOTNULL /* Required pointer (never NULL) to another pointer, which will be valid (not NULL) on exit. */
350#endif
351
357#ifdef _PREFAST_
358#define LSX_USE_VAR(x) ((void)(x=0)) /* During static analysis, initialize unused variables to 0. */
359#else
360#define LSX_USE_VAR(x) ((void)(x)) /* Parameter or variable is intentionally unused. */
361#endif
362
369#define lsx_static_assert(e,f) enum {lsx_static_assert_##f = 1/((e) ? 1 : 0)}
370
371/*****************************************************************************
372Basic typedefs:
373*****************************************************************************/
374
379typedef int8_t sox_int8_t;
380
385typedef uint8_t sox_uint8_t;
386
391typedef int16_t sox_int16_t;
392
397typedef uint16_t sox_uint16_t;
398
403typedef int32_t sox_int32_t;
404
409typedef uint32_t sox_uint32_t;
410
415typedef int64_t sox_int64_t;
416
421typedef uint64_t sox_uint64_t;
422
428
434
439/* If this ever changes to a floating point type,
440 * move case SOX_SAMPLE in lsx_generate_wave_table()
441 */
443
448typedef double sox_rate_t;
449
454typedef char * * sox_comments_t;
455
456/*****************************************************************************
457Enumerations:
458*****************************************************************************/
459
464typedef enum sox_bool {
465 sox_bool_dummy = -1, /* Ensure a signed type */
467 sox_true
469
474typedef enum sox_option_t {
479
487 SOX_EOF = -1,
488 SOX_EHDR = 2000,
495
507
512/* Must match the entries in formats.c:s_sox_encodings_info[] */
513typedef enum sox_encoding_t {
548
558
563typedef enum sox_plot_t {
569
582
587typedef enum lsx_io_type
588{
593
594/*****************************************************************************
595Macros:
596*****************************************************************************/
597
606#define SOX_LIB_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
607
614#define SOX_LIB_VERSION_CODE SOX_LIB_VERSION(14, 6, 1)
615
625#define SOX_INT_MIN(bits) (1 <<((bits)-1))
626
636#define SOX_INT_MAX(bits) (((unsigned)-1)>>(33-(bits)))
637
647#define SOX_UINT_MAX(bits) (SOX_INT_MIN(bits)|SOX_INT_MAX(bits))
648
653#define SOX_INT8_MAX SOX_INT_MAX(8)
654
659#define SOX_INT16_MAX SOX_INT_MAX(16)
660
665#define SOX_INT24_MAX SOX_INT_MAX(24)
666
671#define SOX_INT32_MAX SOX_INT_MAX(32)
672
677#define SOX_SAMPLE_PRECISION 32
678
683#define SOX_SAMPLE_MAX (sox_sample_t)SOX_INT_MAX(32)
684
689#define SOX_SAMPLE_MIN (sox_sample_t)SOX_INT_MIN(32)
690
691
692/* Conversions: Linear PCM <--> sox_sample_t
693 *
694 * I/O Input sox_sample_t Clips? Input sox_sample_t Clips?
695 * Format Minimum Minimum I O Maximum Maximum I O
696 * ------ --------- ------------ -- -- -------- ------------ -- --
697 * Float -inf -1 y n inf 1 - 5e-10 y n
698 * Int8 -128 -128 n n 127 127.9999999 n y
699 * Int16 -32768 -32768 n n 32767 32767.99998 n y
700 * Int24 -8388608 -8388608 n n 8388607 8388607.996 n y
701 * Int32 -2147483648 -2147483648 n n 2147483647 2147483647 n n
702 *
703 * Conversions are as accurate as possible (with rounding).
704 *
705 * Rounding: halves toward +inf, all others to nearest integer.
706 *
707 * Clips? shows whether on not there is the possibility of a conversion
708 * clipping to the minimum or maximum value when inputing from or outputing
709 * to a given type.
710 *
711 * Unsigned integers are converted to and from signed integers by flipping
712 * the upper-most bit then treating them as signed integers.
713 */
714
720#define SOX_SAMPLE_LOCALS sox_sample_t sox_macro_temp_sample LSX_UNUSED; \
721 double sox_macro_temp_double LSX_UNUSED
722
727#define SOX_SAMPLE_NEG SOX_INT_MIN(32)
728
737#define SOX_SAMPLE_TO_UNSIGNED(bits,d,clips) \
738 (sox_uint##bits##_t)(SOX_SAMPLE_TO_SIGNED(bits,d,clips)^SOX_INT_MIN(bits))
739
748#define SOX_SAMPLE_TO_SIGNED(bits,d,clips) \
749 (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))
750
758#define SOX_SIGNED_TO_SAMPLE(bits,d)((sox_sample_t)(d)<<(32-bits))
759
767#define SOX_UNSIGNED_TO_SAMPLE(bits,d)(SOX_SIGNED_TO_SAMPLE(bits,d)^SOX_SAMPLE_NEG)
768
776#define SOX_UNSIGNED_8BIT_TO_SAMPLE(d,clips) SOX_UNSIGNED_TO_SAMPLE(8,d)
777
785#define SOX_SIGNED_8BIT_TO_SAMPLE(d,clips) SOX_SIGNED_TO_SAMPLE(8,d)
786
794#define SOX_UNSIGNED_16BIT_TO_SAMPLE(d,clips) SOX_UNSIGNED_TO_SAMPLE(16,d)
795
803#define SOX_SIGNED_16BIT_TO_SAMPLE(d,clips) SOX_SIGNED_TO_SAMPLE(16,d)
804
812#define SOX_UNSIGNED_24BIT_TO_SAMPLE(d,clips) SOX_UNSIGNED_TO_SAMPLE(24,d)
813
821#define SOX_SIGNED_24BIT_TO_SAMPLE(d,clips) SOX_SIGNED_TO_SAMPLE(24,d)
822
830#define SOX_UNSIGNED_32BIT_TO_SAMPLE(d,clips) ((sox_sample_t)(d)^SOX_SAMPLE_NEG)
831
839#define SOX_SIGNED_32BIT_TO_SAMPLE(d,clips) (sox_sample_t)(d)
840
848#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)
849
857#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)
858
865#define SOX_SAMPLE_TO_UNSIGNED_8BIT(d,clips) SOX_SAMPLE_TO_UNSIGNED(8,d,clips)
866
873#define SOX_SAMPLE_TO_SIGNED_8BIT(d,clips) SOX_SAMPLE_TO_SIGNED(8,d,clips)
874
881#define SOX_SAMPLE_TO_UNSIGNED_16BIT(d,clips) SOX_SAMPLE_TO_UNSIGNED(16,d,clips)
882
889#define SOX_SAMPLE_TO_SIGNED_16BIT(d,clips) SOX_SAMPLE_TO_SIGNED(16,d,clips)
890
897#define SOX_SAMPLE_TO_UNSIGNED_24BIT(d,clips) SOX_SAMPLE_TO_UNSIGNED(24,d,clips)
898
905#define SOX_SAMPLE_TO_SIGNED_24BIT(d,clips) SOX_SAMPLE_TO_SIGNED(24,d,clips)
906
913#define SOX_SAMPLE_TO_UNSIGNED_32BIT(d,clips) (sox_uint32_t)((d)^SOX_SAMPLE_NEG)
914
921#define SOX_SAMPLE_TO_SIGNED_32BIT(d,clips) (sox_int32_t)(d)
922
929#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.))))
930
937#define SOX_SAMPLE_TO_FLOAT_64BIT(d,clips) ((d)*(1./(SOX_SAMPLE_MAX+1.)))
938
946#define SOX_SAMPLE_CLIP_COUNT(samp, clips) \
947 do { \
948 if (samp > SOX_SAMPLE_MAX) \
949 { samp = SOX_SAMPLE_MAX; clips++; } \
950 else if (samp < SOX_SAMPLE_MIN) \
951 { samp = SOX_SAMPLE_MIN; clips++; } \
952 } while (0)
953
962#define SOX_ROUND_CLIP_COUNT(d, clips) \
963 ((d) < 0? (d) <= SOX_SAMPLE_MIN - 0.5? ++(clips), SOX_SAMPLE_MIN: (d) - 0.5 \
964 : (d) >= SOX_SAMPLE_MAX + 0.5? ++(clips), SOX_SAMPLE_MAX: (d) + 0.5)
965
975#define SOX_INTEGER_CLIP_COUNT(bits,i,clips) ( \
976 (i) >(int)((unsigned)1 << ((bits)-1))- 1 ? ++(clips),((unsigned)1 << ((bits)-1))- 1 : \
977 (i) <(int)((unsigned)-1 << ((bits)-1)) ? ++(clips),(unsigned)-1 << ((bits)-1) : (i))
978
987#define SOX_16BIT_CLIP_COUNT(i,clips) SOX_INTEGER_CLIP_COUNT(16,i,clips)
988
997#define SOX_24BIT_CLIP_COUNT(i,clips) SOX_INTEGER_CLIP_COUNT(24,i,clips)
998
999#define SOX_SIZE_MAX ((size_t)(-1))
1001#define SOX_UNSPEC 0
1002#define SOX_UNKNOWN_LEN (sox_uint64_t)(-1)
1003#define SOX_IGNORE_LENGTH (sox_uint64_t)(-2)
1005#define SOX_DEFAULT_CHANNELS 2
1006#define SOX_DEFAULT_RATE 48000
1007#define SOX_DEFAULT_PRECISION 16
1008#define SOX_DEFAULT_ENCODING SOX_ENCODING_SIGN2
1010#define SOX_LOOP_NONE ((unsigned char)sox_loop_none)
1011#define SOX_LOOP_8 ((unsigned char)sox_loop_8)
1012#define SOX_LOOP_SUSTAIN_DECAY ((unsigned char)sox_loop_sustain_decay)
1014#define SOX_MAX_NLOOPS 8
1016#define SOX_FILE_NOSTDIO 0x0001
1017#define SOX_FILE_DEVICE 0x0002
1018#define SOX_FILE_PHONY 0x0004
1019#define SOX_FILE_REWIND 0x0008
1020#define SOX_FILE_BIT_REV 0x0010
1021#define SOX_FILE_NIB_REV 0x0020
1022#define SOX_FILE_ENDIAN 0x0040
1023#define SOX_FILE_ENDBIG 0x0080
1024#define SOX_FILE_MONO 0x0100
1025#define SOX_FILE_STEREO 0x0200
1026#define SOX_FILE_QUAD 0x0400
1028#define SOX_FILE_CHANS (SOX_FILE_MONO | SOX_FILE_STEREO | SOX_FILE_QUAD)
1029#define SOX_FILE_LIT_END (SOX_FILE_ENDIAN | 0)
1030#define SOX_FILE_BIG_END (SOX_FILE_ENDIAN | SOX_FILE_ENDBIG)
1032#define SOX_EFF_CHAN 1
1033#define SOX_EFF_RATE 2
1034#define SOX_EFF_PREC 4
1035#define SOX_EFF_LENGTH 8
1036#define SOX_EFF_MCHAN 16
1037#define SOX_EFF_NULL 32
1038#define SOX_EFF_DEPRECATED 64 /* No longer used */
1039#define SOX_EFF_GAIN 128
1040#define SOX_EFF_MODIFY 256
1041#define SOX_EFF_ALPHA 512 /* No longer used */
1042#define SOX_EFF_INTERNAL 1024
1049#define SOX_SEEK_SET 0
1050
1051/*****************************************************************************
1052Forward declarations:
1053*****************************************************************************/
1054
1055typedef struct sox_format sox_format_t;
1056typedef struct sox_effect sox_effect_t;
1057typedef struct sox_effect_handler sox_effect_handler_t;
1058typedef struct sox_format_handler sox_format_handler_t;
1059
1060/*****************************************************************************
1061Function pointers:
1062*****************************************************************************/
1063
1070 unsigned level,
1071 LSX_PARAM_IN_Z char const * filename,
1072 LSX_PARAM_IN_PRINTF char const * fmt,
1073 LSX_PARAM_IN va_list ap
1074 );
1075
1082typedef sox_format_handler_t const * (LSX_API * sox_format_fn_t)(void);
1083
1090typedef sox_effect_handler_t const * (LSX_API *sox_effect_fn_t)(void);
1091
1099 LSX_PARAM_INOUT sox_format_t * ft
1100 );
1101
1109 LSX_PARAM_INOUT sox_format_t * ft,
1111 size_t len
1112 );
1113
1121 LSX_PARAM_INOUT sox_format_t * ft
1122 );
1123
1131 LSX_PARAM_INOUT sox_format_t * ft
1132 );
1133
1141 LSX_PARAM_INOUT sox_format_t * ft,
1142 LSX_PARAM_IN_COUNT(len) sox_sample_t const * buf,
1143 size_t len
1144 );
1145
1153 LSX_PARAM_INOUT sox_format_t * ft
1154 );
1155
1163 LSX_PARAM_INOUT sox_format_t * ft,
1164 sox_uint64_t offset
1165 );
1166
1174 LSX_PARAM_INOUT sox_effect_t * effp,
1175 int argc,
1176 LSX_PARAM_IN_COUNT(argc) char *argv[]
1177 );
1178
1186 LSX_PARAM_INOUT sox_effect_t * effp
1187 );
1188
1196 LSX_PARAM_INOUT sox_effect_t * effp,
1197 LSX_PARAM_IN_COUNT(*isamp) sox_sample_t const * ibuf,
1198 LSX_PARAM_OUT_CAP_POST_COUNT(*osamp,*osamp) sox_sample_t * obuf,
1199 LSX_PARAM_INOUT size_t *isamp,
1200 LSX_PARAM_INOUT size_t *osamp
1201 );
1202
1210 LSX_PARAM_INOUT sox_effect_t * effp,
1211 LSX_PARAM_OUT_CAP_POST_COUNT(*osamp,*osamp) sox_sample_t *obuf,
1212 LSX_PARAM_INOUT size_t *osamp
1213 );
1214
1222 LSX_PARAM_INOUT sox_effect_t * effp
1223 );
1224
1232 LSX_PARAM_INOUT sox_effect_t * effp
1233 );
1234
1242 sox_bool all_done,
1243 void * client_data
1244 );
1245
1253 void * callback_data,
1254 LSX_PARAM_IN_Z char const * filename
1255 );
1256
1257/*****************************************************************************
1258Structures:
1259*****************************************************************************/
1260
1266typedef struct sox_version_info {
1267 size_t size;
1270 char const * version;
1271 char const * version_extra;
1272 char const * distro;
1273 char const * compiler;
1274 char const * arch;
1275 /* new info should be added at the end for version backwards-compatibility. */
1277
1283typedef struct sox_globals {
1284/* public: */
1285 unsigned verbosity;
1293 size_t bufsiz;
1294
1300
1303 char const * stdin_in_use_by;
1304 char const * stdout_in_use_by;
1305 char const * subsystem;
1306 char * tmp_path;
1316
1321typedef struct sox_signalinfo {
1323 unsigned channels;
1324 unsigned precision;
1326 double * mult;
1328
1333typedef struct sox_encodings_info {
1335 char const * name;
1336 char const * desc;
1338
1343typedef struct sox_encodinginfo {
1354
1361
1368
1374
1379typedef struct sox_loopinfo {
1382 unsigned count;
1383 unsigned char type;
1385
1390typedef struct sox_instrinfo {
1391 signed char MIDInote;
1392 signed char MIDIlow;
1393 signed char MIDIhi;
1394 unsigned char loopmode;
1395 unsigned nloops;
1397
1402typedef struct sox_fileinfo {
1403 char *buf;
1404 size_t size;
1405 size_t count;
1406 size_t pos;
1408
1415 char const * description;
1416 char const * const * names;
1417 unsigned int flags;
1437 unsigned const * write_formats;
1438
1444
1453};
1454
1459typedef struct sox_oob {
1460 /* Decoded: */
1465 /* TBD: Non-decoded chunks, etc: */
1466} sox_oob_t;
1467
1473 char * filename;
1488
1496
1497 char * filetype;
1501 char mode;
1505 char sox_errstr[256];
1506 void * fp;
1513 sox_format_handler_t handler;
1514 void * priv;
1515};
1516
1523typedef struct sox_format_tab {
1524 char *name;
1527
1532typedef struct sox_effects_globals {
1536
1542 char const * name;
1543 char const * usage;
1544 char const * const * extra_usage;
1545 unsigned int flags;
1552 size_t priv_size;
1553};
1554
1565 sox_effect_handler_t handler;
1567 size_t flows;
1568 size_t flow;
1569 void * priv;
1570 /* The following items are private to the libSoX effects chain functions. */
1572 size_t obeg;
1573 size_t oend;
1574 size_t imin;
1575};
1576
1581typedef struct sox_effects_chain {
1582 sox_effect_t **effects;
1583 size_t length;
1587 /* The following items are private to the libSoX effects chain functions. */
1588 size_t table_size;
1591
1592/*****************************************************************************
1593Functions:
1594*****************************************************************************/
1595
1602char const *
1603LSX_API
1605
1612sox_version_info_t const *
1613LSX_API
1615
1623LSX_API
1625
1631#define sox_globals (*sox_get_globals())
1632
1641LSX_API
1643
1649#define sox_encodings_info (sox_get_encodings_info())
1650
1655void
1656LSX_API
1659 );
1660
1672unsigned
1673LSX_API
1675 sox_encoding_t encoding,
1676 unsigned bits_per_sample
1677 );
1678
1684size_t
1685LSX_API
1688 );
1689
1694void
1695LSX_API
1698 LSX_PARAM_IN_Z char const * item
1699 );
1700
1705void
1706LSX_API
1709 LSX_PARAM_IN_Z char const * items
1710 );
1711
1719LSX_API
1722 );
1723
1728void
1729LSX_API
1732 );
1733
1740char const *
1741LSX_API
1744 LSX_PARAM_IN_Z char const * id
1745 );
1746
1752int
1753LSX_API
1755
1760void
1761LSX_API
1763
1769int
1770LSX_API
1772
1778int
1779LSX_API
1781
1788sox_format_tab_t const *
1789LSX_API
1791
1796#define sox_format_fns (sox_get_format_fns())
1797
1804sox_format_t *
1805LSX_API
1807 LSX_PARAM_IN_Z char const * path,
1808 LSX_PARAM_IN_OPT sox_signalinfo_t const * signal,
1809 LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,
1810 LSX_PARAM_IN_OPT_Z char const * filetype
1811 );
1812
1819sox_format_t *
1820LSX_API
1822 LSX_PARAM_IN_BYTECOUNT(buffer_size) void * buffer,
1823 size_t buffer_size,
1824 LSX_PARAM_IN_OPT sox_signalinfo_t const * signal,
1825 LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,
1826 LSX_PARAM_IN_OPT_Z char const * filetype
1827 );
1828
1835LSX_API
1837 LSX_PARAM_IN_OPT_Z char const * path,
1838 LSX_PARAM_IN_OPT_Z char const * filetype,
1839 LSX_PARAM_IN sox_encodinginfo_t const * encoding
1840 );
1841
1848sox_format_handler_t const *
1849LSX_API
1851 LSX_PARAM_IN_OPT_Z char const * path,
1852 LSX_PARAM_IN_OPT_Z char const * filetype,
1853 LSX_PARAM_OUT_OPT char const * * filetype1
1854 );
1855
1862sox_format_t *
1863LSX_API
1865 LSX_PARAM_IN_Z char const * path,
1866 LSX_PARAM_IN sox_signalinfo_t const * signal,
1867 LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,
1868 LSX_PARAM_IN_OPT_Z char const * filetype,
1869 LSX_PARAM_IN_OPT sox_oob_t const * oob,
1870 LSX_PARAM_IN_OPT sox_bool (LSX_API * overwrite_permitted)(LSX_PARAM_IN_Z char const * filename)
1871 );
1872
1879sox_format_t *
1880LSX_API
1882 LSX_PARAM_OUT_BYTECAP(buffer_size) void * buffer,
1883 LSX_PARAM_IN size_t buffer_size,
1884 LSX_PARAM_IN sox_signalinfo_t const * signal,
1885 LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,
1886 LSX_PARAM_IN_OPT_Z char const * filetype,
1887 LSX_PARAM_IN_OPT sox_oob_t const * oob
1888 );
1889
1896sox_format_t *
1897LSX_API
1899 LSX_PARAM_OUT char * * buffer_ptr,
1900 LSX_PARAM_OUT size_t * buffer_size_ptr,
1901 LSX_PARAM_IN sox_signalinfo_t const * signal,
1902 LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,
1903 LSX_PARAM_IN_OPT_Z char const * filetype,
1904 LSX_PARAM_IN_OPT sox_oob_t const * oob
1905 );
1906
1912size_t
1913LSX_API
1915 LSX_PARAM_INOUT sox_format_t * ft,
1917 size_t len
1918 );
1919
1925size_t
1926LSX_API
1928 LSX_PARAM_INOUT sox_format_t * ft,
1929 LSX_PARAM_IN_COUNT(len) sox_sample_t const * buf,
1930 size_t len
1931 );
1932
1938int
1939LSX_API
1941 LSX_PARAM_INOUT sox_format_t * ft
1942 );
1943
1949int
1950LSX_API
1952 LSX_PARAM_INOUT sox_format_t * ft,
1953 sox_uint64_t offset,
1954 int whence
1955 );
1956
1963sox_format_handler_t const *
1964LSX_API
1966 LSX_PARAM_IN_Z char const * name,
1967 sox_bool ignore_devices
1968 );
1969
1977LSX_API
1979
1984#define sox_effects_globals (*sox_get_effects_globals())
1985
1992sox_effect_handler_t const *
1993LSX_API
1995 LSX_PARAM_IN_Z char const * name
1996 );
1997
2004sox_effect_t *
2005LSX_API
2007 LSX_PARAM_IN sox_effect_handler_t const * eh
2008 );
2009
2015int
2016LSX_API
2018 LSX_PARAM_IN sox_effect_t *effp,
2019 int argc,
2020 LSX_PARAM_IN_COUNT(argc) char * const argv[]
2021 );
2022
2029sox_effect_fn_t const *
2030LSX_API
2032
2037#define sox_effect_fns (sox_get_effect_fns())
2038
2046LSX_API
2048 LSX_PARAM_IN sox_encodinginfo_t const * in_enc,
2049 LSX_PARAM_IN sox_encodinginfo_t const * out_enc
2050 );
2051
2056void
2057LSX_API
2060 );
2061
2067int
2068LSX_API
2071 LSX_PARAM_INOUT sox_effect_t * effp,
2073 LSX_PARAM_IN sox_signalinfo_t const * out
2074 );
2075
2081int
2082LSX_API
2086 LSX_PARAM_IN_OPT void * client_data
2087 );
2088
2095LSX_API
2098 );
2099
2106LSX_API
2108 LSX_PARAM_INOUT_COUNT(effp->flows) sox_effect_t * effp
2109 );
2110
2115void
2116LSX_API
2119 LSX_PARAM_INOUT sox_effect_t * effp
2120 );
2121
2128sox_effect_t *
2129LSX_API
2132 );
2133
2138void
2139LSX_API
2141 LSX_PARAM_INOUT_COUNT(effp->flows) sox_effect_t *effp
2142 );
2143
2148void
2149LSX_API
2152 );
2153
2158void
2159LSX_API
2162 );
2163
2172LSX_API
2174 LSX_PARAM_IN sox_effect_t * effp
2175 );
2176
2181void
2182LSX_API
2184 LSX_PARAM_INOUT sox_effect_t * effp
2185 );
2186
2193LSX_API
2195 LSX_PARAM_IN_Z char const * filename
2196 );
2197
2203int
2204LSX_API
2207 void * p,
2208 LSX_PARAM_IN char const * const listname
2209 );
2210
2218char const *
2219LSX_API
2221 int sox_errno
2222 );
2223
2231size_t
2232LSX_API
2234 LSX_PARAM_OUT_Z_CAP_POST_COUNT(base_buffer_len,return) char * base_buffer,
2235 size_t base_buffer_len,
2236 LSX_PARAM_IN_Z char const * filename
2237 );
2238
2239/*****************************************************************************
2240Internal API:
2241WARNING - The items in this section are subject to instability. They only
2242exist in the public header because sox (the application) currently uses them.
2243These may be changed or removed in future versions of libSoX.
2244*****************************************************************************/
2245
2250void
2251LSX_API
2253 LSX_PARAM_IN_PRINTF char const * fmt,
2254 ...)
2256
2261void
2262LSX_API
2264 LSX_PARAM_IN_PRINTF char const * fmt,
2265 ...)
2267
2272void
2273LSX_API
2275 LSX_PARAM_IN_PRINTF char const * fmt,
2276 ...)
2278
2283void
2284LSX_API
2286 LSX_PARAM_IN_PRINTF char const * fmt,
2287 ...)
2289
2294#define lsx_fail sox_get_globals()->subsystem=__FILE__,lsx_fail_impl
2295
2300#define lsx_warn sox_get_globals()->subsystem=__FILE__,lsx_warn_impl
2301
2306#define lsx_report sox_get_globals()->subsystem=__FILE__,lsx_report_impl
2307
2312#define lsx_debug sox_get_globals()->subsystem=__FILE__,lsx_debug_impl
2313
2319typedef struct lsx_enum_item {
2320 char const *text;
2321 unsigned value;
2323
2331#define LSX_ENUM_ITEM(prefix, item) {#item, prefix##item},
2332
2337enum
2338{
2342
2349lsx_enum_item const *
2350LSX_API
2352 LSX_PARAM_IN_Z char const * text,
2353 LSX_PARAM_IN lsx_enum_item const * lsx_enum_items,
2354 int flags
2355 );
2356
2363lsx_enum_item const *
2364LSX_API
2366 unsigned value,
2367 LSX_PARAM_IN lsx_enum_item const * lsx_enum_items
2368 );
2369
2378int
2379LSX_API
2381 int c,
2382 LSX_PARAM_IN_Z char const * arg,
2383 LSX_PARAM_IN lsx_enum_item const * items
2384 );
2385
2393LSX_API
2395 LSX_PARAM_IN_Z char const * str,
2396 LSX_PARAM_IN_Z char const * end
2397 );
2398
2406char const *
2407LSX_API
2409 LSX_PARAM_IN_Z char const * pathname
2410 );
2411
2420char const *
2421LSX_API
2423 double number
2424 );
2425
2434char const *
2435LSX_API
2437 double percentage
2438 );
2439
2447void *
2448LSX_API
2450 LSX_PARAM_IN_OPT void *ptr,
2451 size_t newsize
2452 );
2453
2460int
2461LSX_API
2463 LSX_PARAM_IN_Z char const * s1,
2464 LSX_PARAM_IN_Z char const * s2
2465 );
2466
2467
2474int
2475LSX_API
2477 LSX_PARAM_IN_Z char const * s1,
2478 LSX_PARAM_IN_Z char const * s2,
2479 size_t n
2480 );
2481
2486typedef enum lsx_option_arg_t {
2491
2501
2506typedef struct lsx_option {
2507 char const * name;
2509 int * flag;
2510 int val;
2511} lsx_option_t;
2512
2517typedef struct lsx_getopt {
2518 int argc;
2519 char * const * argv;
2520 char const * shortopts;
2523 char const * curpos;
2524 int ind;
2525 int opt;
2526 char const * arg;
2528} lsx_getopt_t;
2529
2534void
2535LSX_API
2537 LSX_PARAM_IN int argc,
2538 LSX_PARAM_IN_COUNT(argc) char * const * argv,
2539 LSX_PARAM_IN_Z char const * shortopts,
2540 LSX_PARAM_IN_OPT lsx_option_t const * longopts,
2542 LSX_PARAM_IN int first,
2544 );
2545
2557int
2558LSX_API
2561 );
2562
2569LSX_API
2571 LSX_PARAM_IN sox_format_t * ft
2572 );
2573
2574/* WARNING END */
2575
2576#if defined(__cplusplus)
2577}
2578#endif
2579
2580#endif /* SOX_H */
@ lsx_find_enum_item_none
Default parameters (case-insensitive).
Definition: sox_ng.h:2339
@ lsx_find_enum_item_case_sensitive
Enable case-sensitive search.
Definition: sox_ng.h:2340
#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:301
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:325
int LSX_API sox_quit(void)
Client API: Close 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:192
uint64_t sox_uint64_t
Client API: Unsigned 64-bit type.
Definition: sox_ng.h:421
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 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:1173
sox_int32_t sox_sample_t
Client API: Native SoX audio sample type (alias for sox_int32_t).
Definition: sox_ng.h:442
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:1108
#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:337
uint16_t sox_uint16_t
Client API: Unsigned 16-bit type.
Definition: sox_ng.h:397
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:1221
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:1195
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:2496
@ lsx_getopt_flag_none
no flags (no output, not long-only)
Definition: sox_ng.h:2497
@ lsx_getopt_flag_longonly
if set, recognize -option as a long option
Definition: sox_ng.h:2499
@ lsx_getopt_flag_opterr
if set, invalid options trigger lsx_warn output
Definition: sox_ng.h:2498
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:155
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:385
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:1209
char ** sox_comments_t
Client API: File's metadata, access via sox_*_comments functions.
Definition: sox_ng.h:454
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:474
@ sox_option_default
Option unspecified = 2.
Definition: sox_ng.h:477
@ sox_option_yes
Option specified as yes = 1.
Definition: sox_ng.h:476
@ sox_option_no
Option specified as no = 0.
Definition: sox_ng.h:475
void LSX_API lsx_fail_impl(LSX_PARAM_IN_PRINTF char const *fmt,...) LSX_PRINTF12
Plugins API: Print a fatal error in libSoX.
sox_bool
Client API: Boolean type, assignment (but not necessarily binary) compatible with C++ bool.
Definition: sox_ng.h:464
@ sox_true
True = 1.
Definition: sox_ng.h:467
@ sox_false
False = 0.
Definition: sox_ng.h:466
#define sox_effects_globals
Client API: Deprecated macro that returns global parameters for effects.
Definition: sox_ng.h:1984
#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:111
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:179
sox_uint32_t sox_uint24_t
Client API: Alias for sox_uint32_t (beware of the extra byte).
Definition: sox_ng.h:433
int64_t sox_int64_t
Client API: Signed twos-complement 64-bit type.
Definition: sox_ng.h:415
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:1120
int LSX_API sox_init(void)
Client API: Initialize 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:122
#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:144
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:1185
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:1082
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:349
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:1140
int32_t sox_int32_t
Client API: Signed twos-complement 32-bit type.
Definition: sox_ng.h:403
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.
#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:283
LSX_RETURN_VALID LSX_RETURN_PURE sox_effects_globals_t *LSX_API sox_get_effects_globals(void)
Client API: Returns global parameters for effects.
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:409
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:53
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:214
#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:239
lsx_option_arg_t
Plugins API: Is option argument unsupported, required, or optional.
Definition: sox_ng.h:2486
@ lsx_option_arg_optional
Option can optionally be followed by an argument.
Definition: sox_ng.h:2489
@ lsx_option_arg_required
Option requires an argument.
Definition: sox_ng.h:2488
@ lsx_option_arg_none
Option does not have an argument.
Definition: sox_ng.h:2487
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:1090
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:203
sox_error_t
Client API: The libSoX-specific error codes.
Definition: sox_ng.h:485
@ SOX_EPERM
Operation not permitted = 2003.
Definition: sox_ng.h:491
@ SOX_ENOMEM
Can't alloc memory = 2002.
Definition: sox_ng.h:490
@ SOX_EHDR
Invalid Audio Header = 2000.
Definition: sox_ng.h:488
@ SOX_ENOTSUP
Operation not supported = 2004.
Definition: sox_ng.h:492
@ SOX_EINVAL
Invalid argument = 2005.
Definition: sox_ng.h:493
@ SOX_SUCCESS
Function succeeded = 0.
Definition: sox_ng.h:486
@ SOX_EOF
End Of File or other error = -1.
Definition: sox_ng.h:487
@ SOX_EFMT
Unsupported data format = 2001.
Definition: sox_ng.h:489
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:575
@ sox_loop_none
single-shot = 0
Definition: sox_ng.h:576
@ sox_loop_sustain_decay
AIFF style, one sustain & one decay loop = 64.
Definition: sox_ng.h:580
@ sox_loop_8
8 loops (??) = 32
Definition: sox_ng.h:579
@ sox_loop_forward
forward loop = 1
Definition: sox_ng.h:577
@ sox_loop_forward_back
forward/back loop = 2
Definition: sox_ng.h:578
#define SOX_MAX_NLOOPS
Client API: Maximum number of loops supported by sox_oob_t = 8.
Definition: sox_ng.h:1014
LSX_RETURN_VALID_Z LSX_RETURN_PURE char const *LSX_API sox_version(void)
Client API: Returns version number string of libSoX, for example, "14.4.0".
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:76
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:265
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 LSX_API lsx_warn_impl(LSX_PARAM_IN_PRINTF char const *fmt,...) LSX_PRINTF12
Plugins API: Print a warning in libSoX.
#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:251
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:427
#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:100
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:1162
sox_encoding_t
Client API: Format of sample data.
Definition: sox_ng.h:513
@ SOX_ENCODING_DPCM
Differential PCM: Fasttracker 2 (xi)
Definition: sox_ng.h:533
@ SOX_ENCODING_G723
G.723 3 or 5 bit ADPCM.
Definition: sox_ng.h:527
@ SOX_ENCODING_OPUS
Opus compression.
Definition: sox_ng.h:543
@ SOX_ENCODING_SIGN2
signed linear 2's comp: Mac
Definition: sox_ng.h:516
@ SOX_ENCODING_AMR_WB
AMR-WB compression.
Definition: sox_ng.h:539
@ SOX_ENCODING_ALAW
A-law signed logs: non-US telephony, Psion.
Definition: sox_ng.h:525
@ SOX_ENCODINGS
End of list marker.
Definition: sox_ng.h:546
@ SOX_ENCODING_ULAW
u-law signed logs: US telephony, SPARC
Definition: sox_ng.h:524
@ SOX_ENCODING_WAVPACKF
WavPack with float samples.
Definition: sox_ng.h:523
@ SOX_ENCODING_UNKNOWN
encoding has not yet been determined
Definition: sox_ng.h:514
@ SOX_ENCODING_MP3
MP3 compression.
Definition: sox_ng.h:537
@ SOX_ENCODING_DSD
Direct Stream Digital.
Definition: sox_ng.h:544
@ SOX_ENCODING_G721
G.721 4-bit ADPCM.
Definition: sox_ng.h:526
@ SOX_ENCODING_CVSD
Continuously Variable Slope Delta modulation.
Definition: sox_ng.h:541
@ SOX_ENCODING_FLOAT_TEXT
floating point (text format)
Definition: sox_ng.h:519
@ SOX_ENCODING_MS_ADPCM
Microsoft Compressed PCM.
Definition: sox_ng.h:530
@ SOX_ENCODING_GSM
GSM 6.10 33byte frame lossy compression.
Definition: sox_ng.h:536
@ SOX_ENCODING_FLAC
FLAC compression.
Definition: sox_ng.h:520
@ SOX_ENCODING_DWVWN
Delta Width Variable Word N-bit.
Definition: sox_ng.h:535
@ SOX_ENCODING_VORBIS
Vorbis compression.
Definition: sox_ng.h:538
@ SOX_ENCODING_CL_ADPCM16
Creative Labs 16 --> 4 bit Compressed PCM.
Definition: sox_ng.h:529
@ SOX_ENCODING_UNSIGNED
unsigned linear: Sound Blaster
Definition: sox_ng.h:517
@ SOX_ENCODING_CL_ADPCM
Creative Labs 8 --> 2,3,4 bit Compressed PCM.
Definition: sox_ng.h:528
@ SOX_ENCODING_HCOM
Mac FSSD files with Huffman compression.
Definition: sox_ng.h:521
@ SOX_ENCODING_AMR_NB
AMR-NB compression.
Definition: sox_ng.h:540
@ SOX_ENCODING_DWVW
Delta Width Variable Word.
Definition: sox_ng.h:534
@ SOX_ENCODING_LPC10
Linear Predictive Coding.
Definition: sox_ng.h:542
@ SOX_ENCODING_WAVPACK
WavPack with integer samples.
Definition: sox_ng.h:522
@ SOX_ENCODING_FLOAT
floating point (binary format)
Definition: sox_ng.h:518
@ SOX_ENCODING_IMA_ADPCM
IMA Compressed PCM.
Definition: sox_ng.h:531
@ SOX_ENCODING_OKI_ADPCM
Dialogic/OKI Compressed PCM.
Definition: sox_ng.h:532
#define LSX_RETURN_OPT
Plugins API: Attribute applied to a function to indicate that the returned pointer may be null.
Definition: sox_ng.h:133
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:553
@ sox_encodings_lossy2
encode, decode, encode, decode: lossy twice = 2.
Definition: sox_ng.h:556
@ sox_encodings_none
no flags specified (implies lossless encoding) = 0.
Definition: sox_ng.h:554
@ sox_encodings_lossy1
encode, decode: lossy once = 1.
Definition: sox_ng.h:555
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:1252
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:1231
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:1649
int16_t sox_int16_t
Client API: Signed twos-complement 16-bit type.
Definition: sox_ng.h:391
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:1130
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:1098
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:89
sox_version_flags_t
Client API: Flags indicating whether optional features are present in this build of libSoX.
Definition: sox_ng.h:500
@ sox_version_have_threads
threads = 4.
Definition: sox_ng.h:504
@ sox_version_have_popen
popen = 1.
Definition: sox_ng.h:502
@ sox_version_have_memopen
memopen = 8.
Definition: sox_ng.h:505
@ sox_version_have_magic
magic = 2.
Definition: sox_ng.h:503
@ sox_version_none
No special features = 0.
Definition: sox_ng.h:501
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:1241
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:588
@ lsx_io_file
File is a real file = 0.
Definition: sox_ng.h:589
@ lsx_io_pipe
File is a pipe (no seeking) = 1.
Definition: sox_ng.h:590
@ lsx_io_url
File is a URL (no seeking) = 2.
Definition: sox_ng.h:591
double sox_rate_t
Client API: Samples per second is stored as a double.
Definition: sox_ng.h:448
#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:166
#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:226
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:1069
sox_plot_t
Client API: Type of plot.
Definition: sox_ng.h:563
@ sox_plot_octave
Octave plot = 1.
Definition: sox_ng.h:565
@ sox_plot_gnuplot
Gnuplot plot = 2.
Definition: sox_ng.h:566
@ sox_plot_off
No plot = 0.
Definition: sox_ng.h:564
@ sox_plot_data
Plot data = 3.
Definition: sox_ng.h:567
void LSX_API sox_trim_clear_start(LSX_PARAM_INOUT sox_effect_t *effp)
Client API: Clears the start of the trim to 0.
#define sox_globals
Client API: Deprecated macro that returns the structure with libSoX's global settings as an lvalue.
Definition: sox_ng.h:1631
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:379
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:313
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:1152
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:2319
char const * text
String name of enumeration.
Definition: sox_ng.h:2320
unsigned value
Integer value of enumeration.
Definition: sox_ng.h:2321
Plugins API: lsx_getopt session information (initialization data and state).
Definition: sox_ng.h:2517
char const * shortopts
IN shortopts: Short option characters.
Definition: sox_ng.h:2520
int opt
OUT optopt: Receives the option character that caused error.
Definition: sox_ng.h:2525
int lngind
OUT lngind: Receives the index of the matched long option or -1 if not a long option.
Definition: sox_ng.h:2527
char const * curpos
INOUT curpos: Maintains state between calls to lsx_getopt.
Definition: sox_ng.h:2523
int ind
INOUT optind: Maintains the index of next element to be processed.
Definition: sox_ng.h:2524
lsx_option_t const * longopts
IN longopts: Array of long option descriptors.
Definition: sox_ng.h:2521
char const * arg
OUT optarg: Receives the value of the option's argument.
Definition: sox_ng.h:2526
lsx_getopt_flags_t flags
IN flags: Flags for longonly and opterr.
Definition: sox_ng.h:2522
char *const * argv
IN argv: Array of arguments.
Definition: sox_ng.h:2519
int argc
IN argc: Number of arguments in argv.
Definition: sox_ng.h:2518
Plugins API: lsx_getopt long option descriptor.
Definition: sox_ng.h:2506
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:2508
int * flag
Flag to set if argument is present.
Definition: sox_ng.h:2509
char const * name
Name of the long option.
Definition: sox_ng.h:2507
int val
Value to put in flag if argument is present.
Definition: sox_ng.h:2510
Client API: Effect handler information.
Definition: sox_ng.h:1541
sox_effect_handler_kill kill
Called to shut down effect (called once per effect).
Definition: sox_ng.h:1551
char const * usage
Short explanation of parameters accepted by effect.
Definition: sox_ng.h:1543
sox_effect_handler_getopts getopts
Called to parse command-line arguments (called once per effect).
Definition: sox_ng.h:1546
sox_effect_handler_flow flow
Called to process samples.
Definition: sox_ng.h:1548
sox_effect_handler_drain drain
Called to finish getting output after input is complete.
Definition: sox_ng.h:1549
char const * name
Effect name.
Definition: sox_ng.h:1542
size_t priv_size
Size of private data SoX should pre-allocate for effect.
Definition: sox_ng.h:1552
sox_effect_handler_start start
Called to initialize effect (called once per flow).
Definition: sox_ng.h:1547
sox_effect_handler_stop stop
Called to shut down effect (called once per flow).
Definition: sox_ng.h:1550
char const *const * extra_usage
Additional lines of usage.
Definition: sox_ng.h:1544
unsigned int flags
Combination of SOX_EFF_* flags.
Definition: sox_ng.h:1545
Client API: Effect information.
Definition: sox_ng.h:1559
size_t flow
flow number
Definition: sox_ng.h:1568
sox_effects_globals_t * global_info
global effect parameters
Definition: sox_ng.h:1560
sox_encodinginfo_t const * out_encoding
Information about the outgoing data encoding.
Definition: sox_ng.h:1564
size_t flows
1 if MCHAN, number of chans otherwise
Definition: sox_ng.h:1567
sox_signalinfo_t out_signal
Information about the outgoing data stream.
Definition: sox_ng.h:1562
sox_encodinginfo_t const * in_encoding
Information about the incoming data encoding.
Definition: sox_ng.h:1563
sox_signalinfo_t in_signal
Information about the incoming data stream.
Definition: sox_ng.h:1561
void * priv
Effect's private data area (each flow has a separate copy)
Definition: sox_ng.h:1569
size_t imin
minimum input buffer content required for calling this effect's flow function; set via lsx_effect_set...
Definition: sox_ng.h:1574
sox_uint64_t clips
increment if clipping occurs
Definition: sox_ng.h:1566
sox_effect_handler_t handler
The handler for this effect.
Definition: sox_ng.h:1565
size_t oend
output buffer: one past valid data section (oend-obeg is length of current content)
Definition: sox_ng.h:1573
size_t obeg
output buffer: start of valid data section
Definition: sox_ng.h:1572
sox_sample_t * obuf
output buffer
Definition: sox_ng.h:1571
Client API: Chain of effects to be applied to a stream.
Definition: sox_ng.h:1581
sox_encodinginfo_t const * out_enc
Output encoding.
Definition: sox_ng.h:1586
sox_effect_t ** effects
Table of effects to be applied to a stream.
Definition: sox_ng.h:1582
sox_encodinginfo_t const * in_enc
Input encoding.
Definition: sox_ng.h:1585
size_t table_size
Size of effects table (including unused entries)
Definition: sox_ng.h:1588
sox_sample_t * il_buf
Channel interleave buffer.
Definition: sox_ng.h:1589
sox_effects_globals_t global_info
Copy of global effects settings.
Definition: sox_ng.h:1584
size_t length
Number of effects to be applied.
Definition: sox_ng.h:1583
Client API: Global parameters for effects.
Definition: sox_ng.h:1532
sox_plot_t plot
To help the user choose effect & options.
Definition: sox_ng.h:1533
sox_globals_t * global_info
Pointer to associated SoX globals.
Definition: sox_ng.h:1534
Client API: Encoding parameters.
Definition: sox_ng.h:1343
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:1360
sox_bool opposite_endian
If set to true, the format should reverse its default endianness.
Definition: sox_ng.h:1372
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:1367
sox_encoding_t encoding
format of sample numbers
Definition: sox_ng.h:1344
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:1353
double compression
compression factor (where applicable)
Definition: sox_ng.h:1346
unsigned bits_per_sample
0 if unknown or variable; uncompressed value if lossless; compressed value if lossy
Definition: sox_ng.h:1345
Client API: Basic information about an encoding.
Definition: sox_ng.h:1333
char const * name
encoding name.
Definition: sox_ng.h:1335
sox_encodings_flags_t flags
lossy once (lossy1), lossy twice (lossy2), or lossless (none).
Definition: sox_ng.h:1334
char const * desc
encoding description.
Definition: sox_ng.h:1336
Client API: File buffer info.
Definition: sox_ng.h:1402
char * buf
Pointer to data buffer.
Definition: sox_ng.h:1403
size_t pos
Position in buffer.
Definition: sox_ng.h:1406
size_t count
Count read into buffer.
Definition: sox_ng.h:1405
size_t size
Size of buffer in bytes.
Definition: sox_ng.h:1404
Client API: Handler structure defined by each format.
Definition: sox_ng.h:1413
unsigned const * write_formats
Array of values indicating the encodings and precisions supported for writing (encoding).
Definition: sox_ng.h:1437
sox_format_handler_stopwrite stopwrite
called to close writer (decoder); may be null if no closing necessary
Definition: sox_ng.h:1423
sox_format_handler_startread startread
called to initialize reader (decoder)
Definition: sox_ng.h:1418
sox_format_handler_stopread stopread
called to close reader (decoder); may be null if no closing necessary
Definition: sox_ng.h:1420
sox_format_handler_startwrite startwrite
called to initialize writer (encoder)
Definition: sox_ng.h:1421
sox_format_handler_write write
called to write (encode) a block of samples
Definition: sox_ng.h:1422
size_t priv_size
SoX will automatically allocate a buffer in which the handler can store data.
Definition: sox_ng.h:1452
sox_format_handler_read read
called to read (decode) a block of samples
Definition: sox_ng.h:1419
sox_format_handler_seek seek
called to reposition reader; may be null if not supported
Definition: sox_ng.h:1424
unsigned sox_lib_version_code
Checked on load; must be 1st in struct.
Definition: sox_ng.h:1414
unsigned int flags
File flags (SOX_FILE_* values).
Definition: sox_ng.h:1417
sox_rate_t const * write_rates
Array of sample rates (samples per second) supported for writing (encoding).
Definition: sox_ng.h:1443
char const *const * names
null-terminated array of filename extensions that are handled by this format
Definition: sox_ng.h:1416
char const * description
short description of format
Definition: sox_ng.h:1415
Client API: Information about a loaded format handler, including the format name and a function point...
Definition: sox_ng.h:1523
char * name
Name of format handler.
Definition: sox_ng.h:1524
sox_format_fn_t fn
Function to call to get format handler's information.
Definition: sox_ng.h:1525
Client API: Data passed to/from the format handler.
Definition: sox_ng.h:1472
char mode
Read or write mode ('r' or 'w')
Definition: sox_ng.h:1501
char sox_errstr[256]
Failure error text.
Definition: sox_ng.h:1505
sox_uint8_t * pending_bytes
Bytes read but not returned yet.
Definition: sox_ng.h:1508
char * filetype
Type of file, as determined by header inspection or libmagic.
Definition: sox_ng.h:1497
int sox_errno
Failure error code.
Definition: sox_ng.h:1504
sox_signalinfo_t signal
Signal specifications for reader (decoder) or writer (encoder): sample rate, number of channels,...
Definition: sox_ng.h:1487
sox_encodinginfo_t encoding
Encoding specifications for reader (decoder) or writer (encoder): encoding (sample format),...
Definition: sox_ng.h:1495
lsx_io_type io_type
Stores whether this is a file, pipe or URL.
Definition: sox_ng.h:1510
sox_oob_t oob
comments, instrument info, loop info (out-of-band data)
Definition: sox_ng.h:1498
void * priv
Format handler's private data area.
Definition: sox_ng.h:1514
sox_uint64_t olength
Samples * chans written to file.
Definition: sox_ng.h:1502
void * fp
File stream pointer.
Definition: sox_ng.h:1506
sox_bool seekable
Can seek on this file.
Definition: sox_ng.h:1499
sox_uint64_t clips
Incremented if clipping occurs.
Definition: sox_ng.h:1503
sox_format_handler_t handler
Format handler for this file.
Definition: sox_ng.h:1513
sox_bool last_byte_was_zero
The last byte written was a zero.
Definition: sox_ng.h:1500
sox_uint8_t * pending_buffer
Buffer of bytes read but not returned.
Definition: sox_ng.h:1507
size_t pending_count
How many bytes read but not returned.
Definition: sox_ng.h:1509
sox_uint64_t data_start
Offset at which headers end and sound data begins (set by lsx_check_read_params)
Definition: sox_ng.h:1512
sox_uint64_t tell_off
Current offset within file.
Definition: sox_ng.h:1511
char * filename
File name.
Definition: sox_ng.h:1473
Client API: Global parameters (for effects & formats), returned from the sox_get_globals function.
Definition: sox_ng.h:1283
sox_bool repeatable
true to use pre-determined timestamps and PRNG seed
Definition: sox_ng.h:1287
sox_bool use_threads
Private: true if client has requested parallel effects processing.
Definition: sox_ng.h:1308
size_t bufsiz
Default size (in bytes) used by libSoX for blocks of sample data.
Definition: sox_ng.h:1293
char * tmp_path
Private: client-configured path to use for temporary files.
Definition: sox_ng.h:1306
char const * stdout_in_use_by
Private: tracks the name of the handler currently using stdout.
Definition: sox_ng.h:1304
char const * stdin_in_use_by
Private: tracks the name of the handler currently using stdin.
Definition: sox_ng.h:1303
unsigned verbosity
messages are only written if globals.verbosity >= message.level
Definition: sox_ng.h:1285
size_t input_bufsiz
Default size (in bytes) used by libSoX for blocks of input sample data.
Definition: sox_ng.h:1299
sox_bool use_magic
Private: true if client has requested use of 'magic' file-type detection.
Definition: sox_ng.h:1307
sox_output_message_handler_t output_message_handler
client-specified message output callback
Definition: sox_ng.h:1286
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:1314
char const * subsystem
Private: tracks the name of the handler currently writing an output message.
Definition: sox_ng.h:1305
sox_int32_t ranqd1
Can be used to re-seed libSoX's PRNG.
Definition: sox_ng.h:1301
Client API: Instrument information.
Definition: sox_ng.h:1390
signed char MIDIlow
MIDI pitch-bend low range.
Definition: sox_ng.h:1392
unsigned nloops
number of active loops (max SOX_MAX_NLOOPS).
Definition: sox_ng.h:1395
signed char MIDInote
for unity pitch playback
Definition: sox_ng.h:1391
signed char MIDIhi
MIDI pitch-bend high range.
Definition: sox_ng.h:1393
unsigned char loopmode
0=no, 1=forward, 2=forward/back (see sox_loop_* values)
Definition: sox_ng.h:1394
Client API: Looping parameters (out-of-band data).
Definition: sox_ng.h:1379
sox_uint64_t length
length
Definition: sox_ng.h:1381
unsigned count
number of repeats, 0=forever
Definition: sox_ng.h:1382
sox_uint64_t start
first sample
Definition: sox_ng.h:1380
unsigned char type
0=no, 1=forward, 2=forward/back (see sox_loop_* for valid values).
Definition: sox_ng.h:1383
Client API: Comments, instrument info, loop info (out-of-band data).
Definition: sox_ng.h:1459
sox_comments_t comments
Comment strings in id=value format.
Definition: sox_ng.h:1461
sox_instrinfo_t instr
Instrument specification.
Definition: sox_ng.h:1462
Client API: Signal parameters; members should be set to SOX_UNSPEC (= 0) if unknown.
Definition: sox_ng.h:1321
unsigned channels
number of sound channels, 0 if unknown
Definition: sox_ng.h:1323
unsigned precision
bits per sample, 0 if unknown
Definition: sox_ng.h:1324
double * mult
Effects headroom multiplier; may be null.
Definition: sox_ng.h:1326
sox_uint64_t length
samples * chans in file, 0 if unknown, -1 if unspecified
Definition: sox_ng.h:1325
sox_rate_t rate
samples per second, 0 if unknown
Definition: sox_ng.h:1322
Client API: Information about a build of libSoX, returned from the sox_version_info function.
Definition: sox_ng.h:1266
char const * arch
arch, for example, "1248 48 44 L OMP"
Definition: sox_ng.h:1274
sox_version_flags_t flags
feature flags = popen | magic | threads | memopen
Definition: sox_ng.h:1268
char const * version
version string = sox_version(), for example, "14.4.0"
Definition: sox_ng.h:1270
sox_uint32_t version_code
version number = 0x140400
Definition: sox_ng.h:1269
char const * distro
distro or null = "DISTRO", for example, "Debian"
Definition: sox_ng.h:1272
char const * version_extra
version extra info or null = "PACKAGE_EXTRA", for example, "beta"
Definition: sox_ng.h:1271
size_t size
structure size = sizeof(sox_version_info_t)
Definition: sox_ng.h:1267
char const * compiler
compiler info or null, for example, "msvc 160040219"
Definition: sox_ng.h:1273