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 <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
479
495
507
512/* Must match the entries in formats.c:s_sox_encodings_info[] */
550
560
571
584
595
596/*****************************************************************************
597Macros:
598*****************************************************************************/
599
608#define SOX_LIB_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
609
616#define SOX_LIB_VERSION_CODE SOX_LIB_VERSION(14, 7, 0)
617
627#define SOX_INT_MIN(bits) (1 <<((bits)-1))
628
638#define SOX_INT_MAX(bits) (((unsigned)-1)>>(33-(bits)))
639
649#define SOX_UINT_MAX(bits) (SOX_INT_MIN(bits)|SOX_INT_MAX(bits))
650
655#define SOX_INT8_MAX SOX_INT_MAX(8)
656
661#define SOX_INT16_MAX SOX_INT_MAX(16)
662
667#define SOX_INT24_MAX SOX_INT_MAX(24)
668
673#define SOX_INT32_MAX SOX_INT_MAX(32)
674
679#define SOX_SAMPLE_PRECISION 32
680
685#define SOX_SAMPLE_MAX (sox_sample_t)SOX_INT_MAX(32)
686
691#define SOX_SAMPLE_MIN (sox_sample_t)SOX_INT_MIN(32)
692
693
694/* Conversions: Linear PCM <--> sox_sample_t
695 *
696 * I/O Input sox_sample_t Clips? Input sox_sample_t Clips?
697 * Format Minimum Minimum I O Maximum Maximum I O
698 * ------ --------- ------------ -- -- -------- ------------ -- --
699 * Float -inf -1 y n inf 1 - 5e-10 y n
700 * Int8 -128 -128 n n 127 127.9999999 n y
701 * Int16 -32768 -32768 n n 32767 32767.99998 n y
702 * Int24 -8388608 -8388608 n n 8388607 8388607.996 n y
703 * Int32 -2147483648 -2147483648 n n 2147483647 2147483647 n n
704 *
705 * Conversions are as accurate as possible (with rounding).
706 *
707 * Rounding: halves toward +inf, all others to nearest integer.
708 *
709 * Clips? shows whether on not there is the possibility of a conversion
710 * clipping to the minimum or maximum value when inputing from or outputing
711 * to a given type.
712 *
713 * Unsigned integers are converted to and from signed integers by flipping
714 * the upper-most bit then treating them as signed integers.
715 */
716
722#define SOX_SAMPLE_LOCALS sox_sample_t sox_macro_temp_sample LSX_UNUSED; \
723 double sox_macro_temp_double LSX_UNUSED
724
729#define SOX_SAMPLE_NEG SOX_INT_MIN(32)
730
739#define SOX_SAMPLE_TO_UNSIGNED(bits,d,clips) \
740 (sox_uint##bits##_t)(SOX_SAMPLE_TO_SIGNED(bits,d,clips)^SOX_INT_MIN(bits))
741
750#define SOX_SAMPLE_TO_SIGNED(bits,d,clips) \
751 (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))
752
760#define SOX_SIGNED_TO_SAMPLE(bits,d)((sox_sample_t)(d)<<(32-bits))
761
769#define SOX_UNSIGNED_TO_SAMPLE(bits,d)(SOX_SIGNED_TO_SAMPLE(bits,d)^SOX_SAMPLE_NEG)
770
778#define SOX_UNSIGNED_8BIT_TO_SAMPLE(d,clips) SOX_UNSIGNED_TO_SAMPLE(8,d)
779
787#define SOX_SIGNED_8BIT_TO_SAMPLE(d,clips) SOX_SIGNED_TO_SAMPLE(8,d)
788
796#define SOX_UNSIGNED_16BIT_TO_SAMPLE(d,clips) SOX_UNSIGNED_TO_SAMPLE(16,d)
797
805#define SOX_SIGNED_16BIT_TO_SAMPLE(d,clips) SOX_SIGNED_TO_SAMPLE(16,d)
806
814#define SOX_UNSIGNED_24BIT_TO_SAMPLE(d,clips) SOX_UNSIGNED_TO_SAMPLE(24,d)
815
823#define SOX_SIGNED_24BIT_TO_SAMPLE(d,clips) SOX_SIGNED_TO_SAMPLE(24,d)
824
832#define SOX_UNSIGNED_32BIT_TO_SAMPLE(d,clips) ((sox_sample_t)(d)^SOX_SAMPLE_NEG)
833
841#define SOX_SIGNED_32BIT_TO_SAMPLE(d,clips) (sox_sample_t)(d)
842
850#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)
851
859#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)
860
867#define SOX_SAMPLE_TO_UNSIGNED_8BIT(d,clips) SOX_SAMPLE_TO_UNSIGNED(8,d,clips)
868
875#define SOX_SAMPLE_TO_SIGNED_8BIT(d,clips) SOX_SAMPLE_TO_SIGNED(8,d,clips)
876
883#define SOX_SAMPLE_TO_UNSIGNED_16BIT(d,clips) SOX_SAMPLE_TO_UNSIGNED(16,d,clips)
884
891#define SOX_SAMPLE_TO_SIGNED_16BIT(d,clips) SOX_SAMPLE_TO_SIGNED(16,d,clips)
892
899#define SOX_SAMPLE_TO_UNSIGNED_24BIT(d,clips) SOX_SAMPLE_TO_UNSIGNED(24,d,clips)
900
907#define SOX_SAMPLE_TO_SIGNED_24BIT(d,clips) SOX_SAMPLE_TO_SIGNED(24,d,clips)
908
915#define SOX_SAMPLE_TO_UNSIGNED_32BIT(d,clips) (sox_uint32_t)((d)^SOX_SAMPLE_NEG)
916
923#define SOX_SAMPLE_TO_SIGNED_32BIT(d,clips) (sox_int32_t)(d)
924
931#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.))))
932
939#define SOX_SAMPLE_TO_FLOAT_64BIT(d,clips) ((d)*(1./(SOX_SAMPLE_MAX+1.)))
940
948#define SOX_SAMPLE_CLIP_COUNT(samp, clips) \
949 do { \
950 if (samp > SOX_SAMPLE_MAX) \
951 { samp = SOX_SAMPLE_MAX; clips++; } \
952 else if (samp < SOX_SAMPLE_MIN) \
953 { samp = SOX_SAMPLE_MIN; clips++; } \
954 } while (0)
955
964#define SOX_ROUND_CLIP_COUNT(d, clips) \
965 ((d) < 0? (d) <= SOX_SAMPLE_MIN - 0.5? ++(clips), SOX_SAMPLE_MIN: (d) - 0.5 \
966 : (d) >= SOX_SAMPLE_MAX + 0.5? ++(clips), SOX_SAMPLE_MAX: (d) + 0.5)
967
977#define SOX_INTEGER_CLIP_COUNT(bits,i,clips) ( \
978 (i) >(int)((unsigned)1 << ((bits)-1))- 1 ? ++(clips),((unsigned)1 << ((bits)-1))- 1 : \
979 (i) <(int)((unsigned)-1 << ((bits)-1)) ? ++(clips),(unsigned)-1 << ((bits)-1) : (i))
980
989#define SOX_16BIT_CLIP_COUNT(i,clips) SOX_INTEGER_CLIP_COUNT(16,i,clips)
990
999#define SOX_24BIT_CLIP_COUNT(i,clips) SOX_INTEGER_CLIP_COUNT(24,i,clips)
1000
1001#define SOX_SIZE_MAX ((size_t)(-1))
1003#define SOX_UNSPEC 0
1004#define SOX_UNKNOWN_LEN (sox_uint64_t)(-1)
1005#define SOX_IGNORE_LENGTH (sox_uint64_t)(-2)
1007#define SOX_DEFAULT_CHANNELS 2
1008#define SOX_DEFAULT_RATE 48000
1009#define SOX_DEFAULT_PRECISION 16
1010#define SOX_DEFAULT_ENCODING SOX_ENCODING_SIGN2
1012#define SOX_LOOP_NONE ((unsigned char)sox_loop_none)
1013#define SOX_LOOP_8 ((unsigned char)sox_loop_8)
1014#define SOX_LOOP_SUSTAIN_DECAY ((unsigned char)sox_loop_sustain_decay)
1016#define SOX_MAX_NLOOPS 8
1018#define SOX_FILE_NOSTDIO 0x0001
1019#define SOX_FILE_DEVICE 0x0002
1020#define SOX_FILE_PHONY 0x0004
1021#define SOX_FILE_REWIND 0x0008
1022#define SOX_FILE_BIT_REV 0x0010
1023#define SOX_FILE_NIB_REV 0x0020
1024#define SOX_FILE_ENDIAN 0x0040
1025#define SOX_FILE_ENDBIG 0x0080
1026#define SOX_FILE_MONO 0x0100
1027#define SOX_FILE_STEREO 0x0200
1028#define SOX_FILE_QUAD 0x0400
1030#define SOX_FILE_CHANS (SOX_FILE_MONO | SOX_FILE_STEREO | SOX_FILE_QUAD)
1031#define SOX_FILE_LIT_END (SOX_FILE_ENDIAN | 0)
1032#define SOX_FILE_BIG_END (SOX_FILE_ENDIAN | SOX_FILE_ENDBIG)
1034#define SOX_EFF_CHAN 1
1035#define SOX_EFF_RATE 2
1036#define SOX_EFF_PREC 4
1037#define SOX_EFF_LENGTH 8
1038#define SOX_EFF_MCHAN 16
1039#define SOX_EFF_NULL 32
1040#define SOX_EFF_DEPRECATED 64 /* No longer used */
1041#define SOX_EFF_GAIN 128
1042#define SOX_EFF_MODIFY 256
1043#define SOX_EFF_ALPHA 512 /* No longer used */
1044#define SOX_EFF_INTERNAL 1024
1051#define SOX_SEEK_SET 0
1052
1053/*****************************************************************************
1054Forward declarations:
1055*****************************************************************************/
1056
1057typedef struct sox_format sox_format_t;
1058typedef struct sox_effect sox_effect_t;
1059typedef struct sox_effect_handler sox_effect_handler_t;
1060typedef struct sox_format_handler sox_format_handler_t;
1061
1062/*****************************************************************************
1063Function pointers:
1064*****************************************************************************/
1065
1072 unsigned level,
1073 LSX_PARAM_IN_Z char const * filename,
1074 LSX_PARAM_IN_PRINTF char const * fmt,
1075 LSX_PARAM_IN va_list ap
1076 );
1077
1084typedef sox_format_handler_t const * (LSX_API * sox_format_fn_t)(void);
1085
1092typedef sox_effect_handler_t const * (LSX_API *sox_effect_fn_t)(void);
1093
1101 LSX_PARAM_INOUT sox_format_t * ft
1102 );
1103
1111 LSX_PARAM_INOUT sox_format_t * ft,
1113 size_t len
1114 );
1115
1123 LSX_PARAM_INOUT sox_format_t * ft
1124 );
1125
1133 LSX_PARAM_INOUT sox_format_t * ft
1134 );
1135
1143 LSX_PARAM_INOUT sox_format_t * ft,
1144 LSX_PARAM_IN_COUNT(len) sox_sample_t const * buf,
1145 size_t len
1146 );
1147
1155 LSX_PARAM_INOUT sox_format_t * ft
1156 );
1157
1165 LSX_PARAM_INOUT sox_format_t * ft,
1166 sox_uint64_t offset
1167 );
1168
1176 LSX_PARAM_INOUT sox_effect_t * effp,
1177 int argc,
1178 LSX_PARAM_IN_COUNT(argc) char *argv[]
1179 );
1180
1188 LSX_PARAM_INOUT sox_effect_t * effp
1189 );
1190
1198 LSX_PARAM_INOUT sox_effect_t * effp,
1199 LSX_PARAM_IN_COUNT(*isamp) sox_sample_t const * ibuf,
1200 LSX_PARAM_OUT_CAP_POST_COUNT(*osamp,*osamp) sox_sample_t * obuf,
1201 LSX_PARAM_INOUT size_t *isamp,
1202 LSX_PARAM_INOUT size_t *osamp
1203 );
1204
1212 LSX_PARAM_INOUT sox_effect_t * effp,
1213 LSX_PARAM_OUT_CAP_POST_COUNT(*osamp,*osamp) sox_sample_t *obuf,
1214 LSX_PARAM_INOUT size_t *osamp
1215 );
1216
1224 LSX_PARAM_INOUT sox_effect_t * effp
1225 );
1226
1234 LSX_PARAM_INOUT sox_effect_t * effp
1235 );
1236
1244 sox_bool all_done,
1245 void * client_data
1246 );
1247
1255 void * callback_data,
1256 LSX_PARAM_IN_Z char const * filename
1257 );
1258
1259/*****************************************************************************
1260Structures:
1261*****************************************************************************/
1262
1268typedef struct sox_version_info {
1269 size_t size;
1272 char const * version;
1273 char const * version_extra;
1274 char const * distro;
1275 char const * compiler;
1276 char const * arch;
1277 /* new info should be added at the end for version backwards-compatibility. */
1279
1319
1324typedef struct sox_signalinfo {
1326 unsigned channels;
1327 unsigned precision;
1329 double * mult;
1331
1341
1377
1382typedef struct sox_loopinfo {
1385 unsigned count;
1386 unsigned char type;
1388
1393typedef struct sox_instrinfo {
1394 signed char MIDInote;
1395 signed char MIDIlow;
1396 signed char MIDIhi;
1397 unsigned char loopmode;
1398 unsigned nloops;
1400
1405typedef struct sox_fileinfo {
1406 char *buf;
1407 size_t size;
1408 size_t count;
1409 size_t pos;
1411
1457
1462typedef struct sox_oob {
1463 /* Decoded: */
1468 /* TBD: Non-decoded chunks, etc: */
1469} sox_oob_t;
1470
1519
1526typedef struct sox_format_tab {
1527 char const *name;
1530
1539
1557
1568 sox_effect_handler_t handler;
1570 size_t flows;
1571 size_t flow;
1572 void * priv;
1573 /* The following items are private to the libSoX effects chain functions. */
1575 size_t obeg;
1576 size_t oend;
1577 size_t imin;
1578};
1579
1584typedef struct sox_effects_chain {
1585 sox_effect_t **effects;
1586 size_t length;
1590 /* The following items are private to the libSoX effects chain functions. */
1591 size_t table_size;
1594
1595/*****************************************************************************
1596Functions:
1597*****************************************************************************/
1598
1605char const *
1606LSX_API
1608
1615sox_version_info_t const *
1616LSX_API
1618
1626LSX_API
1628
1634#define sox_globals (*sox_get_globals())
1635
1644LSX_API
1646
1652#define sox_encodings_info (sox_get_encodings_info())
1653
1658void
1659LSX_API
1662 );
1663
1675unsigned
1676LSX_API
1678 sox_encoding_t encoding,
1679 unsigned bits_per_sample
1680 );
1681
1687size_t
1688LSX_API
1691 );
1692
1697void
1698LSX_API
1701 LSX_PARAM_IN_Z char const * item
1702 );
1703
1708void
1709LSX_API
1712 LSX_PARAM_IN_Z char const * items
1713 );
1714
1722LSX_API
1725 );
1726
1731void
1732LSX_API
1735 );
1736
1743char const *
1744LSX_API
1747 LSX_PARAM_IN_Z char const * id
1748 );
1749
1755int
1756LSX_API
1758
1763void
1764LSX_API
1766
1772int
1773LSX_API
1775
1781int
1782LSX_API
1784
1791sox_format_tab_t const *
1792LSX_API
1794
1799#define sox_format_fns (sox_get_format_fns())
1800
1807sox_format_t *
1808LSX_API
1810 LSX_PARAM_IN_Z char const * path,
1811 LSX_PARAM_IN_OPT sox_signalinfo_t const * signal,
1812 LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,
1813 LSX_PARAM_IN_OPT_Z char const * filetype
1814 );
1815
1822sox_format_t *
1823LSX_API
1825 LSX_PARAM_IN_BYTECOUNT(buffer_size) void * buffer,
1826 size_t buffer_size,
1827 LSX_PARAM_IN_OPT sox_signalinfo_t const * signal,
1828 LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,
1829 LSX_PARAM_IN_OPT_Z char const * filetype
1830 );
1831
1838LSX_API
1840 LSX_PARAM_IN_OPT_Z char const * path,
1841 LSX_PARAM_IN_OPT_Z char const * filetype,
1842 LSX_PARAM_IN sox_encodinginfo_t const * encoding
1843 );
1844
1851sox_format_handler_t const *
1852LSX_API
1854 LSX_PARAM_IN_OPT_Z char const * path,
1855 LSX_PARAM_IN_OPT_Z char const * filetype,
1856 LSX_PARAM_OUT_OPT char const * * filetype1
1857 );
1858
1865sox_format_t *
1866LSX_API
1868 LSX_PARAM_IN_Z char const * path,
1869 LSX_PARAM_IN sox_signalinfo_t const * signal,
1870 LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,
1871 LSX_PARAM_IN_OPT_Z char const * filetype,
1872 LSX_PARAM_IN_OPT sox_oob_t const * oob,
1873 LSX_PARAM_IN_OPT sox_bool (LSX_API * overwrite_permitted)(LSX_PARAM_IN_Z char const * filename)
1874 );
1875
1882sox_format_t *
1883LSX_API
1885 LSX_PARAM_OUT_BYTECAP(buffer_size) void * buffer,
1886 LSX_PARAM_IN size_t buffer_size,
1887 LSX_PARAM_IN sox_signalinfo_t const * signal,
1888 LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,
1889 LSX_PARAM_IN_OPT_Z char const * filetype,
1890 LSX_PARAM_IN_OPT sox_oob_t const * oob
1891 );
1892
1899sox_format_t *
1900LSX_API
1902 LSX_PARAM_OUT char * * buffer_ptr,
1903 LSX_PARAM_OUT size_t * buffer_size_ptr,
1904 LSX_PARAM_IN sox_signalinfo_t const * signal,
1905 LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,
1906 LSX_PARAM_IN_OPT_Z char const * filetype,
1907 LSX_PARAM_IN_OPT sox_oob_t const * oob
1908 );
1909
1915size_t
1916LSX_API
1918 LSX_PARAM_INOUT sox_format_t * ft,
1920 size_t len
1921 );
1922
1928size_t
1929LSX_API
1931 LSX_PARAM_INOUT sox_format_t * ft,
1932 LSX_PARAM_IN_COUNT(len) sox_sample_t const * buf,
1933 size_t len
1934 );
1935
1941int
1942LSX_API
1944 LSX_PARAM_INOUT sox_format_t * ft
1945 );
1946
1952int
1953LSX_API
1955 LSX_PARAM_INOUT sox_format_t * ft,
1956 sox_uint64_t offset,
1957 int whence
1958 );
1959
1966sox_format_handler_t const *
1967LSX_API
1969 LSX_PARAM_IN_Z char const * name,
1970 sox_bool ignore_devices
1971 );
1972
1980LSX_API
1982
1987#define sox_effects_globals (*sox_get_effects_globals())
1988
1995sox_effect_handler_t const *
1996LSX_API
1998 LSX_PARAM_IN_Z char const * name
1999 );
2000
2007sox_effect_t *
2008LSX_API
2010 LSX_PARAM_IN sox_effect_handler_t const * eh
2011 );
2012
2018int
2019LSX_API
2021 LSX_PARAM_IN sox_effect_t *effp,
2022 int argc,
2023 LSX_PARAM_IN_COUNT(argc) char * const argv[]
2024 );
2025
2032sox_effect_fn_t const *
2033LSX_API
2035
2040#define sox_effect_fns (sox_get_effect_fns())
2041
2049LSX_API
2051 LSX_PARAM_IN sox_encodinginfo_t const * in_enc,
2052 LSX_PARAM_IN sox_encodinginfo_t const * out_enc
2053 );
2054
2059void
2060LSX_API
2063 );
2064
2070int
2071LSX_API
2074 LSX_PARAM_INOUT sox_effect_t * effp,
2076 LSX_PARAM_IN sox_signalinfo_t const * out
2077 );
2078
2084int
2085LSX_API
2089 LSX_PARAM_IN_OPT void * client_data
2090 );
2091
2098LSX_API
2101 );
2102
2109LSX_API
2111 LSX_PARAM_INOUT_COUNT(effp->flows) sox_effect_t * effp
2112 );
2113
2118void
2119LSX_API
2122 LSX_PARAM_INOUT sox_effect_t * effp
2123 );
2124
2131sox_effect_t *
2132LSX_API
2135 );
2136
2141void
2142LSX_API
2144 LSX_PARAM_INOUT_COUNT(effp->flows) sox_effect_t *effp
2145 );
2146
2151void
2152LSX_API
2155 );
2156
2161void
2162LSX_API
2165 );
2166
2175LSX_API
2177 LSX_PARAM_IN sox_effect_t * effp
2178 );
2179
2184void
2185LSX_API
2187 LSX_PARAM_INOUT sox_effect_t * effp
2188 );
2189
2196LSX_API
2198 LSX_PARAM_IN_Z char const * filename
2199 );
2200
2206int
2207LSX_API
2210 void * p,
2211 LSX_PARAM_IN char const * const listname
2212 );
2213
2221char const *
2222LSX_API
2224 int sox_errno
2225 );
2226
2234size_t
2235LSX_API
2237 LSX_PARAM_OUT_Z_CAP_POST_COUNT(base_buffer_len,return) char * base_buffer,
2238 size_t base_buffer_len,
2239 LSX_PARAM_IN_Z char const * filename
2240 );
2241
2242/*****************************************************************************
2243Internal API:
2244WARNING - The items in this section are subject to instability. They only
2245exist in the public header because sox (the application) currently uses them.
2246These may be changed or removed in future versions of libSoX.
2247*****************************************************************************/
2248
2253void
2254LSX_API
2256 LSX_PARAM_IN_PRINTF char const * fmt,
2257 ...)
2259
2264void
2265LSX_API
2267 LSX_PARAM_IN_PRINTF char const * fmt,
2268 ...)
2270
2275void
2276LSX_API
2278 LSX_PARAM_IN_PRINTF char const * fmt,
2279 ...)
2281
2286void
2287LSX_API
2289 LSX_PARAM_IN_PRINTF char const * fmt,
2290 ...)
2292
2297#define lsx_fail sox_get_globals()->subsystem=__FILE__,lsx_fail_impl
2298
2303#define lsx_warn sox_get_globals()->subsystem=__FILE__,lsx_warn_impl
2304
2309#define lsx_report sox_get_globals()->subsystem=__FILE__,lsx_report_impl
2310
2315#define lsx_debug sox_get_globals()->subsystem=__FILE__,lsx_debug_impl
2316
2322typedef struct lsx_enum_item {
2323 char const *text;
2324 unsigned value;
2326
2334#define LSX_ENUM_ITEM(prefix, item) {#item, prefix##item},
2335
2340enum
2341{
2345
2352lsx_enum_item const *
2353LSX_API
2355 LSX_PARAM_IN_Z char const * text,
2356 LSX_PARAM_IN lsx_enum_item const * lsx_enum_items,
2357 int flags
2358 );
2359
2366lsx_enum_item const *
2367LSX_API
2369 unsigned value,
2370 LSX_PARAM_IN lsx_enum_item const * lsx_enum_items
2371 );
2372
2381int
2382LSX_API
2384 int c,
2385 LSX_PARAM_IN_Z char const * arg,
2386 LSX_PARAM_IN lsx_enum_item const * items
2387 );
2388
2396LSX_API
2398 LSX_PARAM_IN_Z char const * str,
2399 LSX_PARAM_IN_Z char const * end
2400 );
2401
2409char const *
2410LSX_API
2412 LSX_PARAM_IN_Z char const * pathname
2413 );
2414
2423char const *
2424LSX_API
2426 double number
2427 );
2428
2437char const *
2438LSX_API
2440 double percentage
2441 );
2442
2450void *
2451LSX_API
2453 LSX_PARAM_IN_OPT void *ptr,
2454 size_t newsize
2455 );
2456
2463int
2464LSX_API
2466 LSX_PARAM_IN_Z char const * s1,
2467 LSX_PARAM_IN_Z char const * s2
2468 );
2469
2476int
2477LSX_API
2479 LSX_PARAM_IN_Z char const * s1,
2480 LSX_PARAM_IN_Z char const * s2,
2481 size_t n
2482 );
2483
2490double
2491LSX_API
2493 LSX_PARAM_IN_Z char const * nptr,
2494 LSX_PARAM_OUT_OPT char ** endptr
2495 );
2496
2506
2516
2521typedef struct lsx_option {
2522 char const * name;
2524 int * flag;
2525 int val;
2526} lsx_option_t;
2527
2532typedef struct lsx_getopt {
2533 int argc;
2534 char * const * argv;
2535 char const * shortopts;
2538 char const * curpos;
2539 int ind;
2540 int opt;
2541 char const * arg;
2543} lsx_getopt_t;
2544
2549void
2550LSX_API
2552 LSX_PARAM_IN int argc,
2553 LSX_PARAM_IN_COUNT(argc) char * const * argv,
2554 LSX_PARAM_IN_Z char const * shortopts,
2555 LSX_PARAM_IN_OPT lsx_option_t const * longopts,
2557 LSX_PARAM_IN int first,
2559 );
2560
2572int
2573LSX_API
2576 );
2577
2584LSX_API
2586 LSX_PARAM_IN sox_format_t * ft
2587 );
2588
2589/* WARNING END */
2590
2591#if defined(__cplusplus)
2592}
2593#endif
2594
2595#endif /* SOX_H */
@ lsx_find_enum_item_none
Default parameters (case-insensitive).
Definition sox_ng.h:2342
@ lsx_find_enum_item_case_sensitive
Enable case-sensitive search.
Definition sox_ng.h:2343
#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:1175
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:1110
#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:1223
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:1197
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:2511
@ lsx_getopt_flag_none
no flags (no output, not long-only)
Definition sox_ng.h:2512
@ lsx_getopt_flag_longonly
if set, recognize -option as a long option
Definition sox_ng.h:2514
@ lsx_getopt_flag_opterr
if set, invalid options trigger lsx_warn output
Definition sox_ng.h:2513
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:1211
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:1987
#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:1122
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:1187
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:1084
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:1142
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.
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: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:2501
@ lsx_option_arg_optional
Option can optionally be followed by an argument.
Definition sox_ng.h:2504
@ lsx_option_arg_required
Option requires an argument.
Definition sox_ng.h:2503
@ lsx_option_arg_none
Option does not have an argument.
Definition sox_ng.h:2502
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:1092
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:577
@ sox_loop_none
single-shot = 0
Definition sox_ng.h:578
@ sox_loop_sustain_decay
AIFF style, one sustain & one decay loop = 64.
Definition sox_ng.h:582
@ sox_loop_8
8 loops (??) = 32
Definition sox_ng.h:581
@ sox_loop_forward
forward loop = 1
Definition sox_ng.h:579
@ sox_loop_forward_back
forward/back loop = 2
Definition sox_ng.h:580
#define SOX_MAX_NLOOPS
Client API: Maximum number of loops supported by sox_oob_t = 8.
Definition sox_ng.h:1016
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.
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: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:1164
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:545
@ 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:541
@ 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:548
@ 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
MPEG 1 Layer 3 compression.
Definition sox_ng.h:539
@ SOX_ENCODING_DSD
Direct Stream Digital.
Definition sox_ng.h:546
@ 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:543
@ SOX_ENCODING_FLOAT_TEXT
floating point (text format)
Definition sox_ng.h:519
@ SOX_ENCODING_MP1
MPEG 1 Layer 1 compression.
Definition sox_ng.h:537
@ 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:540
@ 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:542
@ SOX_ENCODING_DWVW
Delta Width Variable Word.
Definition sox_ng.h:534
@ SOX_ENCODING_LPC10
Linear Predictive Coding.
Definition sox_ng.h:544
@ 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_MP2
MPEG 1 Layer 2 compression.
Definition sox_ng.h:538
@ 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:555
@ sox_encodings_lossy2
encode, decode, encode, decode: lossy twice = 2.
Definition sox_ng.h:558
@ sox_encodings_none
no flags specified (implies lossless encoding) = 0.
Definition sox_ng.h:556
@ sox_encodings_lossy1
encode, decode: lossy once = 1.
Definition sox_ng.h:557
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:1254
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:1233
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:1652
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:1132
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:1100
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:1243
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:590
@ lsx_io_file
File is a real file = 0.
Definition sox_ng.h:591
@ lsx_io_pipe
File is a pipe (no seeking) = 1.
Definition sox_ng.h:592
@ lsx_io_url
File is a URL (no seeking) = 2.
Definition sox_ng.h:593
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:1071
sox_plot_t
Client API: Type of plot.
Definition sox_ng.h:565
@ sox_plot_octave
Octave plot = 1.
Definition sox_ng.h:567
@ sox_plot_gnuplot
Gnuplot plot = 2.
Definition sox_ng.h:568
@ sox_plot_off
No plot = 0.
Definition sox_ng.h:566
@ sox_plot_data
Plot data = 3.
Definition sox_ng.h:569
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:1634
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:1154
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:2322
char const * text
String name of enumeration.
Definition sox_ng.h:2323
unsigned value
Integer value of enumeration.
Definition sox_ng.h:2324
Plugins API: lsx_getopt session information (initialization data and state).
Definition sox_ng.h:2532
char const * shortopts
IN shortopts: Short option characters.
Definition sox_ng.h:2535
int opt
OUT optopt: Receives the option character that caused error.
Definition sox_ng.h:2540
int lngind
OUT lngind: Receives the index of the matched long option or -1 if not a long option.
Definition sox_ng.h:2542
char const * curpos
INOUT curpos: Maintains state between calls to lsx_getopt.
Definition sox_ng.h:2538
int ind
INOUT optind: Maintains the index of next element to be processed.
Definition sox_ng.h:2539
lsx_option_t const * longopts
IN longopts: Array of long option descriptors.
Definition sox_ng.h:2536
char const * arg
OUT optarg: Receives the value of the option's argument.
Definition sox_ng.h:2541
lsx_getopt_flags_t flags
IN flags: Flags for longonly and opterr.
Definition sox_ng.h:2537
char *const * argv
IN argv: Array of arguments.
Definition sox_ng.h:2534
int argc
IN argc: Number of arguments in argv.
Definition sox_ng.h:2533
Plugins API: lsx_getopt long option descriptor.
Definition sox_ng.h:2521
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:2523
int * flag
Flag to set if argument is present.
Definition sox_ng.h:2524
char const * name
Name of the long option.
Definition sox_ng.h:2522
int val
Value to put in flag if argument is present.
Definition sox_ng.h:2525
Client API: Effect handler information.
Definition sox_ng.h:1544
sox_effect_handler_kill kill
Called to shut down effect (called once per effect).
Definition sox_ng.h:1554
char const * usage
Short explanation of parameters accepted by effect.
Definition sox_ng.h:1546
sox_effect_handler_getopts getopts
Called to parse command-line arguments (called once per effect).
Definition sox_ng.h:1549
sox_effect_handler_flow flow
Called to process samples.
Definition sox_ng.h:1551
sox_effect_handler_drain drain
Called to finish getting output after input is complete.
Definition sox_ng.h:1552
char const * name
Effect name.
Definition sox_ng.h:1545
size_t priv_size
Size of private data SoX should pre-allocate for effect.
Definition sox_ng.h:1555
sox_effect_handler_start start
Called to initialize effect (called once per flow).
Definition sox_ng.h:1550
sox_effect_handler_stop stop
Called to shut down effect (called once per flow).
Definition sox_ng.h:1553
char const *const * extra_usage
Additional lines of usage.
Definition sox_ng.h:1547
unsigned int flags
Combination of SOX_EFF_* flags.
Definition sox_ng.h:1548
Client API: Effect information.
Definition sox_ng.h:1562
size_t flow
flow number
Definition sox_ng.h:1571
sox_effects_globals_t * global_info
global effect parameters
Definition sox_ng.h:1563
sox_encodinginfo_t const * out_encoding
Information about the outgoing data encoding.
Definition sox_ng.h:1567
size_t flows
1 if MCHAN, number of chans otherwise
Definition sox_ng.h:1570
sox_signalinfo_t out_signal
Information about the outgoing data stream.
Definition sox_ng.h:1565
sox_encodinginfo_t const * in_encoding
Information about the incoming data encoding.
Definition sox_ng.h:1566
sox_signalinfo_t in_signal
Information about the incoming data stream.
Definition sox_ng.h:1564
void * priv
Effect's private data area (each flow has a separate copy)
Definition sox_ng.h:1572
size_t imin
minimum input buffer content required for calling this effect's flow function; set via lsx_effect_set...
Definition sox_ng.h:1577
sox_uint64_t clips
increment if clipping occurs
Definition sox_ng.h:1569
sox_effect_handler_t handler
The handler for this effect.
Definition sox_ng.h:1568
size_t oend
output buffer: one past valid data section (oend-obeg is length of current content)
Definition sox_ng.h:1576
size_t obeg
output buffer: start of valid data section
Definition sox_ng.h:1575
sox_sample_t * obuf
output buffer
Definition sox_ng.h:1574
Client API: Chain of effects to be applied to a stream.
Definition sox_ng.h:1584
sox_encodinginfo_t const * out_enc
Output encoding.
Definition sox_ng.h:1589
sox_effect_t ** effects
Table of effects to be applied to a stream.
Definition sox_ng.h:1585
sox_encodinginfo_t const * in_enc
Input encoding.
Definition sox_ng.h:1588
size_t table_size
Size of effects table (including unused entries)
Definition sox_ng.h:1591
sox_sample_t * il_buf
Channel interleave buffer.
Definition sox_ng.h:1592
sox_effects_globals_t global_info
Copy of global effects settings.
Definition sox_ng.h:1587
size_t length
Number of effects to be applied.
Definition sox_ng.h:1586
Client API: Global parameters for effects.
Definition sox_ng.h:1535
sox_plot_t plot
To help the user choose effect & options.
Definition sox_ng.h:1536
sox_globals_t * global_info
Pointer to associated SoX globals.
Definition sox_ng.h:1537
Client API: Encoding parameters.
Definition sox_ng.h:1346
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:1363
sox_bool opposite_endian
If set to true, the format should reverse its default endianness.
Definition sox_ng.h:1375
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:1370
sox_encoding_t encoding
format of sample numbers
Definition sox_ng.h:1347
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:1356
double compression
compression factor (where applicable)
Definition sox_ng.h:1349
unsigned bits_per_sample
0 if unknown or variable; uncompressed value if lossless; compressed value if lossy
Definition sox_ng.h:1348
Client API: Basic information about an encoding.
Definition sox_ng.h:1336
char const * name
encoding name.
Definition sox_ng.h:1338
sox_encodings_flags_t flags
lossy once (lossy1), lossy twice (lossy2), or lossless (none).
Definition sox_ng.h:1337
char const * desc
encoding description.
Definition sox_ng.h:1339
Client API: File buffer info.
Definition sox_ng.h:1405
char * buf
Pointer to data buffer.
Definition sox_ng.h:1406
size_t pos
Position in buffer.
Definition sox_ng.h:1409
size_t count
Count read into buffer.
Definition sox_ng.h:1408
size_t size
Size of buffer in bytes.
Definition sox_ng.h:1407
Client API: Handler structure defined by each format.
Definition sox_ng.h:1416
unsigned const * write_formats
Array of values indicating the encodings and precisions supported for writing (encoding).
Definition sox_ng.h:1440
sox_format_handler_stopwrite stopwrite
called to close writer (decoder); may be null if no closing necessary
Definition sox_ng.h:1426
sox_format_handler_startread startread
called to initialize reader (decoder)
Definition sox_ng.h:1421
sox_format_handler_stopread stopread
called to close reader (decoder); may be null if no closing necessary
Definition sox_ng.h:1423
sox_format_handler_startwrite startwrite
called to initialize writer (encoder)
Definition sox_ng.h:1424
sox_format_handler_write write
called to write (encode) a block of samples
Definition sox_ng.h:1425
size_t priv_size
SoX will automatically allocate a buffer in which the handler can store data.
Definition sox_ng.h:1455
sox_format_handler_read read
called to read (decode) a block of samples
Definition sox_ng.h:1422
sox_format_handler_seek seek
called to reposition reader; may be null if not supported
Definition sox_ng.h:1427
unsigned sox_lib_version_code
Checked on load; must be 1st in struct.
Definition sox_ng.h:1417
unsigned int flags
File flags (SOX_FILE_* values).
Definition sox_ng.h:1420
sox_rate_t const * write_rates
Array of sample rates (samples per second) supported for writing (encoding).
Definition sox_ng.h:1446
char const *const * names
null-terminated array of filename extensions that are handled by this format
Definition sox_ng.h:1419
char const * description
short description of format
Definition sox_ng.h:1418
Client API: Information about a loaded format handler, including the format name and a function point...
Definition sox_ng.h:1526
char const * name
Name of format handler.
Definition sox_ng.h:1527
sox_format_fn_t fn
Function to call to get format handler's information.
Definition sox_ng.h:1528
Client API: Data passed to/from the format handler.
Definition sox_ng.h:1475
char mode
Read or write mode ('r' or 'w')
Definition sox_ng.h:1504
char sox_errstr[256]
Failure error text.
Definition sox_ng.h:1508
sox_uint8_t * pending_bytes
Bytes read but not returned yet.
Definition sox_ng.h:1511
char * filetype
Type of file, as determined by header inspection or libmagic.
Definition sox_ng.h:1500
int sox_errno
Failure error code.
Definition sox_ng.h:1507
sox_signalinfo_t signal
Signal specifications for reader (decoder) or writer (encoder): sample rate, number of channels,...
Definition sox_ng.h:1490
sox_encodinginfo_t encoding
Encoding specifications for reader (decoder) or writer (encoder): encoding (sample format),...
Definition sox_ng.h:1498
lsx_io_type io_type
Stores whether this is a file, pipe or URL.
Definition sox_ng.h:1513
sox_oob_t oob
comments, instrument info, loop info (out-of-band data)
Definition sox_ng.h:1501
void * priv
Format handler's private data area.
Definition sox_ng.h:1517
sox_uint64_t olength
Samples * chans written to file.
Definition sox_ng.h:1505
void * fp
File stream pointer.
Definition sox_ng.h:1509
sox_bool seekable
Can seek on this file.
Definition sox_ng.h:1502
sox_uint64_t clips
Incremented if clipping occurs.
Definition sox_ng.h:1506
sox_format_handler_t handler
Format handler for this file.
Definition sox_ng.h:1516
sox_bool last_byte_was_zero
The last byte written was a zero.
Definition sox_ng.h:1503
sox_uint8_t * pending_buffer
Buffer of bytes read but not returned.
Definition sox_ng.h:1510
size_t pending_count
How many bytes read but not returned.
Definition sox_ng.h:1512
sox_uint64_t data_start
Offset at which headers end and sound data begins (set by lsx_check_read_params)
Definition sox_ng.h:1515
sox_uint64_t tell_off
Current offset within file.
Definition sox_ng.h:1514
char * filename
File name.
Definition sox_ng.h:1476
Client API: Global parameters (for effects & formats), returned from the sox_get_globals function.
Definition sox_ng.h:1285
sox_bool repeatable
true to use pre-determined timestamps and PRNG seed
Definition sox_ng.h:1290
sox_bool use_threads
Private: true if client has requested parallel effects processing.
Definition sox_ng.h:1311
char * myname
argv[0]
Definition sox_ng.h:1287
size_t bufsiz
Default size (in bytes) used by libSoX for blocks of sample data.
Definition sox_ng.h:1296
char * tmp_path
Private: client-configured path to use for temporary files.
Definition sox_ng.h:1309
char const * stdout_in_use_by
Private: tracks the name of the handler currently using stdout.
Definition sox_ng.h:1307
char const * stdin_in_use_by
Private: tracks the name of the handler currently using stdin.
Definition sox_ng.h:1306
unsigned verbosity
messages are only written if globals.verbosity >= message.level
Definition sox_ng.h:1288
size_t input_bufsiz
Default size (in bytes) used by libSoX for blocks of input sample data.
Definition sox_ng.h:1302
sox_bool use_magic
Private: true if client has requested use of 'magic' file-type detection.
Definition sox_ng.h:1310
sox_output_message_handler_t output_message_handler
client-specified message output callback
Definition sox_ng.h:1289
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:1317
char const * subsystem
Private: tracks the name of the handler currently writing an output message.
Definition sox_ng.h:1308
sox_int32_t ranqd1
Can be used to re-seed libSoX's PRNG.
Definition sox_ng.h:1304
Client API: Instrument information.
Definition sox_ng.h:1393
signed char MIDIlow
MIDI pitch-bend low range.
Definition sox_ng.h:1395
unsigned nloops
number of active loops (max SOX_MAX_NLOOPS).
Definition sox_ng.h:1398
signed char MIDInote
for unity pitch playback
Definition sox_ng.h:1394
signed char MIDIhi
MIDI pitch-bend high range.
Definition sox_ng.h:1396
unsigned char loopmode
0=no, 1=forward, 2=forward/back (see sox_loop_* values)
Definition sox_ng.h:1397
Client API: Looping parameters (out-of-band data).
Definition sox_ng.h:1382
sox_uint64_t length
length
Definition sox_ng.h:1384
unsigned count
number of repeats, 0=forever
Definition sox_ng.h:1385
sox_uint64_t start
first sample
Definition sox_ng.h:1383
unsigned char type
0=no, 1=forward, 2=forward/back (see sox_loop_* for valid values).
Definition sox_ng.h:1386
Client API: Comments, instrument info, loop info (out-of-band data).
Definition sox_ng.h:1462
sox_comments_t comments
Comment strings in id=value format.
Definition sox_ng.h:1464
sox_instrinfo_t instr
Instrument specification.
Definition sox_ng.h:1465
Client API: Signal parameters; members should be set to SOX_UNSPEC (= 0) if unknown.
Definition sox_ng.h:1324
unsigned channels
number of sound channels, 0 if unknown
Definition sox_ng.h:1326
unsigned precision
bits per sample, 0 if unknown
Definition sox_ng.h:1327
double * mult
Effects headroom multiplier; may be null.
Definition sox_ng.h:1329
sox_uint64_t length
samples * chans in file, 0 if unknown, -1 if unspecified
Definition sox_ng.h:1328
sox_rate_t rate
samples per second, 0 if unknown
Definition sox_ng.h:1325
Client API: Information about a build of libSoX, returned from the sox_version_info function.
Definition sox_ng.h:1268
char const * arch
arch, for example, "1248 48 44 L OMP"
Definition sox_ng.h:1276
sox_version_flags_t flags
feature flags = popen | magic | threads | memopen
Definition sox_ng.h:1270
char const * version
version string = sox_version(), for example, "14.4.0"
Definition sox_ng.h:1272
sox_uint32_t version_code
version number = 0x140400
Definition sox_ng.h:1271
char const * distro
distro or null = "DISTRO", for example, "Debian"
Definition sox_ng.h:1274
char const * version_extra
version extra info or null = "PACKAGE_EXTRA", for example, "beta"
Definition sox_ng.h:1273
size_t size
structure size = sizeof(sox_version_info_t)
Definition sox_ng.h:1269
char const * compiler
compiler info or null, for example, "msvc 160040219"
Definition sox_ng.h:1275