1 #ifndef AUDIO_CONVERSION_H 2 #define AUDIO_CONVERSION_H 3 4 #ifdef HAVE_STDINT_H 5 # include <stdint.h> 6 #endif 7 8 #include <sys/types.h> 9 10 #ifdef HAVE_SAMPLERATE 11 # include <samplerate.h> 12 #endif 13 14 #include "audio.h" 15 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 19 20 struct audio_conversion 21 { 22 struct sound_params from; 23 struct sound_params to; 24 25 #ifdef HAVE_SAMPLERATE 26 SRC_STATE *src_state; 27 float *resample_buf; 28 size_t resample_buf_nsamples; /* in samples ( sizeof(float) ) */ 29 #endif 30 31 }; 32 33 int audio_conv_new (struct audio_conversion *conv, 34 const struct sound_params *from, 35 const struct sound_params *to); 36 char *audio_conv (struct audio_conversion *conv, 37 const char *buf, const size_t size, size_t *conv_len); 38 void audio_conv_destroy (struct audio_conversion *conv); 39 40 void audio_conv_bswap_16 (int16_t *buf, const size_t num); 41 void audio_conv_bswap_32 (int32_t *buf, const size_t num); 42 43 #ifdef __cplusplus 44 } 45 #endif 46 47 #endif 48