2
0

esp_equalizer.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Copyright 2018 Espressif Systems (Shanghai) PTE LTD
  2. // All rights reserved.
  3. #ifndef _ESP_EQUALIZER_H
  4. #define _ESP_EQUALIZER_H
  5. #ifdef __cplusplus
  6. extern "C"
  7. {
  8. #endif
  9. /**
  10. * @brief Initialize the equalizer handle
  11. *
  12. * @param nch The audio channel number
  13. * @param g_rate The audio sample rate. Four sample rates are supported: 11025Hz, 22050Hz, 44100Hz and 48000Hz.
  14. * @param n_band The number of audio sub-bands. Fixed number of 10 sub-bands is supported and this value should be set to 10.
  15. * @param use_xmms_original_freqs Currently should be set 0
  16. *
  17. * @return The equalizer handle.
  18. */
  19. void *esp_equalizer_init(int nch, int g_rate, int n_band, int use_xmms_original_freqs);
  20. /**
  21. * @brief Uninitialize the equalizer handle.
  22. *
  23. * @param handle The the equalizer handle
  24. */
  25. void esp_equalizer_uninit(void *handle);
  26. /**
  27. * @brief Process the data through the equalizer
  28. *
  29. * @param handle The the equalizer handle
  30. * @param pcm_buf The audio pcm input & output buffer
  31. * @param length The length of current bytes in pcm_buf
  32. * @param g_rate The audio sample rate. Four sample rates are supported: 11025Hz, 22050Hz, 44100Hz and 48000Hz.
  33. * @param nch The audio channel number
  34. *
  35. * @return Length of pcm_buf after processing
  36. */
  37. int esp_equalizer_process(void *handle, unsigned char *pcm_buf, int length, int g_rate, int nch);
  38. /**
  39. * @brief Set the number of sub-bands for the equalizer
  40. *
  41. * @param handle The the equalizer handle
  42. * @param value The audio sub-bands gain. unit:db. 0 means no gain.
  43. * @param index The index of audio sub-bands. e.g. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
  44. * @param nch The audio channel number
  45. */
  46. void esp_equalizer_set_band_value(void *handle, float value, int index, int nch);
  47. /**
  48. * @brief Get the number of the equalizer sub-bands
  49. *
  50. * @param handle The the equalizer handle
  51. *
  52. * @return The number of the equalizer sub-bands
  53. */
  54. int esp_equalizer_get_band_count(void *handle);
  55. /**
  56. * @brief Get the value of the equalizer sub-bands
  57. *
  58. * @param handle The the equalizer handle
  59. * @param index The index of audio sub-bands. Currently only support 10 sub-bands, so it should be 0-9.
  60. * @param nch The audio channel number
  61. *
  62. * @return The number of the equalizer sub-bands
  63. */
  64. float esp_equalizer_get_band_value(void *handle, int index, int nch);
  65. #ifdef __cplusplus
  66. }
  67. #endif
  68. #endif