39#ifndef SPEEX_RESAMPLER_H
40#define SPEEX_RESAMPLER_H
49#define RANDOM_PREFIX speex
51#error "Please define RANDOM_PREFIX (above) to something specific to your project to prevent symbol name clashes"
54#define CAT_PREFIX2(a,b) a ## b
55#define CAT_PREFIX(a,b) CAT_PREFIX2(a, b)
57#define speex_resampler_init CAT_PREFIX(RANDOM_PREFIX,_resampler_init)
58#define speex_resampler_init_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_init_frac)
59#define speex_resampler_destroy CAT_PREFIX(RANDOM_PREFIX,_resampler_destroy)
60#define speex_resampler_process_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_float)
61#define speex_resampler_process_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_int)
62#define speex_resampler_process_interleaved_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_float)
63#define speex_resampler_process_interleaved_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_int)
64#define speex_resampler_set_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate)
65#define speex_resampler_get_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_get_rate)
66#define speex_resampler_set_rate_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate_frac)
67#define speex_resampler_get_ratio CAT_PREFIX(RANDOM_PREFIX,_resampler_get_ratio)
68#define speex_resampler_set_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_set_quality)
69#define speex_resampler_get_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_get_quality)
70#define speex_resampler_set_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_input_stride)
71#define speex_resampler_get_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_stride)
72#define speex_resampler_set_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_output_stride)
73#define speex_resampler_get_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_stride)
74#define speex_resampler_get_input_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_latency)
75#define speex_resampler_get_output_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_latency)
76#define speex_resampler_skip_zeros CAT_PREFIX(RANDOM_PREFIX,_resampler_skip_zeros)
77#define speex_resampler_reset_mem CAT_PREFIX(RANDOM_PREFIX,_resampler_reset_mem)
78#define speex_resampler_strerror CAT_PREFIX(RANDOM_PREFIX,_resampler_strerror)
80#define spx_int16_t short
81#define spx_int32_t int
82#define spx_uint16_t unsigned short
83#define spx_uint32_t unsigned int
87#include "speex/speex_types.h"
95#define SPEEX_RESAMPLER_QUALITY_MAX 10
96#define SPEEX_RESAMPLER_QUALITY_MIN 0
97#define SPEEX_RESAMPLER_QUALITY_DEFAULT 4
98#define SPEEX_RESAMPLER_QUALITY_VOIP 3
99#define SPEEX_RESAMPLER_QUALITY_DESKTOP 5
145 spx_uint32_t ratio_num,
146 spx_uint32_t ratio_den,
168 spx_uint32_t channel_index,
170 spx_uint32_t *in_len,
172 spx_uint32_t *out_len);
185 spx_uint32_t channel_index,
186 const spx_int16_t *
in,
187 spx_uint32_t *in_len,
189 spx_uint32_t *out_len);
202 spx_uint32_t *in_len,
204 spx_uint32_t *out_len);
216 const spx_int16_t *
in,
217 spx_uint32_t *in_len,
219 spx_uint32_t *out_len);
248 spx_uint32_t ratio_num,
249 spx_uint32_t ratio_den,
260 spx_uint32_t *ratio_num,
261 spx_uint32_t *ratio_den);
284 spx_uint32_t stride);
291 spx_uint32_t *stride);
298 spx_uint32_t stride);
305 spx_uint32_t *stride);
int speex_resampler_set_rate_frac(SpeexResamplerState *st, spx_uint32_t ratio_num, spx_uint32_t ratio_den, spx_uint32_t in_rate, spx_uint32_t out_rate)
void speex_resampler_set_input_stride(SpeexResamplerState *st, spx_uint32_t stride)
@ RESAMPLER_ERR_BAD_STATE
@ RESAMPLER_ERR_ALLOC_FAILED
@ RESAMPLER_ERR_INVALID_ARG
@ RESAMPLER_ERR_MAX_ERROR
@ RESAMPLER_ERR_PTR_OVERLAP
void speex_resampler_get_output_stride(SpeexResamplerState *st, spx_uint32_t *stride)
int speex_resampler_process_float(SpeexResamplerState *st, spx_uint32_t channel_index, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
void speex_resampler_destroy(SpeexResamplerState *st)
SpeexResamplerState * speex_resampler_init(spx_uint32_t nb_channels, spx_uint32_t in_rate, spx_uint32_t out_rate, int quality, int *err)
Create a new resampler with integer input and output rates.
int speex_resampler_skip_zeros(SpeexResamplerState *st)
SpeexResamplerState * speex_resampler_init_frac(spx_uint32_t nb_channels, spx_uint32_t ratio_num, spx_uint32_t ratio_den, spx_uint32_t in_rate, spx_uint32_t out_rate, int quality, int *err)
const char * speex_resampler_strerror(int err)
int speex_resampler_process_int(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len)
void speex_resampler_get_rate(SpeexResamplerState *st, spx_uint32_t *in_rate, spx_uint32_t *out_rate)
void speex_resampler_get_ratio(SpeexResamplerState *st, spx_uint32_t *ratio_num, spx_uint32_t *ratio_den)
int speex_resampler_get_input_latency(SpeexResamplerState *st)
int speex_resampler_set_quality(SpeexResamplerState *st, int quality)
void speex_resampler_set_output_stride(SpeexResamplerState *st, spx_uint32_t stride)
int speex_resampler_get_output_latency(SpeexResamplerState *st)
int speex_resampler_process_interleaved_float(SpeexResamplerState *st, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
void speex_resampler_get_input_stride(SpeexResamplerState *st, spx_uint32_t *stride)
int speex_resampler_process_interleaved_int(SpeexResamplerState *st, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len)
void speex_resampler_get_quality(SpeexResamplerState *st, int *quality)
int speex_resampler_set_rate(SpeexResamplerState *st, spx_uint32_t in_rate, spx_uint32_t out_rate)
int speex_resampler_reset_mem(SpeexResamplerState *st)