Advertisement
Guest User

Untitled

a guest
May 21st, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. inline void srccpy( float * _dst, float * _src, int wavelength )
  2. {
  3. int err;
  4. const int margin = 64;
  5.  
  6. // copy to temp array
  7. float tmps [ wavelength + margin ]; // temp array in stack
  8. float * tmp = &tmps[0];
  9.  
  10. memcpy( tmp, _src, sizeof( float ) * wavelength );
  11. memcpy( tmp + wavelength, _src, sizeof( float ) * margin );
  12. SRC_STATE * src_state = src_new( SRC_SINC_FASTEST, 1, &err );
  13. SRC_DATA src_data;
  14. src_data.data_in = tmp;
  15. src_data.input_frames = wavelength + margin;
  16. src_data.data_out = _dst;
  17. src_data.output_frames = wavelength * WAVERATIO;
  18. src_data.src_ratio = static_cast<double>( WAVERATIO );
  19. src_data.end_of_input = 0;
  20. err = src_process( src_state, &src_data );
  21. if( err ) { qDebug( "Microwave SRC error: %s", src_strerror( err ) ); }
  22. src_delete( src_state );
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement