Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- inline void srccpy( float * _dst, float * _src, int wavelength )
- {
- int err;
- const int margin = 64;
- // copy to temp array
- float tmps [ wavelength + margin ]; // temp array in stack
- float * tmp = &tmps[0];
- memcpy( tmp, _src, sizeof( float ) * wavelength );
- memcpy( tmp + wavelength, _src, sizeof( float ) * margin );
- SRC_STATE * src_state = src_new( SRC_SINC_FASTEST, 1, &err );
- SRC_DATA src_data;
- src_data.data_in = tmp;
- src_data.input_frames = wavelength + margin;
- src_data.data_out = _dst;
- src_data.output_frames = wavelength * WAVERATIO;
- src_data.src_ratio = static_cast<double>( WAVERATIO );
- src_data.end_of_input = 0;
- err = src_process( src_state, &src_data );
- if( err ) { qDebug( "Microwave SRC error: %s", src_strerror( err ) ); }
- src_delete( src_state );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement