ReactOS  0.4.12-dev-919-gfc3b8d5
samplerate.c File Reference
#include "precomp.h"
Include dependency graph for samplerate.c:

Go to the source code of this file.

Functions

static int psrc_set_converter (SRC_PRIVATE *psrc, int converter_type)
 
SRC_STATEsrc_new (int converter_type, int channels, int *error)
 
SRC_STATEsrc_callback_new (src_callback_t func, int converter_type, int channels, int *error, void *cb_data)
 
SRC_STATEsrc_delete (SRC_STATE *state)
 
int src_process (SRC_STATE *state, SRC_DATA *data)
 
long src_callback_read (SRC_STATE *state, double src_ratio, long frames, float *data)
 
int src_set_ratio (SRC_STATE *state, double new_ratio)
 
int src_get_channels (SRC_STATE *state)
 
int src_reset (SRC_STATE *state)
 
const charsrc_get_name (int converter_type)
 
const charsrc_get_description (int converter_type)
 
const charsrc_get_version (void)
 
int src_is_valid_ratio (double ratio)
 
int src_error (SRC_STATE *state)
 
const charsrc_strerror (int error)
 
int src_simple (SRC_DATA *src_data, int converter, int channels)
 
void src_short_to_float_array (const short *in, float *out, int len)
 
void src_float_to_short_array (const float *in, short *out, int len)
 
void src_int_to_float_array (const int *in, float *out, int len)
 
void src_float_to_int_array (const float *in, int *out, int len)
 

Function Documentation

◆ psrc_set_converter()

static int psrc_set_converter ( SRC_PRIVATE psrc,
int  converter_type 
)
static

Definition at line 519 of file samplerate.c.

520 {
521  if (sinc_set_converter (psrc, converter_type) == SRC_ERR_NO_ERROR)
522  return SRC_ERR_NO_ERROR ;
523 
524  if (zoh_set_converter (psrc, converter_type) == SRC_ERR_NO_ERROR)
525  return SRC_ERR_NO_ERROR ;
526 
527  if (linear_set_converter (psrc, converter_type) == SRC_ERR_NO_ERROR)
528  return SRC_ERR_NO_ERROR ;
529 
530  return SRC_ERR_BAD_CONVERTER ;
531 } /* psrc_set_converter */
int sinc_set_converter(SRC_PRIVATE *psrc, int src_enum)
Definition: src_sinc.c:133
int zoh_set_converter(SRC_PRIVATE *psrc, int src_enum)
Definition: src_zoh.c:146
int linear_set_converter(SRC_PRIVATE *psrc, int src_enum)
Definition: src_linear.c:155

Referenced by src_new().

◆ src_callback_new()

SRC_STATE* src_callback_new ( src_callback_t  func,
int  converter_type,
int  channels,
int error,
void cb_data 
)

Definition at line 49 of file samplerate.c.

50 { SRC_STATE *src_state ;
51 
52  if (func == NULL)
53  { if (error)
55  return NULL ;
56  } ;
57 
58  if (error != NULL)
59  *error = 0 ;
60 
61  if ((src_state = src_new (converter_type, channels, error)) == NULL)
62  return NULL ;
63 
64  src_reset (src_state) ;
65 
66  ((SRC_PRIVATE*) src_state)->mode = SRC_MODE_CALLBACK ;
67  ((SRC_PRIVATE*) src_state)->callback_func = func ;
68  ((SRC_PRIVATE*) src_state)->user_callback_data = cb_data ;
69 
70  return src_state ;
71 } /* src_callback_new */
GLenum func
Definition: glext.h:6028
SRC_STATE * src_new(int converter_type, int channels, int *error)
Definition: samplerate.c:15
#define error(str)
Definition: mkdosfs.c:1605
int This channels
Definition: rdpsnd_libao.c:37
struct SRC_STATE_tag SRC_STATE
Definition: samplerate.h:23
smooth NULL
Definition: ftsmooth.c:416
int src_reset(SRC_STATE *state)
Definition: samplerate.c:283

