ex

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Committer:
TMBOY
Date:
Tue Jul 18 16:54:45 2017 +0800
Revision:
47:9e361da97763
?

Who changed what in which revision?

UserRevisionLine numberNew contents of line
TMBOY 47:9e361da97763 1 /* Copyright (C) 2007 Jean-Marc Valin
TMBOY 47:9e361da97763 2
TMBOY 47:9e361da97763 3 File: speex_resampler.h
TMBOY 47:9e361da97763 4 Resampling code
TMBOY 47:9e361da97763 5
TMBOY 47:9e361da97763 6 The design goals of this code are:
TMBOY 47:9e361da97763 7 - Very fast algorithm
TMBOY 47:9e361da97763 8 - Low memory requirement
TMBOY 47:9e361da97763 9 - Good *perceptual* quality (and not best SNR)
TMBOY 47:9e361da97763 10
TMBOY 47:9e361da97763 11 Redistribution and use in source and binary forms, with or without
TMBOY 47:9e361da97763 12 modification, are permitted provided that the following conditions are
TMBOY 47:9e361da97763 13 met:
TMBOY 47:9e361da97763 14
TMBOY 47:9e361da97763 15 1. Redistributions of source code must retain the above copyright notice,
TMBOY 47:9e361da97763 16 this list of conditions and the following disclaimer.
TMBOY 47:9e361da97763 17
TMBOY 47:9e361da97763 18 2. Redistributions in binary form must reproduce the above copyright
TMBOY 47:9e361da97763 19 notice, this list of conditions and the following disclaimer in the
TMBOY 47:9e361da97763 20 documentation and/or other materials provided with the distribution.
TMBOY 47:9e361da97763 21
TMBOY 47:9e361da97763 22 3. The name of the author may not be used to endorse or promote products
TMBOY 47:9e361da97763 23 derived from this software without specific prior written permission.
TMBOY 47:9e361da97763 24
TMBOY 47:9e361da97763 25 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
TMBOY 47:9e361da97763 26 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
TMBOY 47:9e361da97763 27 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
TMBOY 47:9e361da97763 28 DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
TMBOY 47:9e361da97763 29 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
TMBOY 47:9e361da97763 30 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
TMBOY 47:9e361da97763 31 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
TMBOY 47:9e361da97763 32 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
TMBOY 47:9e361da97763 33 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
TMBOY 47:9e361da97763 34 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
TMBOY 47:9e361da97763 35 POSSIBILITY OF SUCH DAMAGE.
TMBOY 47:9e361da97763 36 */
TMBOY 47:9e361da97763 37
TMBOY 47:9e361da97763 38
TMBOY 47:9e361da97763 39 #ifndef SPEEX_RESAMPLER_H
TMBOY 47:9e361da97763 40 #define SPEEX_RESAMPLER_H
TMBOY 47:9e361da97763 41
TMBOY 47:9e361da97763 42 #ifdef OUTSIDE_SPEEX
TMBOY 47:9e361da97763 43
TMBOY 47:9e361da97763 44 /********* WARNING: MENTAL SANITY ENDS HERE *************/
TMBOY 47:9e361da97763 45
TMBOY 47:9e361da97763 46 /* If the resampler is defined outside of Speex, we change the symbol names so that
TMBOY 47:9e361da97763 47 there won't be any clash if linking with Speex later on. */
TMBOY 47:9e361da97763 48
TMBOY 47:9e361da97763 49 /* #define RANDOM_PREFIX your software name here */
TMBOY 47:9e361da97763 50 #ifndef RANDOM_PREFIX
TMBOY 47:9e361da97763 51 #error "Please define RANDOM_PREFIX (above) to something specific to your project to prevent symbol name clashes"
TMBOY 47:9e361da97763 52 #endif
TMBOY 47:9e361da97763 53
TMBOY 47:9e361da97763 54 #define CAT_PREFIX2(a,b) a ## b
TMBOY 47:9e361da97763 55 #define CAT_PREFIX(a,b) CAT_PREFIX2(a, b)
TMBOY 47:9e361da97763 56
TMBOY 47:9e361da97763 57 #define speex_resampler_init CAT_PREFIX(RANDOM_PREFIX,_resampler_init)
TMBOY 47:9e361da97763 58 #define speex_resampler_init_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_init_frac)
TMBOY 47:9e361da97763 59 #define speex_resampler_destroy CAT_PREFIX(RANDOM_PREFIX,_resampler_destroy)
TMBOY 47:9e361da97763 60 #define speex_resampler_process_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_float)
TMBOY 47:9e361da97763 61 #define speex_resampler_process_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_int)
TMBOY 47:9e361da97763 62 #define speex_resampler_process_interleaved_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_float)
TMBOY 47:9e361da97763 63 #define speex_resampler_process_interleaved_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_int)
TMBOY 47:9e361da97763 64 #define speex_resampler_set_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate)
TMBOY 47:9e361da97763 65 #define speex_resampler_get_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_get_rate)
TMBOY 47:9e361da97763 66 #define speex_resampler_set_rate_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate_frac)
TMBOY 47:9e361da97763 67 #define speex_resampler_get_ratio CAT_PREFIX(RANDOM_PREFIX,_resampler_get_ratio)
TMBOY 47:9e361da97763 68 #define speex_resampler_set_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_set_quality)
TMBOY 47:9e361da97763 69 #define speex_resampler_get_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_get_quality)
TMBOY 47:9e361da97763 70 #define speex_resampler_set_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_input_stride)
TMBOY 47:9e361da97763 71 #define speex_resampler_get_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_stride)
TMBOY 47:9e361da97763 72 #define speex_resampler_set_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_output_stride)
TMBOY 47:9e361da97763 73 #define speex_resampler_get_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_stride)
TMBOY 47:9e361da97763 74 #define speex_resampler_skip_zeros CAT_PREFIX(RANDOM_PREFIX,_resampler_skip_zeros)
TMBOY 47:9e361da97763 75 #define speex_resampler_reset_mem CAT_PREFIX(RANDOM_PREFIX,_resampler_reset_mem)
TMBOY 47:9e361da97763 76 #define speex_resampler_strerror CAT_PREFIX(RANDOM_PREFIX,_resampler_strerror)
TMBOY 47:9e361da97763 77
TMBOY 47:9e361da97763 78 #define spx_int16_t short
TMBOY 47:9e361da97763 79 #define spx_int32_t int
TMBOY 47:9e361da97763 80 #define spx_uint16_t unsigned short
TMBOY 47:9e361da97763 81 #define spx_uint32_t unsigned int
TMBOY 47:9e361da97763 82
TMBOY 47:9e361da97763 83 #else /* OUTSIDE_SPEEX */
TMBOY 47:9e361da97763 84
TMBOY 47:9e361da97763 85 #include "speex/speex_types.h"
TMBOY 47:9e361da97763 86
TMBOY 47:9e361da97763 87 #endif /* OUTSIDE_SPEEX */
TMBOY 47:9e361da97763 88
TMBOY 47:9e361da97763 89 #ifdef __cplusplus
TMBOY 47:9e361da97763 90 extern "C" {
TMBOY 47:9e361da97763 91 #endif
TMBOY 47:9e361da97763 92
TMBOY 47:9e361da97763 93 #define SPEEX_RESAMPLER_QUALITY_MAX 10
TMBOY 47:9e361da97763 94 #define SPEEX_RESAMPLER_QUALITY_MIN 0
TMBOY 47:9e361da97763 95 #define SPEEX_RESAMPLER_QUALITY_DEFAULT 4
TMBOY 47:9e361da97763 96 #define SPEEX_RESAMPLER_QUALITY_VOIP 3
TMBOY 47:9e361da97763 97 #define SPEEX_RESAMPLER_QUALITY_DESKTOP 5
TMBOY 47:9e361da97763 98
TMBOY 47:9e361da97763 99 enum {
TMBOY 47:9e361da97763 100 RESAMPLER_ERR_SUCCESS = 0,
TMBOY 47:9e361da97763 101 RESAMPLER_ERR_ALLOC_FAILED = 1,
TMBOY 47:9e361da97763 102 RESAMPLER_ERR_BAD_STATE = 2,
TMBOY 47:9e361da97763 103 RESAMPLER_ERR_INVALID_ARG = 3,
TMBOY 47:9e361da97763 104 RESAMPLER_ERR_PTR_OVERLAP = 4,
TMBOY 47:9e361da97763 105
TMBOY 47:9e361da97763 106 RESAMPLER_ERR_MAX_ERROR
TMBOY 47:9e361da97763 107 };
TMBOY 47:9e361da97763 108
TMBOY 47:9e361da97763 109 struct SpeexResamplerState_;
TMBOY 47:9e361da97763 110 typedef struct SpeexResamplerState_ SpeexResamplerState;
TMBOY 47:9e361da97763 111
TMBOY 47:9e361da97763 112 /** Create a new resampler with integer input and output rates.
TMBOY 47:9e361da97763 113 * @param nb_channels Number of channels to be processed
TMBOY 47:9e361da97763 114 * @param in_rate Input sampling rate (integer number of Hz).
TMBOY 47:9e361da97763 115 * @param out_rate Output sampling rate (integer number of Hz).
TMBOY 47:9e361da97763 116 * @param quality Resampling quality between 0 and 10, where 0 has poor quality
TMBOY 47:9e361da97763 117 * and 10 has very high quality.
TMBOY 47:9e361da97763 118 * @return Newly created resampler state
TMBOY 47:9e361da97763 119 * @retval NULL Error: not enough memory
TMBOY 47:9e361da97763 120 */
TMBOY 47:9e361da97763 121 SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels,
TMBOY 47:9e361da97763 122 spx_uint32_t in_rate,
TMBOY 47:9e361da97763 123 spx_uint32_t out_rate,
TMBOY 47:9e361da97763 124 int quality,
TMBOY 47:9e361da97763 125 int *err);
TMBOY 47:9e361da97763 126
TMBOY 47:9e361da97763 127 /** Create a new resampler with fractional input/output rates. The sampling
TMBOY 47:9e361da97763 128 * rate ratio is an arbitrary rational number with both the numerator and
TMBOY 47:9e361da97763 129 * denominator being 32-bit integers.
TMBOY 47:9e361da97763 130 * @param nb_channels Number of channels to be processed
TMBOY 47:9e361da97763 131 * @param ratio_num Numerator of the sampling rate ratio
TMBOY 47:9e361da97763 132 * @param ratio_den Denominator of the sampling rate ratio
TMBOY 47:9e361da97763 133 * @param in_rate Input sampling rate rounded to the nearest integer (in Hz).
TMBOY 47:9e361da97763 134 * @param out_rate Output sampling rate rounded to the nearest integer (in Hz).
TMBOY 47:9e361da97763 135 * @param quality Resampling quality between 0 and 10, where 0 has poor quality
TMBOY 47:9e361da97763 136 * and 10 has very high quality.
TMBOY 47:9e361da97763 137 * @return Newly created resampler state
TMBOY 47:9e361da97763 138 * @retval NULL Error: not enough memory
TMBOY 47:9e361da97763 139 */
TMBOY 47:9e361da97763 140 SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels,
TMBOY 47:9e361da97763 141 spx_uint32_t ratio_num,
TMBOY 47:9e361da97763 142 spx_uint32_t ratio_den,
TMBOY 47:9e361da97763 143 spx_uint32_t in_rate,
TMBOY 47:9e361da97763 144 spx_uint32_t out_rate,
TMBOY 47:9e361da97763 145 int quality,
TMBOY 47:9e361da97763 146 int *err);
TMBOY 47:9e361da97763 147
TMBOY 47:9e361da97763 148 /** Destroy a resampler state.
TMBOY 47:9e361da97763 149 * @param st Resampler state
TMBOY 47:9e361da97763 150 */
TMBOY 47:9e361da97763 151 void speex_resampler_destroy(SpeexResamplerState *st);
TMBOY 47:9e361da97763 152
TMBOY 47:9e361da97763 153 /** Resample a float array. The input and output buffers must *not* overlap.
TMBOY 47:9e361da97763 154 * @param st Resampler state
TMBOY 47:9e361da97763 155 * @param channel_index Index of the channel to process for the multi-channel
TMBOY 47:9e361da97763 156 * base (0 otherwise)
TMBOY 47:9e361da97763 157 * @param in Input buffer
TMBOY 47:9e361da97763 158 * @param in_len Number of input samples in the input buffer. Returns the
TMBOY 47:9e361da97763 159 * number of samples processed
TMBOY 47:9e361da97763 160 * @param out Output buffer
TMBOY 47:9e361da97763 161 * @param out_len Size of the output buffer. Returns the number of samples written
TMBOY 47:9e361da97763 162 */
TMBOY 47:9e361da97763 163 int speex_resampler_process_float(SpeexResamplerState *st,
TMBOY 47:9e361da97763 164 spx_uint32_t channel_index,
TMBOY 47:9e361da97763 165 const float *in,
TMBOY 47:9e361da97763 166 spx_uint32_t *in_len,
TMBOY 47:9e361da97763 167 float *out,
TMBOY 47:9e361da97763 168 spx_uint32_t *out_len);
TMBOY 47:9e361da97763 169
TMBOY 47:9e361da97763 170 /** Resample an int array. The input and output buffers must *not* overlap.
TMBOY 47:9e361da97763 171 * @param st Resampler state
TMBOY 47:9e361da97763 172 * @param channel_index Index of the channel to process for the multi-channel
TMBOY 47:9e361da97763 173 * base (0 otherwise)
TMBOY 47:9e361da97763 174 * @param in Input buffer
TMBOY 47:9e361da97763 175 * @param in_len Number of input samples in the input buffer. Returns the number
TMBOY 47:9e361da97763 176 * of samples processed
TMBOY 47:9e361da97763 177 * @param out Output buffer
TMBOY 47:9e361da97763 178 * @param out_len Size of the output buffer. Returns the number of samples written
TMBOY 47:9e361da97763 179 */
TMBOY 47:9e361da97763 180 int speex_resampler_process_int(SpeexResamplerState *st,
TMBOY 47:9e361da97763 181 spx_uint32_t channel_index,
TMBOY 47:9e361da97763 182 const spx_int16_t *in,
TMBOY 47:9e361da97763 183 spx_uint32_t *in_len,
TMBOY 47:9e361da97763 184 spx_int16_t *out,
TMBOY 47:9e361da97763 185 spx_uint32_t *out_len);
TMBOY 47:9e361da97763 186
TMBOY 47:9e361da97763 187 /** Resample an interleaved float array. The input and output buffers must *not* overlap.
TMBOY 47:9e361da97763 188 * @param st Resampler state
TMBOY 47:9e361da97763 189 * @param in Input buffer
TMBOY 47:9e361da97763 190 * @param in_len Number of input samples in the input buffer. Returns the number
TMBOY 47:9e361da97763 191 * of samples processed. This is all per-channel.
TMBOY 47:9e361da97763 192 * @param out Output buffer
TMBOY 47:9e361da97763 193 * @param out_len Size of the output buffer. Returns the number of samples written.
TMBOY 47:9e361da97763 194 * This is all per-channel.
TMBOY 47:9e361da97763 195 */
TMBOY 47:9e361da97763 196 int speex_resampler_process_interleaved_float(SpeexResamplerState *st,
TMBOY 47:9e361da97763 197 const float *in,
TMBOY 47:9e361da97763 198 spx_uint32_t *in_len,
TMBOY 47:9e361da97763 199 float *out,
TMBOY 47:9e361da97763 200 spx_uint32_t *out_len);
TMBOY 47:9e361da97763 201
TMBOY 47:9e361da97763 202 /** Resample an interleaved int array. The input and output buffers must *not* overlap.
TMBOY 47:9e361da97763 203 * @param st Resampler state
TMBOY 47:9e361da97763 204 * @param in Input buffer
TMBOY 47:9e361da97763 205 * @param in_len Number of input samples in the input buffer. Returns the number
TMBOY 47:9e361da97763 206 * of samples processed. This is all per-channel.
TMBOY 47:9e361da97763 207 * @param out Output buffer
TMBOY 47:9e361da97763 208 * @param out_len Size of the output buffer. Returns the number of samples written.
TMBOY 47:9e361da97763 209 * This is all per-channel.
TMBOY 47:9e361da97763 210 */
TMBOY 47:9e361da97763 211 int speex_resampler_process_interleaved_int(SpeexResamplerState *st,
TMBOY 47:9e361da97763 212 const spx_int16_t *in,
TMBOY 47:9e361da97763 213 spx_uint32_t *in_len,
TMBOY 47:9e361da97763 214 spx_int16_t *out,
TMBOY 47:9e361da97763 215 spx_uint32_t *out_len);
TMBOY 47:9e361da97763 216
TMBOY 47:9e361da97763 217 /** Set (change) the input/output sampling rates (integer value).
TMBOY 47:9e361da97763 218 * @param st Resampler state
TMBOY 47:9e361da97763 219 * @param in_rate Input sampling rate (integer number of Hz).
TMBOY 47:9e361da97763 220 * @param out_rate Output sampling rate (integer number of Hz).
TMBOY 47:9e361da97763 221 */
TMBOY 47:9e361da97763 222 int speex_resampler_set_rate(SpeexResamplerState *st,
TMBOY 47:9e361da97763 223 spx_uint32_t in_rate,
TMBOY 47:9e361da97763 224 spx_uint32_t out_rate);
TMBOY 47:9e361da97763 225
TMBOY 47:9e361da97763 226 /** Get the current input/output sampling rates (integer value).
TMBOY 47:9e361da97763 227 * @param st Resampler state
TMBOY 47:9e361da97763 228 * @param in_rate Input sampling rate (integer number of Hz) copied.
TMBOY 47:9e361da97763 229 * @param out_rate Output sampling rate (integer number of Hz) copied.
TMBOY 47:9e361da97763 230 */
TMBOY 47:9e361da97763 231 void speex_resampler_get_rate(SpeexResamplerState *st,
TMBOY 47:9e361da97763 232 spx_uint32_t *in_rate,
TMBOY 47:9e361da97763 233 spx_uint32_t *out_rate);
TMBOY 47:9e361da97763 234
TMBOY 47:9e361da97763 235 /** Set (change) the input/output sampling rates and resampling ratio
TMBOY 47:9e361da97763 236 * (fractional values in Hz supported).
TMBOY 47:9e361da97763 237 * @param st Resampler state
TMBOY 47:9e361da97763 238 * @param ratio_num Numerator of the sampling rate ratio
TMBOY 47:9e361da97763 239 * @param ratio_den Denominator of the sampling rate ratio
TMBOY 47:9e361da97763 240 * @param in_rate Input sampling rate rounded to the nearest integer (in Hz).
TMBOY 47:9e361da97763 241 * @param out_rate Output sampling rate rounded to the nearest integer (in Hz).
TMBOY 47:9e361da97763 242 */
TMBOY 47:9e361da97763 243 int speex_resampler_set_rate_frac(SpeexResamplerState *st,
TMBOY 47:9e361da97763 244 spx_uint32_t ratio_num,
TMBOY 47:9e361da97763 245 spx_uint32_t ratio_den,
TMBOY 47:9e361da97763 246 spx_uint32_t in_rate,
TMBOY 47:9e361da97763 247 spx_uint32_t out_rate);
TMBOY 47:9e361da97763 248
TMBOY 47:9e361da97763 249 /** Get the current resampling ratio. This will be reduced to the least
TMBOY 47:9e361da97763 250 * common denominator.
TMBOY 47:9e361da97763 251 * @param st Resampler state
TMBOY 47:9e361da97763 252 * @param ratio_num Numerator of the sampling rate ratio copied
TMBOY 47:9e361da97763 253 * @param ratio_den Denominator of the sampling rate ratio copied
TMBOY 47:9e361da97763 254 */
TMBOY 47:9e361da97763 255 void speex_resampler_get_ratio(SpeexResamplerState *st,
TMBOY 47:9e361da97763 256 spx_uint32_t *ratio_num,
TMBOY 47:9e361da97763 257 spx_uint32_t *ratio_den);
TMBOY 47:9e361da97763 258
TMBOY 47:9e361da97763 259 /** Set (change) the conversion quality.
TMBOY 47:9e361da97763 260 * @param st Resampler state
TMBOY 47:9e361da97763 261 * @param quality Resampling quality between 0 and 10, where 0 has poor
TMBOY 47:9e361da97763 262 * quality and 10 has very high quality.
TMBOY 47:9e361da97763 263 */
TMBOY 47:9e361da97763 264 int speex_resampler_set_quality(SpeexResamplerState *st,
TMBOY 47:9e361da97763 265 int quality);
TMBOY 47:9e361da97763 266
TMBOY 47:9e361da97763 267 /** Get the conversion quality.
TMBOY 47:9e361da97763 268 * @param st Resampler state
TMBOY 47:9e361da97763 269 * @param quality Resampling quality between 0 and 10, where 0 has poor
TMBOY 47:9e361da97763 270 * quality and 10 has very high quality.
TMBOY 47:9e361da97763 271 */
TMBOY 47:9e361da97763 272 void speex_resampler_get_quality(SpeexResamplerState *st,
TMBOY 47:9e361da97763 273 int *quality);
TMBOY 47:9e361da97763 274
TMBOY 47:9e361da97763 275 /** Set (change) the input stride.
TMBOY 47:9e361da97763 276 * @param st Resampler state
TMBOY 47:9e361da97763 277 * @param stride Input stride
TMBOY 47:9e361da97763 278 */
TMBOY 47:9e361da97763 279 void speex_resampler_set_input_stride(SpeexResamplerState *st,
TMBOY 47:9e361da97763 280 spx_uint32_t stride);
TMBOY 47:9e361da97763 281
TMBOY 47:9e361da97763 282 /** Get the input stride.
TMBOY 47:9e361da97763 283 * @param st Resampler state
TMBOY 47:9e361da97763 284 * @param stride Input stride copied
TMBOY 47:9e361da97763 285 */
TMBOY 47:9e361da97763 286 void speex_resampler_get_input_stride(SpeexResamplerState *st,
TMBOY 47:9e361da97763 287 spx_uint32_t *stride);
TMBOY 47:9e361da97763 288
TMBOY 47:9e361da97763 289 /** Set (change) the output stride.
TMBOY 47:9e361da97763 290 * @param st Resampler state
TMBOY 47:9e361da97763 291 * @param stride Output stride
TMBOY 47:9e361da97763 292 */
TMBOY 47:9e361da97763 293 void speex_resampler_set_output_stride(SpeexResamplerState *st,
TMBOY 47:9e361da97763 294 spx_uint32_t stride);
TMBOY 47:9e361da97763 295
TMBOY 47:9e361da97763 296 /** Get the output stride.
TMBOY 47:9e361da97763 297 * @param st Resampler state copied
TMBOY 47:9e361da97763 298 * @param stride Output stride
TMBOY 47:9e361da97763 299 */
TMBOY 47:9e361da97763 300 void speex_resampler_get_output_stride(SpeexResamplerState *st,
TMBOY 47:9e361da97763 301 spx_uint32_t *stride);
TMBOY 47:9e361da97763 302
TMBOY 47:9e361da97763 303 /** Make sure that the first samples to go out of the resamplers don't have
TMBOY 47:9e361da97763 304 * leading zeros. This is only useful before starting to use a newly created
TMBOY 47:9e361da97763 305 * resampler. It is recommended to use that when resampling an audio file, as
TMBOY 47:9e361da97763 306 * it will generate a file with the same length. For real-time processing,
TMBOY 47:9e361da97763 307 * it is probably easier not to use this call (so that the output duration
TMBOY 47:9e361da97763 308 * is the same for the first frame).
TMBOY 47:9e361da97763 309 * @param st Resampler state
TMBOY 47:9e361da97763 310 */
TMBOY 47:9e361da97763 311 int speex_resampler_skip_zeros(SpeexResamplerState *st);
TMBOY 47:9e361da97763 312
TMBOY 47:9e361da97763 313 /** Reset a resampler so a new (unrelated) stream can be processed.
TMBOY 47:9e361da97763 314 * @param st Resampler state
TMBOY 47:9e361da97763 315 */
TMBOY 47:9e361da97763 316 int speex_resampler_reset_mem(SpeexResamplerState *st);
TMBOY 47:9e361da97763 317
TMBOY 47:9e361da97763 318 /** Returns the English meaning for an error code
TMBOY 47:9e361da97763 319 * @param err Error code
TMBOY 47:9e361da97763 320 * @return English string
TMBOY 47:9e361da97763 321 */
TMBOY 47:9e361da97763 322 const char *speex_resampler_strerror(int err);
TMBOY 47:9e361da97763 323
TMBOY 47:9e361da97763 324 #ifdef __cplusplus
TMBOY 47:9e361da97763 325 }
TMBOY 47:9e361da97763 326 #endif
TMBOY 47:9e361da97763 327
TMBOY 47:9e361da97763 328 #endif