SoX - Sound eXchange
Audio file processing tool.
sox.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#if defined __GNUC__
37#define LSX_GCC(maj, min) \
38 ((__GNUC__ > (maj)) || (__GNUC__ == (maj) && __GNUC_MINOR__ >= (min)))
39#else
40#define LSX_GCC(maj, min) 0
41#endif
42
43#if LSX_GCC(4,9)
44#define _Ret_ __attribute__ ((returns_nonnull))
45#define _Ret_valid_ _Ret_
46#define _Ret_z_ _Ret_
47#endif
48
49/*****************************************************************************
50API decoration macros:
51Mostly for documentation purposes. For some compilers, decorations also affect
52code generation, influence compiler warnings or activate compiler
53optimizations.
54*****************************************************************************/
55
61#if defined __GNUC__ && defined __i386__
62#define LSX_API __attribute__ ((cdecl)) /* libSoX function */
63#elif _MSC_VER
64#define LSX_API __cdecl /* libSoX function */
65#else
66#define LSX_API /* libSoX function */
67#endif
68
74#ifdef __GNUC__
75#define LSX_UNUSED __attribute__ ((unused)) /* Parameter or local variable is intentionally unused. */
76#else
77#define LSX_UNUSED /* Parameter or local variable is intentionally unused. */
78#endif
79
86#ifdef __GNUC__
87#define LSX_PRINTF12 __attribute__ ((format (printf, 1, 2))) /* Function has printf-style arguments. */
88#else
89#define LSX_PRINTF12 /* Function has printf-style arguments. */
90#endif
91
98#ifdef __GNUC__
99#define LSX_RETURN_PURE __attribute__ ((pure)) /* Function is pure. */
100#else
101#define LSX_RETURN_PURE /* Function is pure. */
102#endif
103
109#ifdef _Ret_
110#define LSX_RETURN_VALID _Ret_ /* Function always returns a valid object (never NULL). */
111#else
112#define LSX_RETURN_VALID /* Function always returns a valid object (never NULL). */
113#endif
114
120#ifdef _Ret_valid_
121#define LSX_RETURN_ARRAY _Ret_valid_ /* Function always returns a valid array (never NULL). */
122#else
123#define LSX_RETURN_ARRAY /* Function always returns a valid array (never NULL). */
124#endif
125
131#ifdef _Ret_z_
132#define LSX_RETURN_VALID_Z _Ret_z_ /* Function always returns a 0-terminated array (never NULL). */
133#else
134#define LSX_RETURN_VALID_Z /* Function always returns a 0-terminated array (never NULL). */
135#endif
136
142#ifdef _Ret_opt_
143#define LSX_RETURN_OPT _Ret_opt_ /* Function may return NULL. */
144#else
145#define LSX_RETURN_OPT /* Function may return NULL. */
146#endif
147
153#ifdef _In_
154#define LSX_PARAM_IN _In_ /* Required const pointer to a valid object (never NULL). */
155#else
156#define LSX_PARAM_IN /* Required const pointer to a valid object (never NULL). */
157#endif
158
164#ifdef _In_z_
165#define LSX_PARAM_IN_Z _In_z_ /* Required const pointer to 0-terminated string (never NULL). */
166#else
167#define LSX_PARAM_IN_Z /* Required const pointer to 0-terminated string (never NULL). */
168#endif
169
175#ifdef _Printf_format_string_
176#define LSX_PARAM_IN_PRINTF _Printf_format_string_ /* Required const pointer to 0-terminated printf format string (never NULL). */
177#else
178#define LSX_PARAM_IN_PRINTF /* Required const pointer to 0-terminated printf format string (never NULL). */
179#endif
180
188#ifdef _In_count_
189#define LSX_PARAM_IN_COUNT(len) _In_count_(len) /* Required const pointer to (len) valid objects (never NULL). */
190#else
191#define LSX_PARAM_IN_COUNT(len) /* Required const pointer to (len) valid objects (never NULL). */
192#endif
193
201#ifdef _In_bytecount_
202#define LSX_PARAM_IN_BYTECOUNT(len) _In_bytecount_(len) /* Required const pointer to (len) bytes of data (never NULL). */
203#else
204#define LSX_PARAM_IN_BYTECOUNT(len) /* Required const pointer to (len) bytes of data (never NULL). */
205#endif
206
212#ifdef _In_opt_
213#define LSX_PARAM_IN_OPT _In_opt_ /* Optional const pointer to a valid object (may be NULL). */
214#else
215#define LSX_PARAM_IN_OPT /* Optional const pointer to a valid object (may be NULL). */
216#endif
217
223#ifdef _In_opt_z_
224#define LSX_PARAM_IN_OPT_Z _In_opt_z_ /* Optional const pointer to 0-terminated string (may be NULL). */
225#else
226#define LSX_PARAM_IN_OPT_Z /* Optional const pointer to 0-terminated string (may be NULL). */
227#endif
228
235#ifdef _Inout_
236#define LSX_PARAM_INOUT _Inout_ /* Required pointer to a valid object (never NULL). */
237#else
238#define LSX_PARAM_INOUT /* Required pointer to a valid object (never NULL). */
239#endif
240
248#ifdef _Inout_count_x_
249#define LSX_PARAM_INOUT_COUNT(len) _Inout_count_x_(len) /* Required pointer to (len) valid objects (never NULL). */
250#else
251#define LSX_PARAM_INOUT_COUNT(len) /* Required pointer to (len) valid objects (never NULL). */
252#endif
253
260#ifdef _Out_
261#define LSX_PARAM_OUT _Out_ /* Required pointer to an object to be initialized (never NULL). */
262#else
263#define LSX_PARAM_OUT /* Required pointer to an object to be initialized (never NULL). */
264#endif
265
274#ifdef _Out_bytecap_
275#define LSX_PARAM_OUT_BYTECAP(len) _Out_bytecap_(len) /* Required pointer to writable buffer with room for len bytes. */
276#else
277#define LSX_PARAM_OUT_BYTECAP(len) /* Required pointer to writable buffer with room for len bytes. */
278#endif
279
292#ifdef _Out_cap_post_count_
293#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. */
294#else
295#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. */
296#endif
297
310#ifdef _Out_z_cap_post_count_
311#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. */
312#else
313#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. */
314#endif
315
322#ifdef _Out_opt_
323#define LSX_PARAM_OUT_OPT _Out_opt_ /* Optional pointer to an object to be initialized (may be NULL). */
324#else
325#define LSX_PARAM_OUT_OPT /* Optional pointer to an object to be initialized (may be NULL). */
326#endif
327
334#ifdef _Deref_pre_maybenull_
335#define LSX_PARAM_DEREF_PRE_MAYBENULL _Deref_pre_maybenull_ /* Required pointer (never NULL) to another pointer (may be NULL). */
336#else
337#define LSX_PARAM_DEREF_PRE_MAYBENULL /* Required pointer (never NULL) to another pointer (may be NULL). */
338#endif
339
346#ifdef _Deref_post_null_
347#define LSX_PARAM_DEREF_POST_NULL _Deref_post_null_ /* Required pointer (never NULL) to another pointer, which will be NULL on exit. */
348#else
349#define LSX_PARAM_DEREF_POST_NULL /* Required pointer (never NULL) to another pointer, which will be NULL on exit. */
350#endif
351
358#ifdef _Deref_post_notnull_
359#define LSX_PARAM_DEREF_POST_NOTNULL _Deref_post_notnull_ /* Required pointer (never NULL) to another pointer, which will be valid (not NULL) on exit. */
360#else
361#define LSX_PARAM_DEREF_POST_NOTNULL /* Required pointer (never NULL) to another pointer, which will be valid (not NULL) on exit. */
362#endif
363
369#ifdef _PREFAST_
370#define LSX_USE_VAR(x) ((void)(x=0)) /* During static analysis, initialize unused variables to 0. */
371#else
372#define LSX_USE_VAR(x) ((void)(x)) /* Parameter or variable is intentionally unused. */
373#endif
374
381#define lsx_static_assert(e,f) enum {lsx_static_assert_##f = 1/((e) ? 1 : 0)}
382
383/*****************************************************************************
384Basic typedefs:
385*****************************************************************************/
386
391typedef int8_t sox_int8_t;
392
397typedef uint8_t sox_uint8_t;
398
403typedef int16_t sox_int16_t;
404
409typedef uint16_t sox_uint16_t;
410
415typedef int32_t sox_int32_t;
416
421typedef uint32_t sox_uint32_t;
422
427typedef int64_t sox_int64_t;
428
433typedef uint64_t sox_uint64_t;
434
440
446
452
457typedef double sox_rate_t;
458
463typedef char * * sox_comments_t;
464
465/*****************************************************************************
466Enumerations:
467*****************************************************************************/
468
473typedef enum sox_bool {
474 sox_bool_dummy = -1, /* Ensure a signed type */
476 sox_true
478
483typedef enum sox_option_t {
488
496 SOX_EOF = -1,
497 SOX_EHDR = 2000,
504
516
521typedef enum sox_encoding_t {
555
565
570typedef enum sox_plot_t {
576
589
594typedef enum lsx_io_type
595{
600
601/*****************************************************************************
602Macros:
603*****************************************************************************/
604
613#define SOX_LIB_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
614
621#define SOX_LIB_VERSION_CODE SOX_LIB_VERSION(14, 4, 2)
622
632#define SOX_INT_MIN(bits) (1 <<((bits)-1))
633
643#define SOX_INT_MAX(bits) (((unsigned)-1)>>(33-(bits)))
644
654#define SOX_UINT_MAX(bits) (SOX_INT_MIN(bits)|SOX_INT_MAX(bits))
655
660#define SOX_INT8_MAX SOX_INT_MAX(8)
661
666#define SOX_INT16_MAX SOX_INT_MAX(16)
667
672#define SOX_INT24_MAX SOX_INT_MAX(24)
673
678#define SOX_INT32_MAX SOX_INT_MAX(32)
679
684#define SOX_SAMPLE_PRECISION 32
685
690#define SOX_SAMPLE_MAX (sox_sample_t)SOX_INT_MAX(32)
691
696#define SOX_SAMPLE_MIN (sox_sample_t)SOX_INT_MIN(32)
697
698
699/* Conversions: Linear PCM <--> sox_sample_t
700 *
701 * I/O Input sox_sample_t Clips? Input sox_sample_t Clips?
702 * Format Minimum Minimum I O Maximum Maximum I O
703 * ------ --------- ------------ -- -- -------- ------------ -- --
704 * Float -inf -1 y n inf 1 - 5e-10 y n
705 * Int8 -128 -128 n n 127 127.9999999 n y
706 * Int16 -32768 -32768 n n 32767 32767.99998 n y
707 * Int24 -8388608 -8388608 n n 8388607 8388607.996 n y
708 * Int32 -2147483648 -2147483648 n n 2147483647 2147483647 n n
709 *
710 * Conversions are as accurate as possible (with rounding).
711 *
712 * Rounding: halves toward +inf, all others to nearest integer.
713 *
714 * Clips? shows whether on not there is the possibility of a conversion
715 * clipping to the minimum or maximum value when inputing from or outputing
716 * to a given type.
717 *
718 * Unsigned integers are converted to and from signed integers by flipping
719 * the upper-most bit then treating them as signed integers.
720 */
721
727#define SOX_SAMPLE_LOCALS sox_sample_t sox_macro_temp_sample LSX_UNUSED; \
728 double sox_macro_temp_double LSX_UNUSED
729
734#define SOX_SAMPLE_NEG SOX_INT_MIN(32)
735
744#define SOX_SAMPLE_TO_UNSIGNED(bits,d,clips) \
745 (sox_uint##bits##_t)(SOX_SAMPLE_TO_SIGNED(bits,d,clips) ^ SOX_INT_MIN(bits))
746
755#define SOX_SAMPLE_TO_SIGNED(bits,d,clips) \
756 (sox_int##bits##_t)( \
757 LSX_USE_VAR(sox_macro_temp_double), \
758 sox_macro_temp_sample = (d), \
759 sox_macro_temp_sample > SOX_SAMPLE_MAX - (1 << (31-bits)) ? \
760 ++(clips), SOX_INT_MAX(bits) : \
761 ((sox_uint32_t)(sox_macro_temp_sample + (1 << (31-bits)))) >> (32-bits))
762
770#define SOX_SIGNED_TO_SAMPLE(bits,d) ((sox_sample_t)(d) << (32-bits))
771
779#define SOX_UNSIGNED_TO_SAMPLE(bits,d) \
780 (SOX_SIGNED_TO_SAMPLE(bits,d) ^ SOX_SAMPLE_NEG)
781
789#define SOX_UNSIGNED_8BIT_TO_SAMPLE(d,clips) SOX_UNSIGNED_TO_SAMPLE(8,d)
790
798#define SOX_SIGNED_8BIT_TO_SAMPLE(d,clips) SOX_SIGNED_TO_SAMPLE(8,d)
799
807#define SOX_UNSIGNED_16BIT_TO_SAMPLE(d,clips) SOX_UNSIGNED_TO_SAMPLE(16,d)
808
816#define SOX_SIGNED_16BIT_TO_SAMPLE(d,clips) SOX_SIGNED_TO_SAMPLE(16,d)
817
825#define SOX_UNSIGNED_24BIT_TO_SAMPLE(d,clips) SOX_UNSIGNED_TO_SAMPLE(24,d)
826
834#define SOX_SIGNED_24BIT_TO_SAMPLE(d,clips) SOX_SIGNED_TO_SAMPLE(24,d)
835
843#define SOX_UNSIGNED_32BIT_TO_SAMPLE(d,clips) \
844 ((sox_sample_t)(d) ^ SOX_SAMPLE_NEG)
845
853#define SOX_SIGNED_32BIT_TO_SAMPLE(d,clips) (sox_sample_t)(d)
854
862#define SOX_FLOAT_32BIT_TO_SAMPLE(d,clips) SOX_FLOAT_64BIT_TO_SAMPLE(d, clips)
863
871#define SOX_FLOAT_64BIT_TO_SAMPLE(d, clips) \
872 (sox_sample_t)( \
873 LSX_USE_VAR(sox_macro_temp_sample), \
874 sox_macro_temp_double = (d) * (SOX_SAMPLE_MAX + 1.0), \
875 sox_macro_temp_double < 0 ? \
876 sox_macro_temp_double <= SOX_SAMPLE_MIN - 0.5 ? \
877 ++(clips), SOX_SAMPLE_MIN : \
878 sox_macro_temp_double - 0.5 : \
879 sox_macro_temp_double >= SOX_SAMPLE_MAX + 0.5 ? \
880 sox_macro_temp_double > SOX_SAMPLE_MAX + 1.0 ? \
881 ++(clips), SOX_SAMPLE_MAX : \
882 SOX_SAMPLE_MAX : \
883 sox_macro_temp_double + 0.5 \
884 )
885
892#define SOX_SAMPLE_TO_UNSIGNED_8BIT(d,clips) SOX_SAMPLE_TO_UNSIGNED(8,d,clips)
893
900#define SOX_SAMPLE_TO_SIGNED_8BIT(d,clips) SOX_SAMPLE_TO_SIGNED(8,d,clips)
901
908#define SOX_SAMPLE_TO_UNSIGNED_16BIT(d,clips) SOX_SAMPLE_TO_UNSIGNED(16,d,clips)
909
916#define SOX_SAMPLE_TO_SIGNED_16BIT(d,clips) SOX_SAMPLE_TO_SIGNED(16,d,clips)
917
924#define SOX_SAMPLE_TO_UNSIGNED_24BIT(d,clips) SOX_SAMPLE_TO_UNSIGNED(24,d,clips)
925
932#define SOX_SAMPLE_TO_SIGNED_24BIT(d,clips) SOX_SAMPLE_TO_SIGNED(24,d,clips)
933
940#define SOX_SAMPLE_TO_UNSIGNED_32BIT(d,clips) (sox_uint32_t)((d)^SOX_SAMPLE_NEG)
941
948#define SOX_SAMPLE_TO_SIGNED_32BIT(d,clips) (sox_int32_t)(d)
949
956#define SOX_SAMPLE_TO_FLOAT_32BIT(d,clips) ((d)*(1.0 / (SOX_SAMPLE_MAX + 1.0)))
957
964#define SOX_SAMPLE_TO_FLOAT_64BIT(d,clips) ((d)*(1.0 / (SOX_SAMPLE_MAX + 1.0)))
965
973#define SOX_SAMPLE_CLIP_COUNT(samp, clips) \
974 do { \
975 if (samp > SOX_SAMPLE_MAX) \
976 { samp = SOX_SAMPLE_MAX; clips++; } \
977 else if (samp < SOX_SAMPLE_MIN) \
978 { samp = SOX_SAMPLE_MIN; clips++; } \
979 } while (0)
980
989#define SOX_ROUND_CLIP_COUNT(d, clips) \
990 ((d) < 0? (d) <= SOX_SAMPLE_MIN - 0.5? ++(clips), SOX_SAMPLE_MIN: (d) - 0.5 \
991 : (d) >= SOX_SAMPLE_MAX + 0.5? ++(clips), SOX_SAMPLE_MAX: (d) + 0.5)
992
1002#define SOX_INTEGER_CLIP_COUNT(bits,i,clips) ( \
1003 (i) >(1 << ((bits)-1))- 1? ++(clips),(1 << ((bits)-1))- 1 : \
1004 (i) <-1 << ((bits)-1) ? ++(clips),-1 << ((bits)-1) : (i))
1005
1014#define SOX_16BIT_CLIP_COUNT(i,clips) SOX_INTEGER_CLIP_COUNT(16,i,clips)
1015
1024#define SOX_24BIT_CLIP_COUNT(i,clips) SOX_INTEGER_CLIP_COUNT(24,i,clips)
1025
1026#define SOX_SIZE_MAX ((size_t)(-1))
1028#define SOX_UNSPEC 0
1029#define SOX_UNKNOWN_LEN (sox_uint64_t)(-1)
1030#define SOX_IGNORE_LENGTH (sox_uint64_t)(-2)
1032#define SOX_DEFAULT_CHANNELS 2
1033#define SOX_DEFAULT_RATE 48000
1034#define SOX_DEFAULT_PRECISION 16
1035#define SOX_DEFAULT_ENCODING SOX_ENCODING_SIGN2
1037#define SOX_LOOP_NONE ((unsigned char)sox_loop_none)
1038#define SOX_LOOP_8 ((unsigned char)sox_loop_8)
1039#define SOX_LOOP_SUSTAIN_DECAY ((unsigned char)sox_loop_sustain_decay)
1041#define SOX_MAX_NLOOPS 8
1043#define SOX_FILE_NOSTDIO 0x0001
1044#define SOX_FILE_DEVICE 0x0002
1045#define SOX_FILE_PHONY 0x0004
1046#define SOX_FILE_REWIND 0x0008
1047#define SOX_FILE_BIT_REV 0x0010
1048#define SOX_FILE_NIB_REV 0x0020
1049#define SOX_FILE_ENDIAN 0x0040
1050#define SOX_FILE_ENDBIG 0x0080
1051#define SOX_FILE_MONO 0x0100
1052#define SOX_FILE_STEREO 0x0200
1053#define SOX_FILE_QUAD 0x0400
1055#define SOX_FILE_CHANS (SOX_FILE_MONO | SOX_FILE_STEREO | SOX_FILE_QUAD)
1056#define SOX_FILE_LIT_END (SOX_FILE_ENDIAN | 0)
1057#define SOX_FILE_BIG_END (SOX_FILE_ENDIAN | SOX_FILE_ENDBIG)
1059#define SOX_EFF_CHAN 1
1060#define SOX_EFF_RATE 2
1061#define SOX_EFF_PREC 4
1062#define SOX_EFF_LENGTH 8
1063#define SOX_EFF_MCHAN 16
1064#define SOX_EFF_NULL 32
1065#define SOX_EFF_DEPRECATED 64
1066#define SOX_EFF_GAIN 128
1067#define SOX_EFF_MODIFY 256
1068#define SOX_EFF_ALPHA 512
1069#define SOX_EFF_INTERNAL 1024
1076#define SOX_SEEK_SET 0
1077
1078/*****************************************************************************
1079Forward declarations:
1080*****************************************************************************/
1081
1082typedef struct sox_format_t sox_format_t;
1083typedef struct sox_effect_t sox_effect_t;
1086
1087/*****************************************************************************
1088Function pointers:
1089*****************************************************************************/
1090
1097 unsigned level,
1098 LSX_PARAM_IN_Z char const * filename,
1099 LSX_PARAM_IN_PRINTF char const * fmt,
1100 LSX_PARAM_IN va_list ap
1101 );
1102
1110
1118
1127 );
1128
1138 size_t len
1139 );
1140
1149 );
1150
1159 );
1160
1169 LSX_PARAM_IN_COUNT(len) sox_sample_t const * buf,
1170 size_t len
1171 );
1172
1181 );
1182
1191 sox_uint64_t offset
1192 );
1193
1202 int argc,
1203 LSX_PARAM_IN_COUNT(argc) char *argv[]
1204 );
1205
1214 );
1215
1224 LSX_PARAM_IN_COUNT(*isamp) sox_sample_t const * ibuf,
1225 LSX_PARAM_OUT_CAP_POST_COUNT(*osamp,*osamp) sox_sample_t * obuf,
1226 LSX_PARAM_INOUT size_t *isamp,
1227 LSX_PARAM_INOUT size_t *osamp
1228 );
1229
1238 LSX_PARAM_OUT_CAP_POST_COUNT(*osamp,*osamp) sox_sample_t *obuf,
1239 LSX_PARAM_INOUT size_t *osamp
1240 );
1241
1250 );
1251
1260 );
1261
1269 sox_bool all_done,
1270 void * client_data
1271 );
1272
1280 void * callback_data,
1281 LSX_PARAM_IN_Z char const * filename
1282 );
1283
1284/*****************************************************************************
1285Structures:
1286*****************************************************************************/
1287
1293typedef struct sox_version_info_t {
1294 size_t size;
1297 char const * version;
1298 char const * version_extra;
1299 char const * time;
1300 char const * distro;
1301 char const * compiler;
1302 char const * arch;
1303 /* new info should be added at the end for version backwards-compatibility. */
1305
1311typedef struct sox_globals_t {
1312/* public: */
1313 unsigned verbosity;
1321 size_t bufsiz;
1322
1328
1331 char const * stdin_in_use_by;
1332 char const * stdout_in_use_by;
1333 char const * subsystem;
1334 char * tmp_path;
1344
1349typedef struct sox_signalinfo_t {
1351 unsigned channels;
1352 unsigned precision;
1354 double * mult;
1356
1361typedef struct sox_encodings_info_t {
1363 char const * name;
1364 char const * desc;
1366
1371typedef struct sox_encodinginfo_t {
1382
1389
1396
1402
1407typedef struct sox_loopinfo_t {
1410 unsigned count;
1411 unsigned char type;
1413
1418typedef struct sox_instrinfo_t{
1419 signed char MIDInote;
1420 signed char MIDIlow;
1421 signed char MIDIhi;
1422 unsigned char loopmode;
1423 unsigned nloops;
1425
1430typedef struct sox_fileinfo_t {
1431 char *buf;
1432 size_t size;
1433 size_t count;
1434 size_t pos;
1436
1443 char const * description;
1444 char const * const * names;
1445 unsigned int flags;
1465 unsigned const * write_formats;
1466
1472
1481};
1482
1487typedef struct sox_oob_t{
1488 /* Decoded: */
1493 /* TBD: Non-decoded chunks, etc: */
1494} sox_oob_t;
1495
1501 char * filename;
1516
1524
1525 char * filetype;
1528 char mode;
1532 char sox_errstr[256];
1533 void * fp;
1538 void * priv;
1539};
1540
1547typedef struct sox_format_tab_t {
1548 char *name;
1551
1560
1566 char const * name;
1567 char const * usage;
1568 unsigned int flags;
1575 size_t priv_size;
1576};
1577
1590 size_t flows;
1591 size_t flow;
1592 void * priv;
1593 /* The following items are private to the libSoX effects chain functions. */
1595 size_t obeg;
1596 size_t oend;
1597 size_t imin;
1598};
1599
1604typedef struct sox_effects_chain_t {
1606 size_t length;
1610 /* The following items are private to the libSoX effects chain functions. */
1611 size_t table_size;
1614
1615/*****************************************************************************
1616Functions:
1617*****************************************************************************/
1618
1625char const *
1626LSX_API
1628
1635sox_version_info_t const *
1636LSX_API
1638
1646LSX_API
1648
1654#define sox_globals (*sox_get_globals())
1655
1664LSX_API
1666
1672#define sox_encodings_info (sox_get_encodings_info())
1673
1678void
1679LSX_API
1682 );
1683
1695unsigned
1696LSX_API
1698 sox_encoding_t encoding,
1699 unsigned bits_per_sample
1700 );
1701
1707size_t
1708LSX_API
1711 );
1712
1717void
1718LSX_API
1721 LSX_PARAM_IN_Z char const * item
1722 );
1723
1728void
1729LSX_API
1732 LSX_PARAM_IN_Z char const * items
1733 );
1734
1742LSX_API
1745 );
1746
1751void
1752LSX_API
1755 );
1756
1763char const *
1764LSX_API
1767 LSX_PARAM_IN_Z char const * id
1768 );
1769
1775int
1776LSX_API
1778
1783void
1784LSX_API
1786
1792int
1793LSX_API
1795
1801int
1802LSX_API
1804
1811sox_format_tab_t const *
1812LSX_API
1814
1819#define sox_format_fns (sox_get_format_fns())
1820
1828LSX_API
1830 LSX_PARAM_IN_Z char const * path,
1831 LSX_PARAM_IN_OPT sox_signalinfo_t const * signal,
1832 LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,
1833 LSX_PARAM_IN_OPT_Z char const * filetype
1834 );
1835
1843LSX_API
1845 LSX_PARAM_IN_BYTECOUNT(buffer_size) void * buffer,
1846 size_t buffer_size,
1847 LSX_PARAM_IN_OPT sox_signalinfo_t const * signal,
1848 LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,
1849 LSX_PARAM_IN_OPT_Z char const * filetype
1850 );
1851
1858LSX_API
1860 LSX_PARAM_IN_OPT_Z char const * path,
1861 LSX_PARAM_IN_OPT_Z char const * filetype,
1862 LSX_PARAM_IN sox_encodinginfo_t const * encoding
1863 );
1864
1872LSX_API
1874 LSX_PARAM_IN_OPT_Z char const * path,
1875 LSX_PARAM_IN_OPT_Z char const * filetype,
1876 LSX_PARAM_OUT_OPT char const * * filetype1
1877 );
1878
1886LSX_API
1888 LSX_PARAM_IN_Z char const * path,
1889 LSX_PARAM_IN sox_signalinfo_t const * signal,
1890 LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,
1891 LSX_PARAM_IN_OPT_Z char const * filetype,
1892 LSX_PARAM_IN_OPT sox_oob_t const * oob,
1893 LSX_PARAM_IN_OPT sox_bool (LSX_API * overwrite_permitted)(LSX_PARAM_IN_Z char const * filename)
1894 );
1895
1903LSX_API
1905 LSX_PARAM_OUT_BYTECAP(buffer_size) void * buffer,
1906 LSX_PARAM_IN size_t buffer_size,
1907 LSX_PARAM_IN sox_signalinfo_t const * signal,
1908 LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,
1909 LSX_PARAM_IN_OPT_Z char const * filetype,
1910 LSX_PARAM_IN_OPT sox_oob_t const * oob
1911 );
1912
1920LSX_API
1922 LSX_PARAM_OUT char * * buffer_ptr,
1923 LSX_PARAM_OUT size_t * buffer_size_ptr,
1924 LSX_PARAM_IN sox_signalinfo_t const * signal,
1925 LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding,
1926 LSX_PARAM_IN_OPT_Z char const * filetype,
1927 LSX_PARAM_IN_OPT sox_oob_t const * oob
1928 );
1929
1935size_t
1936LSX_API
1940 size_t len
1941 );
1942
1948size_t
1949LSX_API
1952 LSX_PARAM_IN_COUNT(len) sox_sample_t const * buf,
1953 size_t len
1954 );
1955
1961int
1962LSX_API
1965 );
1966
1972int
1973LSX_API
1976 sox_uint64_t offset,
1977 int whence
1978 );
1979
1987LSX_API
1989 LSX_PARAM_IN_Z char const * name,
1990 sox_bool ignore_devices
1991 );
1992
2000LSX_API
2002
2007#define sox_effects_globals (*sox_get_effects_globals())
2008
2016LSX_API
2018 LSX_PARAM_IN_Z char const * name
2019 );
2020
2028LSX_API
2031 );
2032
2038int
2039LSX_API
2042 int argc,
2043 LSX_PARAM_IN_COUNT(argc) char * const argv[]
2044 );
2045
2052sox_effect_fn_t const *
2053LSX_API
2055
2060#define sox_effect_fns (sox_get_effect_fns())
2061
2069LSX_API
2071 LSX_PARAM_IN sox_encodinginfo_t const * in_enc,
2072 LSX_PARAM_IN sox_encodinginfo_t const * out_enc
2073 );
2074
2079void
2080LSX_API
2083 );
2084
2090int
2091LSX_API
2096 LSX_PARAM_IN sox_signalinfo_t const * out
2097 );
2098
2104int
2105LSX_API
2109 LSX_PARAM_IN_OPT void * client_data
2110 );
2111
2118LSX_API
2121 );
2122
2129LSX_API
2131 LSX_PARAM_INOUT_COUNT(effp->flows) sox_effect_t * effp
2132 );
2133
2138void
2139LSX_API
2143 );
2144
2152LSX_API
2155 );
2156
2161void
2162LSX_API
2164 LSX_PARAM_INOUT_COUNT(effp->flows) sox_effect_t *effp
2165 );
2166
2171void
2172LSX_API
2175 );
2176
2181void
2182LSX_API
2185 );
2186
2195LSX_API
2198 );
2199
2204void
2205LSX_API
2208 );
2209
2216LSX_API
2218 LSX_PARAM_IN_Z char const * filename
2219 );
2220
2226int
2227LSX_API
2230 void * p,
2231 LSX_PARAM_IN char const * const listname
2232 );
2233
2241char const *
2242LSX_API
2244 int sox_errno
2245 );
2246
2254size_t
2255LSX_API
2257 LSX_PARAM_OUT_Z_CAP_POST_COUNT(base_buffer_len,return) char * base_buffer,
2258 size_t base_buffer_len,
2259 LSX_PARAM_IN_Z char const * filename
2260 );
2261
2262/*****************************************************************************
2263Internal API:
2264WARNING - The items in this section are subject to instability. They only
2265exist in the public header because sox (the application) currently uses them.
2266These may be changed or removed in future versions of libSoX.
2267*****************************************************************************/
2268
2273void
2274LSX_API
2276 LSX_PARAM_IN_PRINTF char const * fmt,
2277 ...)
2279
2284void
2285LSX_API
2287 LSX_PARAM_IN_PRINTF char const * fmt,
2288 ...)
2290
2295void
2296LSX_API
2298 LSX_PARAM_IN_PRINTF char const * fmt,
2299 ...)
2301
2306void
2307LSX_API
2309 LSX_PARAM_IN_PRINTF char const * fmt,
2310 ...)
2312
2317#define lsx_fail sox_get_globals()->subsystem=__FILE__,lsx_fail_impl
2318
2323#define lsx_warn sox_get_globals()->subsystem=__FILE__,lsx_warn_impl
2324
2329#define lsx_report sox_get_globals()->subsystem=__FILE__,lsx_report_impl
2330
2335#define lsx_debug sox_get_globals()->subsystem=__FILE__,lsx_debug_impl
2336
2342typedef struct lsx_enum_item {
2343 char const *text;
2344 unsigned value;
2346
2354#define LSX_ENUM_ITEM(prefix, item) {#item, prefix##item},
2355
2360enum
2361{
2365
2372lsx_enum_item const *
2373LSX_API
2375 LSX_PARAM_IN_Z char const * text,
2376 LSX_PARAM_IN lsx_enum_item const * lsx_enum_items,
2377 int flags
2378 );
2379
2386lsx_enum_item const *
2387LSX_API
2389 unsigned value,
2390 LSX_PARAM_IN lsx_enum_item const * lsx_enum_items
2391 );
2392
2401int
2402LSX_API
2404 int c,
2405 LSX_PARAM_IN_Z char const * arg,
2406 LSX_PARAM_IN lsx_enum_item const * items
2407 );
2408
2416LSX_API
2418 LSX_PARAM_IN_Z char const * str,
2419 LSX_PARAM_IN_Z char const * end
2420 );
2421
2429char const *
2430LSX_API
2432 LSX_PARAM_IN_Z char const * pathname
2433 );
2434
2443char const *
2444LSX_API
2446 double number
2447 );
2448
2457char const *
2458LSX_API
2460 double percentage
2461 );
2462
2470void *
2471LSX_API
2473 LSX_PARAM_IN_OPT void *ptr,
2474 size_t newsize
2475 );
2476
2483int
2484LSX_API
2486 LSX_PARAM_IN_Z char const * s1,
2487 LSX_PARAM_IN_Z char const * s2
2488 );
2489
2490
2497int
2498LSX_API
2500 LSX_PARAM_IN_Z char const * s1,
2501 LSX_PARAM_IN_Z char const * s2,
2502 size_t n
2503 );
2504
2509typedef enum lsx_option_arg_t {
2514
2524
2529typedef struct lsx_option_t {
2530 char const * name;
2532 int * flag;
2533 int val;
2534} lsx_option_t;
2535
2540typedef struct lsx_getopt_t {
2541 int argc;
2542 char * const * argv;
2543 char const * shortopts;
2546 char const * curpos;
2547 int ind;
2548 int opt;
2549 char const * arg;
2551} lsx_getopt_t;
2552
2557void
2558LSX_API
2560 LSX_PARAM_IN int argc,
2561 LSX_PARAM_IN_COUNT(argc) char * const * argv,
2562 LSX_PARAM_IN_Z char const * shortopts,
2563 LSX_PARAM_IN_OPT lsx_option_t const * longopts,
2565 LSX_PARAM_IN int first,
2567 );
2568
2580int
2581LSX_API
2584 );
2585
2592LSX_API
2595 );
2596
2597/* WARNING END */
2598
2599#if defined(__cplusplus)
2600}
2601#endif
2602
2603#endif /* SOX_H */
@ lsx_find_enum_item_none
Default parameters (case-insensitive).
Definition: sox.h:2362
@ lsx_find_enum_item_case_sensitive
Enable case-sensitive search.
Definition: sox.h:2363
#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.h:313
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.h:337
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.h:204
uint64_t sox_uint64_t
Client API: Unsigned 64-bit type.
Definition: sox.h:433
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.h:1200
sox_int32_t sox_sample_t
Client API: Native SoX audio sample type (alias for sox_int32_t).
Definition: sox.h:451
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.h:1135
#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.h:349
uint16_t sox_uint16_t
Client API: Unsigned 16-bit type.
Definition: sox.h:409
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.h:1248
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.h:1222
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.h:2519
@ lsx_getopt_flag_none
no flags (no output, not long-only)
Definition: sox.h:2520
@ lsx_getopt_flag_longonly
if set, recognize -option as a long option
Definition: sox.h:2522
@ lsx_getopt_flag_opterr
if set, invalid options trigger lsx_warn output
Definition: sox.h:2521
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.h:167
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.h:397
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.h:1236
char ** sox_comments_t
Client API: File's metadata, access via sox_*_comments functions.
Definition: sox.h:463
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.h:483
@ sox_option_default
Option unspecified = 2.
Definition: sox.h:486
@ sox_option_yes
Option specified as yes = 1.
Definition: sox.h:485
@ sox_option_no
Option specified as no = 0.
Definition: sox.h:484
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.h:473
@ sox_true
True = 1.
Definition: sox.h:476
@ sox_false
False = 0.
Definition: sox.h:475
#define LSX_RETURN_ARRAY
Plugins API: Attribute applied to a function to indicate that the return value is always a pointer to...
Definition: sox.h:123
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.h:191
sox_uint32_t sox_uint24_t
Client API: Alias for sox_uint32_t (beware of the extra byte).
Definition: sox.h:445
int64_t sox_int64_t
Client API: Signed twos-complement 64-bit type.
Definition: sox.h:427
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.h:1147
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.h:134
#define LSX_PARAM_IN
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to on...
Definition: sox.h:156
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.h:1212
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.h:1109
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.h:361
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.h:1167
int32_t sox_int32_t
Client API: Signed twos-complement 32-bit type.
Definition: sox.h:415
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.h:295
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.h:421
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.h:66
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.h:226
#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.h:251
lsx_option_arg_t
Plugins API: Is option argument unsupported, required, or optional.
Definition: sox.h:2509
@ lsx_option_arg_optional
Option can optionally be followed by an argument.
Definition: sox.h:2512
@ lsx_option_arg_required
Option requires an argument.
Definition: sox.h:2511
@ lsx_option_arg_none
Option does not have an argument.
Definition: sox.h:2510
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.h:1117
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.h:215
sox_error_t
Client API: The libSoX-specific error codes.
Definition: sox.h:494
@ SOX_EPERM
Operation not permitted = 2003.
Definition: sox.h:500
@ SOX_ENOMEM
Can't alloc memory = 2002.
Definition: sox.h:499
@ SOX_EHDR
Invalid Audio Header = 2000.
Definition: sox.h:497
@ SOX_ENOTSUP
Operation not supported = 2004.
Definition: sox.h:501
@ SOX_EINVAL
Invalid argument = 2005.
Definition: sox.h:502
@ SOX_SUCCESS
Function succeeded = 0.
Definition: sox.h:495
@ SOX_EOF
End Of File or other error = -1.
Definition: sox.h:496
@ SOX_EFMT
Unsupported data format = 2001.
Definition: sox.h:498
sox_loop_flags_t
Client API: Loop modes: upper 4 bits mask the loop blass, lower 4 bits describe the loop behaviour,...
Definition: sox.h:582
@ sox_loop_none
single-shot = 0
Definition: sox.h:583
@ sox_loop_sustain_decay
AIFF style, one sustain & one decay loop = 64.
Definition: sox.h:587
@ sox_loop_8
8 loops (??) = 32
Definition: sox.h:586
@ sox_loop_forward
forward loop = 1
Definition: sox.h:584
@ sox_loop_forward_back
forward/back loop = 2
Definition: sox.h:585
#define SOX_MAX_NLOOPS
Client API: Maximum number of loops supported by sox_oob_t = 8.
Definition: sox.h:1041
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.h:89
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.h:277
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.h:263
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.h:439
#define LSX_RETURN_VALID
Plugins API: Attribute applied to a function to indicate that the return value is always a pointer to...
Definition: sox.h:112
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.h:1189
sox_encoding_t
Client API: Format of sample data.
Definition: sox.h:521
@ SOX_ENCODING_DPCM
Differential PCM: Fasttracker 2 (xi)
Definition: sox.h:541
@ SOX_ENCODING_G723
G.723 3 or 5 bit ADPCM.
Definition: sox.h:535
@ SOX_ENCODING_OPUS
Opus compression.
Definition: sox.h:551
@ SOX_ENCODING_SIGN2
signed linear 2's comp: Mac
Definition: sox.h:524
@ SOX_ENCODING_AMR_WB
AMR-WB compression.
Definition: sox.h:547
@ SOX_ENCODING_ALAW
A-law signed logs: non-US telephony, Psion.
Definition: sox.h:533
@ SOX_ENCODINGS
End of list marker.
Definition: sox.h:553
@ SOX_ENCODING_ULAW
u-law signed logs: US telephony, SPARC
Definition: sox.h:532
@ SOX_ENCODING_WAVPACKF
WavPack with float samples.
Definition: sox.h:531
@ SOX_ENCODING_UNKNOWN
encoding has not yet been determined
Definition: sox.h:522
@ SOX_ENCODING_MP3
MP3 compression.
Definition: sox.h:545
@ SOX_ENCODING_G721
G.721 4-bit ADPCM.
Definition: sox.h:534
@ SOX_ENCODING_CVSD
Continuously Variable Slope Delta modulation.
Definition: sox.h:549
@ SOX_ENCODING_FLOAT_TEXT
floating point (text format)
Definition: sox.h:527
@ SOX_ENCODING_MS_ADPCM
Microsoft Compressed PCM.
Definition: sox.h:538
@ SOX_ENCODING_GSM
GSM 6.10 33byte frame lossy compression.
Definition: sox.h:544
@ SOX_ENCODING_FLAC
FLAC compression.
Definition: sox.h:528
@ SOX_ENCODING_DWVWN
Delta Width Variable Word N-bit.
Definition: sox.h:543
@ SOX_ENCODING_VORBIS
Vorbis compression.
Definition: sox.h:546
@ SOX_ENCODING_CL_ADPCM16
Creative Labs 16 --> 4 bit Compressed PCM.
Definition: sox.h:537
@ SOX_ENCODING_UNSIGNED
unsigned linear: Sound Blaster
Definition: sox.h:525
@ SOX_ENCODING_CL_ADPCM
Creative Labs 8 --> 2,3,4 bit Compressed PCM.
Definition: sox.h:536
@ SOX_ENCODING_HCOM
Mac FSSD files with Huffman compression.
Definition: sox.h:529
@ SOX_ENCODING_AMR_NB
AMR-NB compression.
Definition: sox.h:548
@ SOX_ENCODING_DWVW
Delta Width Variable Word.
Definition: sox.h:542
@ SOX_ENCODING_LPC10
Linear Predictive Coding.
Definition: sox.h:550
@ SOX_ENCODING_WAVPACK
WavPack with integer samples.
Definition: sox.h:530
@ SOX_ENCODING_FLOAT
floating point (binary format)
Definition: sox.h:526
@ SOX_ENCODING_IMA_ADPCM
IMA Compressed PCM.
Definition: sox.h:539
@ SOX_ENCODING_OKI_ADPCM
Dialogic/OKI Compressed PCM.
Definition: sox.h:540
#define LSX_RETURN_OPT
Plugins API: Attribute applied to a function to indicate that the returned pointer may be null.
Definition: sox.h:145
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.h:560
@ sox_encodings_lossy2
encode, decode, encode, decode: lossy twice = 2.
Definition: sox.h:563
@ sox_encodings_none
no flags specified (implies lossless encoding) = 0.
Definition: sox.h:561
@ sox_encodings_lossy1
encode, decode: lossy once = 1.
Definition: sox.h:562
int(LSX_API * sox_playlist_callback_t)(void *callback_data, LSX_PARAM_IN_Z char const *filename)
Client API: Callback for enumerating the contents of a playlist, used by the sox_parse_playlist funct...
Definition: sox.h:1279
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.h:1258
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.
int16_t sox_int16_t
Client API: Signed twos-complement 16-bit type.
Definition: sox.h:403
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.h:1157
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.h:1125
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.h:101
sox_version_flags_t
Client API: Flags indicating whether optional features are present in this build of libSoX.
Definition: sox.h:509
@ sox_version_have_threads
threads = 4.
Definition: sox.h:513
@ sox_version_have_popen
popen = 1.
Definition: sox.h:511
@ sox_version_have_memopen
memopen = 8.
Definition: sox.h:514
@ sox_version_have_magic
magic = 2.
Definition: sox.h:512
@ sox_version_none
No special features = 0.
Definition: sox.h:510
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.h:1268
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.h:595
@ lsx_io_file
File is a real file = 0.
Definition: sox.h:596
@ lsx_io_pipe
File is a pipe (no seeking) = 1.
Definition: sox.h:597
@ lsx_io_url
File is a URL (no seeking) = 2.
Definition: sox.h:598
double sox_rate_t
Client API: Samples per second is stored as a double.
Definition: sox.h:457
#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.h:178
#define LSX_PARAM_INOUT
Plugins API: Attribute applied to a parameter to indicate that the parameter is a valid pointer to on...
Definition: sox.h:238
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.h:1096
sox_plot_t
Client API: Type of plot.
Definition: sox.h:570
@ sox_plot_octave
Octave plot = 1.
Definition: sox.h:572
@ sox_plot_gnuplot
Gnuplot plot = 2.
Definition: sox.h:573
@ sox_plot_off
No plot = 0.
Definition: sox.h:571
@ sox_plot_data
Plot data = 3.
Definition: sox.h:574
void LSX_API sox_trim_clear_start(LSX_PARAM_INOUT sox_effect_t *effp)
Client API: Clears the start of the trim to 0.
void LSX_API sox_init_encodinginfo(LSX_PARAM_OUT sox_encodinginfo_t *e)
Client API: Fills in an encodinginfo with default values.
int8_t sox_int8_t
Client API: Signed twos-complement 8-bit type.
Definition: sox.h:391
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.h:325
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.h:1179
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.h:2342
char const * text
String name of enumeration.
Definition: sox.h:2343
unsigned value
Integer value of enumeration.
Definition: sox.h:2344
Plugins API: lsx_getopt session information (initialization data and state).
Definition: sox.h:2540
char const * shortopts
IN shortopts: Short option characters.
Definition: sox.h:2543
int opt
OUT optopt: Receives the option character that caused error.
Definition: sox.h:2548
int lngind
OUT lngind: Receives the index of the matched long option or -1 if not a long option.
Definition: sox.h:2550
char const * curpos
INOUT curpos: Maintains state between calls to lsx_getopt.
Definition: sox.h:2546
int ind
INOUT optind: Maintains the index of next element to be processed.
Definition: sox.h:2547
lsx_option_t const * longopts
IN longopts: Array of long option descriptors.
Definition: sox.h:2544
char const * arg
OUT optarg: Receives the value of the option's argument.
Definition: sox.h:2549
lsx_getopt_flags_t flags
IN flags: Flags for longonly and opterr.
Definition: sox.h:2545
char *const * argv
IN argv: Array of arguments.
Definition: sox.h:2542
int argc
IN argc: Number of arguments in argv.
Definition: sox.h:2541
Plugins API: lsx_getopt long option descriptor.
Definition: sox.h:2529
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.h:2531
int * flag
Flag to set if argument is present.
Definition: sox.h:2532
char const * name
Name of the long option.
Definition: sox.h:2530
int val
Value to put in flag if argument is present.
Definition: sox.h:2533
Client API: Effect handler information.
Definition: sox.h:1565
sox_effect_handler_kill kill
Called to shut down effect (called once per effect).
Definition: sox.h:1574
char const * usage
Short explanation of parameters accepted by effect.
Definition: sox.h:1567
sox_effect_handler_getopts getopts
Called to parse command-line arguments (called once per effect).
Definition: sox.h:1569
sox_effect_handler_flow flow
Called to process samples.
Definition: sox.h:1571
sox_effect_handler_drain drain
Called to finish getting output after input is complete.
Definition: sox.h:1572
char const * name
Effect name.
Definition: sox.h:1566
size_t priv_size
Size of private data SoX should pre-allocate for effect.
Definition: sox.h:1575
sox_effect_handler_start start
Called to initialize effect (called once per flow).
Definition: sox.h:1570
sox_effect_handler_stop stop
Called to shut down effect (called once per flow).
Definition: sox.h:1573
unsigned int flags
Combination of SOX_EFF_* flags.
Definition: sox.h:1568
Client API: Effect information.
Definition: sox.h:1582
size_t flow
flow number
Definition: sox.h:1591
sox_effects_globals_t * global_info
global effect parameters
Definition: sox.h:1583
sox_encodinginfo_t const * out_encoding
Information about the outgoing data encoding.
Definition: sox.h:1587
size_t flows
1 if MCHAN, number of chans otherwise
Definition: sox.h:1590
sox_signalinfo_t out_signal
Information about the outgoing data stream.
Definition: sox.h:1585
sox_encodinginfo_t const * in_encoding
Information about the incoming data encoding.
Definition: sox.h:1586
sox_signalinfo_t in_signal
Information about the incoming data stream.
Definition: sox.h:1584
void * priv
Effect's private data area (each flow has a separate copy)
Definition: sox.h:1592
size_t imin
minimum input buffer content required for calling this effect's flow function; set via lsx_effect_set...
Definition: sox.h:1597
sox_uint64_t clips
increment if clipping occurs
Definition: sox.h:1589
sox_effect_handler_t handler
The handler for this effect.
Definition: sox.h:1588
size_t oend
output buffer: one past valid data section (oend-obeg is length of current content)
Definition: sox.h:1596
size_t obeg
output buffer: start of valid data section
Definition: sox.h:1595
sox_sample_t * obuf
output buffer
Definition: sox.h:1594
Client API: Chain of effects to be applied to a stream.
Definition: sox.h:1604
sox_encodinginfo_t const * out_enc
Output encoding.
Definition: sox.h:1609
sox_effect_t ** effects
Table of effects to be applied to a stream.
Definition: sox.h:1605
sox_encodinginfo_t const * in_enc
Input encoding.
Definition: sox.h:1608
size_t table_size
Size of effects table (including unused entries)
Definition: sox.h:1611
sox_sample_t * il_buf
Channel interleave buffer.
Definition: sox.h:1612
sox_effects_globals_t global_info
Copy of global effects settings.
Definition: sox.h:1607
size_t length
Number of effects to be applied.
Definition: sox.h:1606
Client API: Global parameters for effects.
Definition: sox.h:1556
sox_plot_t plot
To help the user choose effect & options.
Definition: sox.h:1557
sox_globals_t * global_info
Pointer to associated SoX globals.
Definition: sox.h:1558
Client API: Encoding parameters.
Definition: sox.h:1371
sox_option_t reverse_nibbles
Should nibbles be reversed? If this is default during sox_open_read or sox_open_write,...
Definition: sox.h:1388
sox_bool opposite_endian
If set to true, the format should reverse its default endianness.
Definition: sox.h:1400
sox_option_t reverse_bits
Should bits be reversed? If this is default during sox_open_read or sox_open_write,...
Definition: sox.h:1395
sox_encoding_t encoding
format of sample numbers
Definition: sox.h:1372
sox_option_t reverse_bytes
Should bytes be reversed? If this is default during sox_open_read or sox_open_write,...
Definition: sox.h:1381
double compression
compression factor (where applicable)
Definition: sox.h:1374
unsigned bits_per_sample
0 if unknown or variable; uncompressed value if lossless; compressed value if lossy
Definition: sox.h:1373
Client API: Basic information about an encoding.
Definition: sox.h:1361
char const * name
encoding name.
Definition: sox.h:1363
sox_encodings_flags_t flags
lossy once (lossy1), lossy twice (lossy2), or lossless (none).
Definition: sox.h:1362
char const * desc
encoding description.
Definition: sox.h:1364
Client API: File buffer info.
Definition: sox.h:1430
char * buf
Pointer to data buffer.
Definition: sox.h:1431
size_t pos
Position in buffer.
Definition: sox.h:1434
size_t count
Count read into buffer.
Definition: sox.h:1433
size_t size
Size of buffer in bytes.
Definition: sox.h:1432
Client API: Handler structure defined by each format.
Definition: sox.h:1441
unsigned const * write_formats
Array of values indicating the encodings and precisions supported for writing (encoding).
Definition: sox.h:1465
sox_format_handler_stopwrite stopwrite
called to close writer (decoder); may be null if no closing necessary
Definition: sox.h:1451
sox_format_handler_startread startread
called to initialize reader (decoder)
Definition: sox.h:1446
sox_format_handler_stopread stopread
called to close reader (decoder); may be null if no closing necessary
Definition: sox.h:1448
sox_format_handler_startwrite startwrite
called to initialize writer (encoder)
Definition: sox.h:1449
sox_format_handler_write write
called to write (encode) a block of samples
Definition: sox.h:1450
size_t priv_size
SoX will automatically allocate a buffer in which the handler can store data.
Definition: sox.h:1480
sox_format_handler_read read
called to read (decode) a block of samples
Definition: sox.h:1447
sox_format_handler_seek seek
called to reposition reader; may be null if not supported
Definition: sox.h:1452
unsigned sox_lib_version_code
Checked on load; must be 1st in struct.
Definition: sox.h:1442
unsigned int flags
File flags (SOX_FILE_* values).
Definition: sox.h:1445
sox_rate_t const * write_rates
Array of sample rates (samples per second) supported for writing (encoding).
Definition: sox.h:1471
char const *const * names
null-terminated array of filename extensions that are handled by this format
Definition: sox.h:1444
char const * description
short description of format
Definition: sox.h:1443
Client API: Data passed to/from the format handler.
Definition: sox.h:1500
char mode
Read or write mode ('r' or 'w')
Definition: sox.h:1528
char sox_errstr[256]
Failure error text.
Definition: sox.h:1532
char * filetype
Type of file, as determined by header inspection or libmagic.
Definition: sox.h:1525
int sox_errno
Failure error code.
Definition: sox.h:1531
sox_signalinfo_t signal
Signal specifications for reader (decoder) or writer (encoder): sample rate, number of channels,...
Definition: sox.h:1515
sox_encodinginfo_t encoding
Encoding specifications for reader (decoder) or writer (encoder): encoding (sample format),...
Definition: sox.h:1523
lsx_io_type io_type
Stores whether this is a file, pipe or URL.
Definition: sox.h:1534
sox_oob_t oob
comments, instrument info, loop info (out-of-band data)
Definition: sox.h:1526
void * priv
Format handler's private data area.
Definition: sox.h:1538
sox_uint64_t olength
Samples * chans written to file.
Definition: sox.h:1529
void * fp
File stream pointer.
Definition: sox.h:1533
sox_bool seekable
Can seek on this file.
Definition: sox.h:1527
sox_uint64_t clips
Incremented if clipping occurs.
Definition: sox.h:1530
sox_format_handler_t handler
Format handler for this file.
Definition: sox.h:1537
sox_uint64_t data_start
Offset at which headers end and sound data begins (set by lsx_check_read_params)
Definition: sox.h:1536
sox_uint64_t tell_off
Current offset within file.
Definition: sox.h:1535
char * filename
File name.
Definition: sox.h:1501
Client API: Information about a loaded format handler, including the format name and a function point...
Definition: sox.h:1547
char * name
Name of format handler.
Definition: sox.h:1548
sox_format_fn_t fn
Function to call to get format handler's information.
Definition: sox.h:1549
Client API: Global parameters (for effects & formats), returned from the sox_get_globals function.
Definition: sox.h:1311
sox_bool repeatable
true to use pre-determined timestamps and PRNG seed
Definition: sox.h:1315
sox_bool use_threads
Private: true if client has requested parallel effects processing.
Definition: sox.h:1336
size_t bufsiz
Default size (in bytes) used by libSoX for blocks of sample data.
Definition: sox.h:1321
char * tmp_path
Private: client-configured path to use for temporary files.
Definition: sox.h:1334
char const * stdout_in_use_by
Private: tracks the name of the handler currently using stdout.
Definition: sox.h:1332
char const * stdin_in_use_by
Private: tracks the name of the handler currently using stdin.
Definition: sox.h:1331
unsigned verbosity
messages are only written if globals.verbosity >= message.level
Definition: sox.h:1313
size_t input_bufsiz
Default size (in bytes) used by libSoX for blocks of input sample data.
Definition: sox.h:1327
sox_bool use_magic
Private: true if client has requested use of 'magic' file-type detection.
Definition: sox.h:1335
sox_output_message_handler_t output_message_handler
client-specified message output callback
Definition: sox.h:1314
size_t log2_dft_min_size
Log to base 2 of minimum size (in bytes) used by libSoX for DFT (filtering).
Definition: sox.h:1342
char const * subsystem
Private: tracks the name of the handler currently writing an output message.
Definition: sox.h:1333
sox_int32_t ranqd1
Can be used to re-seed libSoX's PRNG.
Definition: sox.h:1329
Client API: Instrument information.
Definition: sox.h:1418
signed char MIDIlow
MIDI pitch-bend low range.
Definition: sox.h:1420
unsigned nloops
number of active loops (max SOX_MAX_NLOOPS).
Definition: sox.h:1423
signed char MIDInote
for unity pitch playback
Definition: sox.h:1419
signed char MIDIhi
MIDI pitch-bend high range.
Definition: sox.h:1421
unsigned char loopmode
0=no, 1=forward, 2=forward/back (see sox_loop_* values)
Definition: sox.h:1422
Client API: Looping parameters (out-of-band data).
Definition: sox.h:1407
sox_uint64_t length
length
Definition: sox.h:1409
unsigned count
number of repeats, 0=forever
Definition: sox.h:1410
sox_uint64_t start
first sample
Definition: sox.h:1408
unsigned char type
0=no, 1=forward, 2=forward/back (see sox_loop_* for valid values).
Definition: sox.h:1411
Client API: Comments, instrument info, loop info (out-of-band data).
Definition: sox.h:1487
sox_comments_t comments
Comment strings in id=value format.
Definition: sox.h:1489
sox_instrinfo_t instr
Instrument specification.
Definition: sox.h:1490
sox_loopinfo_t loops[SOX_MAX_NLOOPS]
Looping specification.
Definition: sox.h:1491
Client API: Signal parameters; members should be set to SOX_UNSPEC (= 0) if unknown.
Definition: sox.h:1349
unsigned channels
number of sound channels, 0 if unknown
Definition: sox.h:1351
unsigned precision
bits per sample, 0 if unknown
Definition: sox.h:1352
double * mult
Effects headroom multiplier; may be null.
Definition: sox.h:1354
sox_uint64_t length
samples * chans in file, 0 if unknown, -1 if unspecified
Definition: sox.h:1353
sox_rate_t rate
samples per second, 0 if unknown
Definition: sox.h:1350
Client API: Information about a build of libSoX, returned from the sox_version_info function.
Definition: sox.h:1293
char const * arch
arch, for example, "1248 48 44 L OMP"
Definition: sox.h:1302
sox_version_flags_t flags
feature flags = popen | magic | threads | memopen
Definition: sox.h:1295
char const * version
version string = sox_version(), for example, "14.4.0"
Definition: sox.h:1297
sox_uint32_t version_code
version number = 0x140400
Definition: sox.h:1296
char const * distro
distro or null = "DISTRO", for example, "Debian"
Definition: sox.h:1300
char const * version_extra
version extra info or null = "PACKAGE_EXTRA", for example, "beta"
Definition: sox.h:1298
size_t size
structure size = sizeof(sox_version_info_t)
Definition: sox.h:1294
char const * compiler
compiler info or null, for example, "msvc 160040219"
Definition: sox.h:1301
char const * time
build time = "__DATE__ __TIME__", for example, "Jan 7 2010 03:31:50"
Definition: sox.h:1299