◆ src_callback_read()

long src_callback_read ( SRC_STATE state,
double  src_ratio,
long  frames,
float *  data 
)

Definition at line 153 of file samplerate.c.

154 { SRC_PRIVATE *psrc ;
155  SRC_DATA src_data ;
156 
157  long output_frames_gen ;
158  int error = 0 ;
159 
160  if (state == NULL)
161  return 0 ;
162 
163  if (frames <= 0)
164  return 0 ;
165 
166  psrc = (SRC_PRIVATE*) state ;
167 
168  if (psrc->mode != SRC_MODE_CALLBACK)
169  { psrc->error = SRC_ERR_BAD_MODE ;
170  return 0 ;
171  } ;
172 
173  if (psrc->callback_func == NULL)
174  { psrc->error = SRC_ERR_NULL_CALLBACK ;
175  return 0 ;
176  } ;
177 
178  memset (&src_data, 0, sizeof (src_data)) ;
179 
180  /* Check src_ratio is in range. */
181  if (is_bad_src_ratio (src_ratio))
182  { psrc->error = SRC_ERR_BAD_SRC_RATIO ;
183  return 0 ;
184  } ;
185 
186  /* Switch modes temporarily. */
187  src_data.src_ratio = src_ratio ;
188  src_data.data_out = data ;
189  src_data.output_frames = frames ;
190 
191  src_data.data_in = psrc->saved_data ;
192  src_data.input_frames = psrc->saved_frames ;
193 
194  output_frames_gen = 0 ;
195  while (output_frames_gen < frames)
196  { /* Use a dummy array for the case where the callback function
197  ** returns without setting the ptr.
198  */
199  float dummy [1] ;
200 
201  if (src_data.input_frames == 0)
202  { float *ptr = dummy ;
203 
204  src_data.input_frames = psrc->callback_func (psrc->user_callback_data, &ptr) ;
205  src_data.data_in = ptr ;
206 
207  if (src_data.input_frames == 0)
208  src_data.end_of_input = 1 ;
209  } ;
210 
211  /*
212  ** Now call process function. However, we need to set the mode
213  ** to SRC_MODE_PROCESS first and when we return set it back to
214  ** SRC_MODE_CALLBACK.
215  */
216  psrc->mode = SRC_MODE_PROCESS ;
217  error = src_process (state, &src_data) ;
218  psrc->mode = SRC_MODE_CALLBACK ;
219 
220  if (error != 0)
221  break ;
222 
223  src_data.data_in += src_data.input_frames_used * psrc->channels ;
224  src_data.input_frames -= src_data.input_frames_used ;
225 
226  src_data.data_out += src_data.output_frames_gen * psrc->channels ;
227  src_data.output_frames -= src_data.output_frames_gen ;
228 
229  output_frames_gen += src_data.output_frames_gen ;
230 
231  if (src_data.end_of_input == SRC_TRUE && src_data.output_frames_gen == 0)
232  break ;
233  } ;
234 
235  psrc->saved_data = src_data.data_in ;
236  psrc->saved_frames = src_data.input_frames ;
237 
238  if (error != 0)
239  { psrc->error = error ;
240  return 0 ;
241  } ;
242 
243  return output_frames_gen ;
244 } /* src_callback_read */
#define error(str)
Definition: mkdosfs.c:1605
long output_frames
Definition: samplerate.h:30
long input_frames
Definition: samplerate.h:30
float * data_out
Definition: samplerate.h:28
static PVOID ptr
Definition: dispmode.c:27
long output_frames_gen
Definition: samplerate.h:31
smooth NULL
Definition: ftsmooth.c:416
src_callback_t callback_func
Definition: common.h:114
const float * data_in
Definition: samplerate.h:27
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
void * user_callback_data
Definition: common.h:115
static int state
Definition: maze.c:121
int end_of_input
Definition: samplerate.h:33
unsigned char dummy
Definition: maze.c:118
long saved_frames
Definition: common.h:116
int channels
Definition: common.h:96
const float * saved_data
Definition: common.h:117
int src_process(SRC_STATE *state, SRC_DATA *data)
Definition: samplerate.c:89
double src_ratio
Definition: samplerate.h:35
#define memset(x, y, z)
Definition: compat.h:39
long input_frames_used
Definition: samplerate.h:31
static int is_bad_src_ratio(double ratio)
Definition: common.h:154

