fork/rust-sdks

git clone https://git.julia.blue/fork/rust-sdks

Théo Monnomsoxr-sys (#438)2e4d385

main
3.0 KiB78 linesraw
1/* SoX Resampler Library      Copyright (c) 2007-18 robs@users.sourceforge.net
2 *
3 * This library is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU Lesser General Public License as published by
5 * the Free Software Foundation; either version 2.1 of the License, or (at
6 * your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library; if not, write to the Free Software Foundation,
15 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
16 */
17
18/* Wrapper compatible with `libsamplerate' (constant-rate).
19 * (Libsoxr's native API can be found in soxr.h).  */
20
21#if !defined SAMPLERATE_H
22#define SAMPLERATE_H
23#if defined __cplusplus
24  extern "C" {
25#endif
26
27#if defined SOXR_DLL
28  #if defined soxr_lsr_EXPORTS
29    #define SOXR __declspec(dllexport)
30  #else
31    #define SOXR __declspec(dllimport)
32  #endif
33#elif defined SOXR_VISIBILITY && defined __GNUC__ && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 1)
34  #define SOXR __attribute__ ((visibility("default")))
35#else
36  #define SOXR
37#endif
38
39typedef float   SRC_SAMPLE;
40enum SRC_SRCTYPE_e {SRC_SINC_BEST_QUALITY, SRC_SINC_MEDIUM_QUALITY,
41                    SRC_SINC_FASTEST, SRC_ZERO_ORDER_HOLD, SRC_LINEAR};
42typedef int     SRC_SRCTYPE;
43typedef int     SRC_ERROR;
44typedef long    (* src_callback_t)(void *, SRC_SAMPLE * *);
45typedef struct  soxr SRC_STATE;
46typedef struct  SRC_DATA {
47  SRC_SAMPLE    * data_in, * data_out;
48  long          input_frames, output_frames;
49  long          input_frames_used, output_frames_gen;
50  int           end_of_input;
51  double        src_ratio;
52} SRC_DATA;
53SOXR SRC_STATE *   src_new(SRC_SRCTYPE, int num_channels, SRC_ERROR *);
54SOXR SRC_ERROR     src_process  (SRC_STATE *, SRC_DATA *);
55SOXR SRC_ERROR     src_set_ratio(SRC_STATE *, double);
56SOXR SRC_ERROR     src_reset    (SRC_STATE *);
57SOXR SRC_ERROR     src_error    (SRC_STATE *);
58SOXR SRC_STATE *   src_delete   (SRC_STATE *);
59SOXR SRC_STATE *   src_callback_new(
60                    src_callback_t, SRC_SRCTYPE, int, SRC_ERROR *, void *);
61SOXR long          src_callback_read(
62                    SRC_STATE *, double src_ratio, long, SRC_SAMPLE *);
63SOXR SRC_ERROR     src_simple(SRC_DATA *, SRC_SRCTYPE, int);
64SOXR char const *  src_get_name(SRC_SRCTYPE);
65SOXR char const *  src_get_description(SRC_SRCTYPE);
66SOXR char const *  src_get_version(void);
67SOXR char const *  src_strerror(SRC_ERROR);
68SOXR int           src_is_valid_ratio(double);
69SOXR void          src_short_to_float_array(short const *, float *, int);
70SOXR void          src_float_to_short_array(float const *, short *, int);
71SOXR void          src_int_to_float_array(int const *, float *, int);
72SOXR void          src_float_to_int_array(float const *, int *, int);
73
74#undef SOXR
75#if defined __cplusplus
76  }
77#endif
78#endif