You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.1KB

  1. /*
  2. ** Copyright (c) 2008-2016, Erik de Castro Lopo <erikd@mega-nerd.com>
  3. ** All rights reserved.
  4. **
  5. ** This code is released under 2-clause BSD license. Please see the
  6. ** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING
  7. */
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <samplerate.h>
  11. #include "util.h"
  12. static void
  13. downsample_test (int converter)
  14. { static float in [1000], out [10] ;
  15. SRC_DATA data ;
  16. printf (" downsample_test (%-28s) ....... ", src_get_name (converter)) ;
  17. fflush (stdout) ;
  18. data.src_ratio = 1.0 / 255.0 ;
  19. data.input_frames = ARRAY_LEN (in) ;
  20. data.output_frames = ARRAY_LEN (out) ;
  21. data.data_in = in ;
  22. data.data_out = out ;
  23. if (src_simple (&data, converter, 1))
  24. { puts ("src_simple failed.") ;
  25. exit (1) ;
  26. } ;
  27. puts ("ok") ;
  28. } /* downsample_test */
  29. int
  30. main (void)
  31. {
  32. puts ("") ;
  33. downsample_test (SRC_ZERO_ORDER_HOLD) ;
  34. downsample_test (SRC_LINEAR) ;
  35. downsample_test (SRC_SINC_FASTEST) ;
  36. downsample_test (SRC_SINC_MEDIUM_QUALITY) ;
  37. downsample_test (SRC_SINC_BEST_QUALITY) ;
  38. puts ("") ;
  39. return 0 ;
  40. } /* main */