◆ src_delete()

SRC_STATE* src_delete ( SRC_STATE state)

Definition at line 74 of file samplerate.c.

75 { SRC_PRIVATE *psrc ;
76 
77  psrc = (SRC_PRIVATE*) state ;
78  if (psrc)
79  { if (psrc->private_data)
80  free (psrc->private_data) ;
81  memset (psrc, 0, sizeof (SRC_PRIVATE)) ;
82  free (psrc) ;
83  } ;
84 
85  return NULL ;
86 } /* src_state */
#define free
Definition: debug_ros.c:5
smooth NULL
Definition: ftsmooth.c:416
static int state
Definition: maze.c:121
#define memset(x, y, z)
Definition: compat.h:39
void * private_data
Definition: common.h:102

Referenced by PerformSampleRateConversion(), and src_simple().

◆ src_error()

int src_error ( SRC_STATE state)

Definition at line 358 of file samplerate.c.

359 { if (state)
360  return ((SRC_PRIVATE*) state)->error ;
361  return SRC_ERR_NO_ERROR ;
362 } /* src_error */
static int state
Definition: maze.c:121

◆ src_float_to_int_array()

void src_float_to_int_array ( const float *  in,
int out,
int  len 
)

Definition at line 493 of file samplerate.c.

494 { double scaled_value ;
495 
496  while (len)
497  { len -- ;
498 
499  scaled_value = in [len] * (8.0 * 0x10000000) ;
500  if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFFFF))
501  { out [len] = 0x7fffffff ;
502  continue ;
503  } ;
504  if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000))
505  { out [len] = -1 - 0x7fffffff ;
506  continue ;
507  } ;
508 
509  out [len] = lrint (scaled_value) ;
510  } ;
511 
512 } /* src_float_to_int_array */
#define CPU_CLIPS_POSITIVE
Definition: config.h:44
_Check_return_ __CRT_INLINE long lrint(_In_ double x)
Definition: math.h:267
static FILE * out
Definition: regtests2xml.c:44
#define CPU_CLIPS_NEGATIVE
Definition: config.h:41
GLenum GLsizei len
Definition: glext.h:6722
GLuint in
Definition: glext.h:9616

Referenced by PerformSampleRateConversion().

◆ src_float_to_short_array()

void src_float_to_short_array ( const float *  in,
short out,
int  len 
)

Definition at line 460 of file samplerate.c.

461 { double scaled_value ;
462 
463  while (len)
464  { len -- ;
465 
466  scaled_value = in [len] * (8.0 * 0x10000000) ;
467  if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFFFF))
468  { out [len] = 32767 ;
469  continue ;
470  } ;
471  if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000))
472  { out [len] = -32768 ;
473  continue ;
474  } ;
475 
476  out [len] = (short) (lrint (scaled_value) >> 16) ;
477  } ;
478 
479 } /* src_float_to_short_array */
#define CPU_CLIPS_POSITIVE
Definition: config.h:44
_Check_return_ __CRT_INLINE long lrint(_In_ double x)
Definition: math.h:267
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
static FILE * out
Definition: regtests2xml.c:44
#define CPU_CLIPS_NEGATIVE
Definition: config.h:41
GLenum GLsizei len
Definition: glext.h:6722
GLuint in
Definition: glext.h:9616

Referenced by PerformSampleRateConversion().

◆ src_get_channels()

int src_get_channels ( SRC_STATE state)

Definition at line 269 of file samplerate.c.

