audio_resample.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _AUD_RESAMPLE_H
  13. #define _AUD_RESAMPLE_H
  14. #include "osi_api.h"
  15. //#include <string.h>
  16. //
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. typedef struct audResamCtx
  21. {
  22. uint32_t playrate; //output sample rate
  23. int16_t playrateStep; //output step
  24. int16_t playScale; //scale factor for calculate
  25. int16_t intpoint; //input sample index
  26. int16_t floatpoint; //resample float index
  27. int16_t dataratestep; //input step
  28. int16_t blocklength; //input sample number
  29. int16_t historyData_l; //history L sample
  30. int16_t historyData_r; //history R sample
  31. uint16_t chl; //channel. 1 or 2. output same as input.
  32. } audResamCtx_t;
  33. int32_t audioResampleInitParam(audResamCtx_t *ptTransamObj, uint32_t inRate, uint32_t outRate, uint16_t chl);
  34. uint32_t audioResample(audResamCtx_t *ptTransamObj, int16_t *inBuf, int16_t inum, int16_t *outBuf);
  35. #ifdef __cplusplus
  36. }
  37. #endif
  38. #endif