2
* Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Library General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Library General Public License for more details.
14
* You should have received a copy of the GNU Library General Public
15
* License along with this library; if not, write to the
16
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17
* Boston, MA 02111-1307, USA.
20
#ifndef __SPEEX_RESAMPLER_WRAPPER_H__
21
#define __SPEEX_RESAMPLER_WRAPPER_H__
23
#define SPEEX_RESAMPLER_QUALITY_MAX 10
24
#define SPEEX_RESAMPLER_QUALITY_MIN 0
25
#define SPEEX_RESAMPLER_QUALITY_DEFAULT 4
26
#define SPEEX_RESAMPLER_QUALITY_VOIP 3
27
#define SPEEX_RESAMPLER_QUALITY_DESKTOP 5
31
RESAMPLER_ERR_SUCCESS = 0,
32
RESAMPLER_ERR_ALLOC_FAILED = 1,
33
RESAMPLER_ERR_BAD_STATE = 2,
34
RESAMPLER_ERR_INVALID_ARG = 3,
35
RESAMPLER_ERR_PTR_OVERLAP = 4,
37
RESAMPLER_ERR_MAX_ERROR
40
typedef struct SpeexResamplerState_ SpeexResamplerState;
42
SpeexResamplerState *resample_float_resampler_init (guint32 nb_channels,
43
guint32 in_rate, guint32 out_rate, gint quality, gint * err);
44
SpeexResamplerState *resample_int_resampler_init (guint32 nb_channels,
45
guint32 in_rate, guint32 out_rate, gint quality, gint * err);
47
#define resample_resampler_destroy resample_int_resampler_destroy
48
void resample_resampler_destroy (SpeexResamplerState * st);
50
int resample_float_resampler_process_interleaved_float (SpeexResamplerState *
51
st, const gfloat * in, guint32 * in_len, gfloat * out, guint32 * out_len);
52
int resample_int_resampler_process_interleaved_int (SpeexResamplerState * st,
53
const gint16 * in, guint32 * in_len, gint16 * out, guint32 * out_len);
55
int resample_float_resampler_set_rate (SpeexResamplerState * st,
56
guint32 in_rate, guint32 out_rate);
57
int resample_int_resampler_set_rate (SpeexResamplerState * st,
58
guint32 in_rate, guint32 out_rate);
60
void resample_float_resampler_get_rate (SpeexResamplerState * st,
61
guint32 * in_rate, guint32 * out_rate);
62
void resample_int_resampler_get_rate (SpeexResamplerState * st,
63
guint32 * in_rate, guint32 * out_rate);
65
void resample_float_resampler_get_ratio (SpeexResamplerState * st,
66
guint32 * ratio_num, guint32 * ratio_den);
67
void resample_int_resampler_get_ratio (SpeexResamplerState * st,
68
guint32 * ratio_num, guint32 * ratio_den);
70
int resample_float_resampler_get_input_latency (SpeexResamplerState * st);
71
int resample_int_resampler_get_input_latency (SpeexResamplerState * st);
73
int resample_float_resampler_set_quality (SpeexResamplerState * st,
75
int resample_int_resampler_set_quality (SpeexResamplerState * st, gint quality);
77
int resample_float_resampler_reset_mem (SpeexResamplerState * st);
78
int resample_int_resampler_reset_mem (SpeexResamplerState * st);
80
int resample_float_resampler_skip_zeros (SpeexResamplerState * st);
81
int resample_int_resampler_skip_zeros (SpeexResamplerState * st);
83
#define resample_resampler_strerror resample_int_resampler_strerror
84
const char *resample_resampler_strerror (gint err);
86
#endif /* __SPEEX_RESAMPLER_WRAPPER_H__ */