270 { SRC_PRIVATE *psrc ;
271 
272  psrc = (SRC_PRIVATE*) state ;
273 
274  if (psrc == NULL)
275  return SRC_ERR_BAD_STATE ;
276  if (psrc->vari_process == NULL || psrc->const_process == NULL)
277  return SRC_ERR_BAD_PROC_PTR ;
278 
279  return psrc->channels ;
280 } /* src_get_channels */
int(* vari_process)(struct SRC_PRIVATE_tag *psrc, SRC_DATA *data)
Definition: common.h:105
smooth NULL
Definition: ftsmooth.c:416
static int state
Definition: maze.c:121
int(* const_process)(struct SRC_PRIVATE_tag *psrc, SRC_DATA *data)
Definition: common.h:108
int channels
Definition: common.h:96

◆ src_get_description()

const char* src_get_description ( int  converter_type)

Definition at line 324 of file samplerate.c.

325 { const char *desc ;
326 
327  if ((desc = sinc_get_description (converter_type)) != NULL)
328  return desc ;
329 
330  if ((desc = zoh_get_description (converter_type)) != NULL)
331  return desc ;
332 
333  if ((desc = linear_get_description (converter_type)) != NULL)
334  return desc ;
335 
336  return NULL ;
337 } /* src_get_description */
const char * linear_get_description(int src_enum)
Definition: src_linear.c:146
const char * sinc_get_description(int src_enum)
Definition: src_sinc.c:113
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
const char * zoh_get_description(int src_enum)
Definition: src_zoh.c:137

◆ src_get_name()

const char* src_get_name ( int  converter_type)

Definition at line 308 of file samplerate.c.

309 { const char *desc ;
310 
311  if ((desc = sinc_get_name (converter_type)) != NULL)
312  return desc ;
313 
314  if ((desc = zoh_get_name (converter_type)) != NULL)
315  return desc ;
316 
317  if ((desc = linear_get_name (converter_type)) != NULL)
318  return desc ;
319 
320  return NULL ;
321 } /* src_get_name */
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
const char * linear_get_name(int src_enum)
Definition: src_linear.c:137
const char * zoh_get_name(int src_enum)
Definition: src_zoh.c:128
const char * sinc_get_name(int src_enum)
Definition: src_sinc.c:94

◆ src_get_version()

const char* src_get_version ( void  )

Definition at line 340 of file samplerate.c.

341 { return PACKAGE "-" VERSION " (c) 2002-2008 Erik de Castro Lopo" ;
342 } /* src_get_version */
#define PACKAGE
Definition: config.h:21
#define VERSION
Definition: rdesktop.h:45

◆ src_int_to_float_array()

void src_int_to_float_array ( const int in,
float *  out,
int  len 
)

Definition at line 482 of file samplerate.c.

483 {
484  while (len)
485  { len -- ;
486  out [len] = (float) (in [len] / (8.0 * 0x10000000)) ;
487  } ;
488 
489  return ;
490 } /* src_int_to_float_array */
return
Definition: dirsup.c:529
static FILE * out
Definition: regtests2xml.c:44
GLenum GLsizei len
Definition: glext.h:6722
GLuint in
Definition: glext.h:9616

Referenced by PerformSampleRateConversion().

◆ src_is_valid_ratio()

int src_is_valid_ratio ( double  ratio)

Definition at line 345 of file samplerate.c.

346 {
347  if (is_bad_src_ratio (ratio))
348  return SRC_FALSE ;
349 
350  return SRC_TRUE ;
351 } /* src_is_valid_ratio */
static int is_bad_src_ratio(double ratio)
Definition: common.h:154

◆ src_new()

SRC_STATE* src_new ( int  converter_type,
int  channels,
int error 
)

Definition at line 15 of file samplerate.c.

