Lines Matching +full:reserved +full:- +full:channels
2 ** Copyright (c) 2002-2016, Erik de Castro Lopo <erikd@mega-nerd.com>
3 ** All rights reserved.
5 ** This code is released under 2-clause BSD license. Please see the
21 static SRC_STATE *psrc_set_converter (int converter_type, int channels, int *error) ;
25 src_new (int converter_type, int channels, int *error) in src_new() argument
27 return psrc_set_converter (converter_type, channels, error) ; in src_new()
43 SRC_STATE *state = orig->vt->copy (orig) ;
52 src_callback_new (src_callback_t func, int converter_type, int channels, int *error, void* cb_data)
64 if ((state = src_new (converter_type, channels, error)) == NULL)
69 state->mode = SRC_MODE_CALLBACK ;
70 state->callback_func = func ;
71 state->user_callback_data = cb_data ;
81 state->vt->close (state) ; in src_delete()
94 if (state->mode != SRC_MODE_PROCESS) in src_process()
102 if ((data->data_in == NULL && data->input_frames > 0) in src_process()
103 || (data->data_out == NULL && data->output_frames > 0)) in src_process()
107 if (is_bad_src_ratio (data->src_ratio)) in src_process()
110 if (data->input_frames < 0) in src_process()
111 data->input_frames = 0 ; in src_process()
112 if (data->output_frames < 0) in src_process()
113 data->output_frames = 0 ; in src_process()
115 if (data->data_in < data->data_out) in src_process()
116 { if (data->data_in + data->input_frames * state->channels > data->data_out) in src_process()
117 { /*-printf ("\n\ndata_in: %p data_out: %p\n", in src_process()
118 (void*) (data->data_in + data->input_frames * psrc->channels), (void*) data->data_out) ;-*/ in src_process()
122 else if (data->data_out + data->output_frames * state->channels > data->data_in) in src_process()
123 …{ /*-printf ("\n\ndata_in : %p ouput frames: %ld data_out: %p\n", (void*) data->data_in, data… in src_process()
125 printf ("data_out: %p (%p) data_in: %p\n", (void*) data->data_out, in src_process()
126 (void*) (data->data_out + data->input_frames * psrc->channels), (void*) data->data_in) ;-*/ in src_process()
131 data->input_frames_used = 0 ; in src_process()
132 data->output_frames_gen = 0 ; in src_process()
135 if (state->last_ratio < (1.0 / SRC_MAX_RATIO)) in src_process()
136 state->last_ratio = data->src_ratio ; in src_process()
139 if (fabs (state->last_ratio - data->src_ratio) < 1e-15) in src_process()
140 error = state->vt->const_process (state, data) ; in src_process()
142 error = state->vt->vari_process (state, data) ; in src_process()
162 if (state->mode != SRC_MODE_CALLBACK)
163 { state->error = SRC_ERR_BAD_MODE ;
167 if (state->callback_func == NULL)
168 { state->error = SRC_ERR_NULL_CALLBACK ;
176 { state->error = SRC_ERR_BAD_SRC_RATIO ;
185 src_data.data_in = state->saved_data ;
186 src_data.input_frames = state->saved_frames ;
198 src_data.input_frames = state->callback_func (state->user_callback_data, &ptr) ;
210 state->mode = SRC_MODE_PROCESS ;
212 state->mode = SRC_MODE_CALLBACK ;
217 src_data.data_in += src_data.input_frames_used * state->channels ;
218 src_data.input_frames -= src_data.input_frames_used ;
220 src_data.data_out += src_data.output_frames_gen * state->channels ;
221 src_data.output_frames -= src_data.output_frames_gen ;
229 state->saved_data = src_data.data_in ;
230 state->saved_frames = src_data.input_frames ;
233 { state->error = (SRC_ERROR) error ;
252 state->last_ratio = new_ratio ;
261 return -SRC_ERR_BAD_STATE ;
263 return state->channels ;
272 state->vt->reset (state) ;
274 state->last_position = 0.0 ;
275 state->last_ratio = 0.0 ;
277 state->saved_data = NULL ;
278 state->saved_frames = 0 ;
280 state->error = SRC_ERR_NO_ERROR ;
323 { return PACKAGE "-" VERSION " (c) 2002-2008 Erik de Castro Lopo" ;
342 return state->error ;
359 return "SRC_DATA->data_out or SRC_DATA->data_in is NULL." ;
414 src_simple (SRC_DATA *src_data, int converter, int channels)
418 if ((src_state = src_new (converter, channels, &error)) == NULL)
421 src_data->end_of_input = 1 ; /* Only one buffer worth of input. */
448 else if (scaled_value <= -32768.f)
449 out [i] = -32768 ;
478 if (scaled_value <= (-8.0 * 0x10000000))
479 { out [i] = -1 - 0x7fffffff ;
494 psrc_set_converter (int converter_type, int channels, int *error) in psrc_set_converter() argument
502 state = sinc_state_new (converter_type, channels, &temp_error) ; in psrc_set_converter()
507 state = sinc_state_new (converter_type, channels, &temp_error) ; in psrc_set_converter()
512 state = sinc_state_new (converter_type, channels, &temp_error) ; in psrc_set_converter()
516 state = zoh_state_new (channels, &temp_error) ; in psrc_set_converter()
519 state = linear_state_new (channels, &temp_error) ; in psrc_set_converter()