You could access this page securely.

API documentation for libmpg123, libout123, and libsyn123

Note: This API doc is automatically generated from the current development version that you can get via Subversion or as a daily snapshot from http://mpg123.org/snapshot. There may be differences (additions) compared to the latest stable release. See NEWS.libmpg123, NEWS.libout123, NEWS.libsyn123, and the overall NEWS file on libmpg123 versions and important changes between them.
Let me emphasize that the policy for the lib*123 family is to always stay backwards compatible -- only additions are planned (and it's not yet planned to change the plans;-).
syn123.h
Go to the documentation of this file.
1 /*
2  syn123: some audio signal synthesis and format conversion
3 
4  copyright 2017-2020 by the mpg123 project,
5  free software under the terms of the LGPL 2.1
6  see COPYING and AUTHORS files in distribution or http://mpg123.org
7 
8  initially written by Thomas Orgis
9 */
10 
11 #ifndef SYN123_H
12 #define SYN123_H
13 
16 /* Common audio encoding specification. */
17 #include <fmt123.h>
18 
23 #define SYN123_API_VERSION 1
24 
25 #ifndef MPG123_EXPORT
26 
33 #ifdef BUILD_MPG123_DLL
34 /* The dll exports. */
35 #define MPG123_EXPORT __declspec(dllexport)
36 #else
37 #ifdef LINK_MPG123_DLL
38 /* The exe imports. */
39 #define MPG123_EXPORT __declspec(dllimport)
40 #else
41 /* Nothing on normal/UNIX builds */
42 #define MPG123_EXPORT
43 #endif
44 #endif
45 #endif
46 
47 #ifndef MPG123_RESTRICT
48 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
49 #define MPG123_RESTRICT restrict
50 #else
51 #define MPG123_RESTRICT
52 #endif
53 #endif
54 
55 /* Enable use of this file without configure. */
56 /* Also make sure to define _FILE_OFFSET_BITS, too. */
57 #ifndef MPG123_NO_CONFIGURE
58 #include <stdlib.h>
59 #include <sys/types.h>
60 #endif
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65 
139 struct syn123_struct;
141 typedef struct syn123_struct syn123_handle;
142 
148 {
164 };
165 
170 const char* syn123_strerror(int errcode);
171 
186 syn123_handle* syn123_new( long rate, int channels, int encoding
187 , size_t maxbuf, int *err );
188 
193 void syn123_del(syn123_handle *sh);
194 
212 int syn123_dither(syn123_handle *sh, int dither, unsigned long *seed);
213 
222 size_t syn123_read(syn123_handle *sh, void *dst, size_t dst_bytes);
223 
226 {
239 };
240 
285 int syn123_setup_waves( syn123_handle* sh, size_t count
286 , int *id, double *freq, double *phase, int* backwards
287 , size_t *period );
288 
315 int syn123_query_waves( syn123_handle* sh, size_t *count
316 , int *id, double *freq, double *phase, int* backwards
317 , size_t *period );
318 
326 const char* syn123_wave_name(int id);
327 
334 int syn123_wave_id(const char *name);
335 
342 {
347 };
348 
393 , int wave_id, double phase, int backwards
394 , int sweep_id, double *f1, double *f2, int smooth, size_t duration
395 , double *endphase, size_t *period, size_t *buffer_period );
396 
411 int syn123_setup_pink( syn123_handle *sh, int rows, unsigned long seed
412 , size_t *period );
413 
423 int syn123_setup_white(syn123_handle *sh, unsigned long seed, size_t *period);
424 
436 int syn123_setup_geiger( syn123_handle *sh, double activity
437 , unsigned long seed, size_t *period );
438 
445 
476 int syn123_conv( void * MPG123_RESTRICT dst, int dst_enc, size_t dst_size
477 , void * MPG123_RESTRICT src, int src_enc, size_t src_bytes
478 , size_t *dst_bytes, size_t *clipped, syn123_handle * sh );
479 
490 #define SYN123_DB_LIMIT 500
491 
500 MPG123_EXPORT double syn123_db2lin(double db);
501 
510 MPG123_EXPORT double syn123_lin2db(double volume);
511 
531 int syn123_amp( void* buf, int encoding, size_t samples
532 , double volume, double offset, size_t *clipped, syn123_handle *sh );
533 
547 size_t syn123_clip(void *buf, int encoding, size_t samples);
548 
565 size_t syn123_soft_clip( void *buf, int encoding, size_t samples
566 , double limit, double width, syn123_handle *sh );
567 
582 void syn123_interleave( void * MPG123_RESTRICT dst, void** MPG123_RESTRICT src
583 , int channels, size_t samplesize, size_t samplecount );
584 
599 void syn123_deinterleave( void ** MPG123_RESTRICT dst, void * MPG123_RESTRICT src
600 , int channels, size_t samplesize, size_t samplecount );
601 
612 void syn123_mono2many( void * MPG123_RESTRICT dst, void * MPG123_RESTRICT src
613 , int channels, size_t samplesize, size_t samplecount );
614 
618 #define SYN123_IOFF(sample, channel, channels) ((sample)*(channels)+(channel))
619 
633 int syn123_mixenc(int src_enc, int dst_enc);
634 
675 int syn123_mix( void * MPG123_RESTRICT dst, int dst_enc, int dst_channels
676 , void * MPG123_RESTRICT src, int src_enc, int src_channels
677 , const double * mixmatrix
678 , size_t samples, int silence, size_t *clipped, syn123_handle *sh );
679 
717 , int append, unsigned int order, double *b, double *a
718 , int mixenc, int channels, int init_firstval );
719 
723 int syn123_query_filter( syn123_handle *sh, size_t position
724 , size_t *count, unsigned int *order, double *b, double *a
725 , int *mixenc, int *channels, int *init_firstval );
726 
729 void syn123_drop_filter(syn123_handle *sh, size_t count);
730 
750 , void* buf, int encoding, size_t samples );
751 
829 int syn123_setup_resample( syn123_handle *sh, long inrate, long outrate
830 , int channels, int dirty, int smooth );
831 
844 long syn123_resample_maxrate(void);
845 
865 size_t syn123_resample_count(long inrate, long outrate, size_t ins);
866 
885 size_t syn123_resample_history(long inrate, long outrate, int dirty);
886 
905 size_t syn123_resample_incount(long input_rate, long output_rate, size_t outs);
906 
922 size_t syn123_resample_fillcount(long input_rate, long output_rate, size_t outs);
923 
924 
936 size_t syn123_resample_maxincount(long input_rate, long output_rate);
937 
949 ssize_t syn123_resample_expect(syn123_handle *sh, size_t ins);
950 
964 ssize_t syn123_resample_inexpect(syn123_handle *sh, size_t outs);
965 
966 
967 #ifndef SYN123_NO_LARGEFUNC
968 
969 /* The whole block of off_t-using API is optional to be able to build
970  the underlying code without confusing the compiler with prototype
971  mismatch. */
972 
973 /* Lightweight large file hackery to enable worry-reduced use of off_t.
974  Depending on the size of off_t in your client build, the corresponding
975  library function needs to be chosen. */
976 #ifdef _FILE_OFFSET_BITS
977 # if _FILE_OFFSET_BITS+0 == 32
978 # define syn123_resample_total syn123_resample_total_32
979 # define syn123_resample_intotal syn123_resample_intotal_32
980 # elif _FILE_OFFSET_BITS+0 == 64
981 # define syn123_resample_total syn123_resample_total_64
982 # define syn123_resample_intotal syn123_resample_intotal_64
983 # else
984 # error "Unpredicted _FILE_OFFSET_BITS value."
985 # endif
986 #endif
987 
1003 off_t syn123_resample_total(long inrate, long outrate, off_t ins);
1004 
1023 off_t syn123_resample_intotal(long inrate, long outrate, off_t outs);
1024 
1025 #endif
1026 
1056 size_t syn123_resample( syn123_handle *sh,
1057  float * MPG123_RESTRICT dst, float * MPG123_RESTRICT src, size_t samples );
1058 
1065 void syn123_swap_bytes(void* buf, size_t samplesize, size_t samplecount);
1066 
1067 /* Wrappers over the above to convert to/from syn123's native byte order
1068  from/to little or big endian. */
1069 
1076 void syn123_host2le(void *buf, size_t samplesize, size_t samplecount);
1077 
1084 void syn123_host2be(void *buf, size_t samplesize, size_t samplecount);
1085 
1092 void syn123_le2host(void *buf, size_t samplesize, size_t samplecount);
1093 
1100 void syn123_be2host(void *buf, size_t samplesize, size_t samplecount);
1101 
1102 /* @} */
1103 
1104 #ifdef __cplusplus
1105 }
1106 #endif
1107 
1108 #endif
syn123_sweep_id
Definition: syn123.h:341
MPG123_EXPORT double syn123_db2lin(double db)
MPG123_EXPORT off_t syn123_resample_intotal(long inrate, long outrate, off_t outs)
MPG123_EXPORT void syn123_be2host(void *buf, size_t samplesize, size_t samplecount)
MPG123_EXPORT void syn123_interleave(void *MPG123_RESTRICT dst, void **MPG123_RESTRICT src, int channels, size_t samplesize, size_t samplecount)
MPG123_EXPORT size_t syn123_read(syn123_handle *sh, void *dst, size_t dst_bytes)
MPG123_EXPORT int syn123_setup_filter(syn123_handle *sh, int append, unsigned int order, double *b, double *a, int mixenc, int channels, int init_firstval)
MPG123_EXPORT void syn123_mono2many(void *MPG123_RESTRICT dst, void *MPG123_RESTRICT src, int channels, size_t samplesize, size_t samplecount)
MPG123_EXPORT void syn123_drop_filter(syn123_handle *sh, size_t count)
const char * syn123_strerror(int errcode)
MPG123_EXPORT int syn123_conv(void *MPG123_RESTRICT dst, int dst_enc, size_t dst_size, void *MPG123_RESTRICT src, int src_enc, size_t src_bytes, size_t *dst_bytes, size_t *clipped, syn123_handle *sh)
MPG123_EXPORT size_t syn123_resample_history(long inrate, long outrate, int dirty)
MPG123_EXPORT void syn123_host2be(void *buf, size_t samplesize, size_t samplecount)
MPG123_EXPORT long syn123_resample_maxrate(void)
syn123_error
Definition: syn123.h:147
MPG123_EXPORT syn123_handle * syn123_new(long rate, int channels, int encoding, size_t maxbuf, int *err)
MPG123_EXPORT void syn123_le2host(void *buf, size_t samplesize, size_t samplecount)
MPG123_EXPORT int syn123_setup_sweep(syn123_handle *sh, int wave_id, double phase, int backwards, int sweep_id, double *f1, double *f2, int smooth, size_t duration, double *endphase, size_t *period, size_t *buffer_period)
MPG123_EXPORT void syn123_deinterleave(void **MPG123_RESTRICT dst, void *MPG123_RESTRICT src, int channels, size_t samplesize, size_t samplecount)
MPG123_EXPORT off_t syn123_resample_total(long inrate, long outrate, off_t ins)
MPG123_EXPORT int syn123_query_filter(syn123_handle *sh, size_t position, size_t *count, unsigned int *order, double *b, double *a, int *mixenc, int *channels, int *init_firstval)
MPG123_EXPORT int syn123_setup_white(syn123_handle *sh, unsigned long seed, size_t *period)
MPG123_EXPORT void syn123_del(syn123_handle *sh)
MPG123_EXPORT int syn123_setup_resample(syn123_handle *sh, long inrate, long outrate, int channels, int dirty, int smooth)
MPG123_EXPORT void syn123_host2le(void *buf, size_t samplesize, size_t samplecount)
MPG123_EXPORT size_t syn123_resample_count(long inrate, long outrate, size_t ins)
MPG123_EXPORT int syn123_mixenc(int src_enc, int dst_enc)
MPG123_EXPORT int syn123_setup_silence(syn123_handle *sh)
MPG123_EXPORT const char * syn123_wave_name(int id)
MPG123_EXPORT size_t syn123_resample_maxincount(long input_rate, long output_rate)
MPG123_EXPORT ssize_t syn123_resample_expect(syn123_handle *sh, size_t ins)
MPG123_EXPORT size_t syn123_resample_incount(long input_rate, long output_rate, size_t outs)
MPG123_EXPORT void syn123_swap_bytes(void *buf, size_t samplesize, size_t samplecount)
MPG123_EXPORT size_t syn123_clip(void *buf, int encoding, size_t samples)
MPG123_EXPORT int syn123_dither(syn123_handle *sh, int dither, unsigned long *seed)
MPG123_EXPORT size_t syn123_soft_clip(void *buf, int encoding, size_t samples, double limit, double width, syn123_handle *sh)
MPG123_EXPORT int syn123_mix(void *MPG123_RESTRICT dst, int dst_enc, int dst_channels, void *MPG123_RESTRICT src, int src_enc, int src_channels, const double *mixmatrix, size_t samples, int silence, size_t *clipped, syn123_handle *sh)
MPG123_EXPORT int syn123_setup_waves(syn123_handle *sh, size_t count, int *id, double *freq, double *phase, int *backwards, size_t *period)
MPG123_EXPORT ssize_t syn123_resample_inexpect(syn123_handle *sh, size_t outs)
syn123_wave_id
Definition: syn123.h:225
MPG123_EXPORT size_t syn123_resample(syn123_handle *sh, float *MPG123_RESTRICT dst, float *MPG123_RESTRICT src, size_t samples)
MPG123_EXPORT int syn123_amp(void *buf, int encoding, size_t samples, double volume, double offset, size_t *clipped, syn123_handle *sh)
MPG123_EXPORT int syn123_setup_pink(syn123_handle *sh, int rows, unsigned long seed, size_t *period)
MPG123_EXPORT int syn123_setup_geiger(syn123_handle *sh, double activity, unsigned long seed, size_t *period)
MPG123_EXPORT int syn123_filter(syn123_handle *sh, void *buf, int encoding, size_t samples)
struct syn123_struct syn123_handle
Definition: syn123.h:141
MPG123_EXPORT size_t syn123_resample_fillcount(long input_rate, long output_rate, size_t outs)
MPG123_EXPORT double syn123_lin2db(double volume)
#define MPG123_EXPORT
Definition: syn123.h:42
MPG123_EXPORT int syn123_query_waves(syn123_handle *sh, size_t *count, int *id, double *freq, double *phase, int *backwards, size_t *period)
Hopefully valid HTML! Valid CSS!