16 { SRC_PRIVATE *psrc ;
17 
18  if (error)
20 
21  if (channels < 1)
22  { if (error)
24  return NULL ;
25  } ;
26 
27  if ((psrc = calloc (1, sizeof (*psrc))) == NULL)
28  { if (error)
30  return NULL ;
31  } ;
32 
33  psrc->channels = channels ;
34  psrc->mode = SRC_MODE_PROCESS ;
35 
36  if (psrc_set_converter (psrc, converter_type) != SRC_ERR_NO_ERROR)
37  { if (error)
39  free (psrc) ;
40  psrc = NULL ;
41  } ;
42 
43  src_reset ((SRC_STATE*) psrc) ;
44 
45  return (SRC_STATE*) psrc ;
46 } /* src_new */
#define error(str)
Definition: mkdosfs.c:1605
#define free
Definition: debug_ros.c:5
static int psrc_set_converter(SRC_PRIVATE *psrc, int converter_type)
Definition: samplerate.c:519
int This channels
Definition: rdpsnd_libao.c:37
struct SRC_STATE_tag SRC_STATE
Definition: samplerate.h:23
smooth NULL
Definition: ftsmooth.c:416
int channels
Definition: common.h:96
#define calloc
Definition: rosglue.h:14
int src_reset(SRC_STATE *state)
Definition: samplerate.c:283

Referenced by PerformSampleRateConversion(), src_callback_new(), and src_simple().

◆ src_process()

int src_process ( SRC_STATE state,
SRC_DATA data 
)

Definition at line 89 of file samplerate.c.

90 { SRC_PRIVATE *psrc ;
91  int error ;
92 
93  psrc = (SRC_PRIVATE*) state ;
94 
95  if (psrc == NULL)
96  return SRC_ERR_BAD_STATE ;
97  if (psrc->vari_process == NULL || psrc->const_process == NULL)
98  return SRC_ERR_BAD_PROC_PTR ;
99 
100  if (psrc->mode != SRC_MODE_PROCESS)
101  return SRC_ERR_BAD_MODE ;
102 
103  /* Check for valid SRC_DATA first. */
104  if (data == NULL)
105  return SRC_ERR_BAD_DATA ;
106 
107  /* And that data_in and data_out are valid. */
108  if (data->data_in == NULL || data->data_out == NULL)
109  return SRC_ERR_BAD_DATA_PTR ;
110 
111  /* Check src_ratio is in range. */
112  if (is_bad_src_ratio (data->src_ratio))
113  return SRC_ERR_BAD_SRC_RATIO ;
114 
115  if (data->input_frames < 0)
116  data->input_frames = 0 ;
117  if (data->output_frames < 0)
118  data->output_frames = 0 ;
119 
120  if (data->data_in < data->data_out)
121  { if (data->data_in + data->input_frames * psrc->channels > data->data_out)
122  { /*-printf ("\n\ndata_in: %p data_out: %p\n",
123  (void*) (data->data_in + data->input_frames * psrc->channels), (void*) data->data_out) ;-*/
124  return SRC_ERR_DATA_OVERLAP ;
125  } ;
126  }
127  else if (data->data_out + data->output_frames * psrc->channels > data->data_in)
128  { /*-printf ("\n\ndata_in : %p ouput frames: %ld data_out: %p\n", (void*) data->data_in, data->output_frames, (void*) data->data_out) ;
129 
130  printf ("data_out: %p (%p) data_in: %p\n", (void*) data->data_out,
131  (void*) (data->data_out + data->input_frames * psrc->channels), (void*) data->data_in) ;-*/
132  return SRC_ERR_DATA_OVERLAP ;
133  } ;
134 
135  /* Set the input and output counts to zero. */
136  data->input_frames_used = 0 ;
137  data->output_frames_gen = 0 ;
138 
139  /* Special case for when last_ratio has not been set. */
140  if (psrc->last_ratio < (1.0 / SRC_MAX_RATIO))
141  psrc->last_ratio = data->src_ratio ;
142 
143  /* Now process. */
144  if (fabs (psrc->last_ratio - data->src_ratio) < 1e-15)
145  error = psrc->const_process (psrc, data) ;
146  else
147  error = psrc->vari_process (psrc, data) ;
148 
149  return error ;
150 } /* src_process */
#define error(str)
Definition: mkdosfs.c:1605
int(* vari_process)(struct SRC_PRIVATE_tag *psrc, SRC_DATA *data)
Definition: common.h:105
#define SRC_MAX_RATIO
Definition: common.h:20
#define e
Definition: ke_i.h:82
smooth NULL
Definition: ftsmooth.c:416
if(!(yy_init))
Definition: macro.lex.yy.c:714
double last_ratio
Definition: common.h:93
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static int state
Definition: maze.c:121
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
int(* const_process)(struct SRC_PRIVATE_tag *psrc, SRC_DATA *data)
Definition: common.h:108
int channels
Definition: common.h:96
static int is_bad_src_ratio(double ratio)
Definition: common.h:154

Referenced by PerformSampleRateConversion(), src_callback_read(), and src_simple().

◆ src_reset()

int src_reset ( SRC_STATE state)

Definition at line 283 of file samplerate.c.

284 { SRC_PRIVATE *psrc ;
285 
286  if ((psrc = (SRC_PRIVATE*) state) == NULL)
287  return SRC_ERR_BAD_STATE ;
288 
289  if (psrc->reset != NULL)
290  psrc->reset (psrc) ;
291 
292  psrc->last_position = 0.0 ;
293  psrc->last_ratio = 0.0 ;
294 
295  psrc->saved_data = NULL ;
296  psrc->saved_frames = 0 ;
297 
298  psrc->error = SRC_ERR_NO_ERROR ;
299 
300  return SRC_ERR_NO_ERROR ;
301 } /* src_reset */
smooth NULL
Definition: ftsmooth.c:416
double last_ratio
Definition: common.h:93
void(* reset)(struct SRC_PRIVATE_tag *psrc)
Definition: common.h:111
double last_position
Definition: common.h:93
static int state
Definition: maze.c:121
long saved_frames
Definition: common.h:116
const float * saved_data
Definition: common.h:117

Referenced by src_callback_new(), and src_new().

◆ src_set_ratio()

int src_set_ratio ( SRC_STATE state,
double  new_ratio 
)

Definition at line 250 of file samplerate.c.

251 { SRC_PRIVATE *psrc ;
252 
253  psrc = (SRC_PRIVATE*) state ;
254 
255  if (psrc == NULL)
256  return SRC_ERR_BAD_STATE ;
257  if (psrc->vari_process == NULL || psrc->const_process == NULL)
258  return SRC_ERR_BAD_PROC_PTR ;
259 
260  if (is_bad_src_ratio (new_ratio))
261  return SRC_ERR_BAD_SRC_RATIO ;
262 
263  psrc->last_ratio = new_ratio ;
264 
265  return SRC_ERR_NO_ERROR ;
266 } /* src_set_ratio */
int(* vari_process)(struct SRC_PRIVATE_tag *psrc, SRC_DATA *data)
Definition: common.h:105
smooth NULL
Definition: ftsmooth.c:416
double last_ratio
Definition: common.h:93
static int state
Definition: maze.c:121
int(* const_process)(struct SRC_PRIVATE_tag *psrc, SRC_DATA *data)
Definition: common.h:108
static int is_bad_src_ratio(double ratio)
Definition: common.h:154

◆ src_short_to_float_array()

void src_short_to_float_array ( const short in,
float *  out,
int  len 
)

Definition at line 449 of file samplerate.c.

450 {
451  while (len)
452  { len -- ;
453  out [len] = (float) (in [len] / (1.0 * 0x8000)) ;
454  } ;
455 
456  return ;
457 } /* src_short_to_float_array */
return
Definition: dirsup.c:529
static FILE * out
Definition: regtests2xml.c:44
GLenum GLsizei len
Definition: glext.h:6722
GLuint in
Definition: glext.h:9616

Referenced by PerformSampleRateConversion().

◆ src_simple()

int src_simple ( SRC_DATA src_data,
int  converter,
int  channels 
)

Definition at line 432 of file samplerate.c.

433 { SRC_STATE *src_state ;
434  int error ;
435 
436  if ((src_state = src_new (converter, channels, &error)) == NULL)
437  return error ;
438 
439  src_data->end_of_input = 1 ; /* Only one buffer worth of input. */
440 
441  error = src_process (src_state, src_data) ;
442 
443  src_delete (src_state) ;
444 
445  return error ;
446 } /* src_simple */
SRC_STATE * src_new(int converter_type, int channels, int *error)
Definition: samplerate.c:15
#define error(str)
Definition: mkdosfs.c:1605
int This channels
Definition: rdpsnd_libao.c:37
struct SRC_STATE_tag SRC_STATE
Definition: samplerate.h:23
smooth NULL
Definition: ftsmooth.c:416
SRC_STATE * src_delete(SRC_STATE *state)
Definition: samplerate.c:74
int end_of_input
Definition: samplerate.h:33
int src_process(SRC_STATE *state, SRC_DATA *data)
Definition: samplerate.c:89

◆ src_strerror()

const char* src_strerror ( int  error)

Definition at line 365 of file samplerate.c.

366 {
367  switch (error)
368  { case SRC_ERR_NO_ERROR :
369  return "No error." ;
370  case SRC_ERR_MALLOC_FAILED :
371  return "Malloc failed." ;
372  case SRC_ERR_BAD_STATE :
373  return "SRC_STATE pointer is NULL." ;
374  case SRC_ERR_BAD_DATA :
375  return "SRC_DATA pointer is NULL." ;
376  case SRC_ERR_BAD_DATA_PTR :
377  return "SRC_DATA->data_out or SRC_DATA->data_in is NULL." ;
378  case SRC_ERR_NO_PRIVATE :
379  return "Internal error. No private data." ;
380 
381  case SRC_ERR_BAD_SRC_RATIO :
382  return "SRC ratio outside [1/" SRC_MAX_RATIO_STR ", " SRC_MAX_RATIO_STR "] range." ;
383 
385  return "src_process() called without reset after end_of_input." ;
386  case SRC_ERR_BAD_PROC_PTR :
387  return "Internal error. No process pointer." ;
388  case SRC_ERR_SHIFT_BITS :
389  return "Internal error. SHIFT_BITS too large." ;
390  case SRC_ERR_FILTER_LEN :
391  return "Internal error. Filter length too large." ;
392  case SRC_ERR_BAD_CONVERTER :
393  return "Bad converter number." ;
395  return "Channel count must be >= 1." ;
397  return "Internal error. Bad buffer length. Please report this." ;
399  return "Internal error. Input data / internal buffer size difference. Please report this." ;
400  case SRC_ERR_BAD_PRIV_PTR :
401  return "Internal error. Private pointer is NULL. Please report this." ;
402  case SRC_ERR_DATA_OVERLAP :
403  return "Input and output data arrays overlap." ;
404  case SRC_ERR_BAD_CALLBACK :
405  return "Supplied callback function pointer is NULL." ;
406  case SRC_ERR_BAD_MODE :
407  return "Calling mode differs from initialisation mode (ie process v callback)." ;
408  case SRC_ERR_NULL_CALLBACK :
409  return "Callback function pointer is NULL in src_callback_read ()." ;
411  return "This converter only allows constant conversion ratios." ;
413  return "Internal error : Bad length in prepare_data ()." ;
415  return "Error : Someone is trampling on my internal state." ;
416 
417  case SRC_ERR_MAX_ERROR :
418  return "Placeholder. No error defined for this error number." ;
419 
420  default : break ;
421  }
422 
423  return NULL ;
424 } /* src_strerror */
#define error(str)
Definition: mkdosfs.c:1605
smooth NULL
Definition: ftsmooth.c:416
#define SRC_MAX_RATIO_STR
Definition: common.h:21