speex_echo.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* Copyright (C) Jean-Marc Valin */
  2. /**
  3. @file speex_echo.h
  4. @brief Echo cancellation
  5. */
  6. /*
  7. Redistribution and use in source and binary forms, with or without
  8. modification, are permitted provided that the following conditions are
  9. met:
  10. 1. Redistributions of source code must retain the above copyright notice,
  11. this list of conditions and the following disclaimer.
  12. 2. Redistributions in binary form must reproduce the above copyright
  13. notice, this list of conditions and the following disclaimer in the
  14. documentation and/or other materials provided with the distribution.
  15. 3. The name of the author may not be used to endorse or promote products
  16. derived from this software without specific prior written permission.
  17. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  18. IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  19. OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20. DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
  21. INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  23. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  24. HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  25. STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  26. ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  27. POSSIBILITY OF SUCH DAMAGE.
  28. */
  29. #ifndef SPEEX_ECHO_H
  30. #define SPEEX_ECHO_H
  31. #include "speex/speex_types.h"
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. /** Obtain frame size used by the AEC */
  36. #define SPEEX_ECHO_GET_FRAME_SIZE 3
  37. /** Set sampling rate */
  38. #define SPEEX_ECHO_SET_SAMPLING_RATE 24
  39. /** Get sampling rate */
  40. #define SPEEX_ECHO_GET_SAMPLING_RATE 25
  41. /*struct drft_lookup;*/
  42. struct SpeexEchoState_;
  43. typedef struct SpeexEchoState_ SpeexEchoState;
  44. /** Creates a new echo canceller state */
  45. SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length);
  46. /** Destroys an echo canceller state */
  47. void speex_echo_state_destroy(SpeexEchoState *st);
  48. /** Performs echo cancellation a frame */
  49. void speex_echo_cancel(SpeexEchoState *st, short *ref, short *echo, short *out, spx_int32_t *Y);
  50. /** Reset the echo canceller state */
  51. void speex_echo_state_reset(SpeexEchoState *st);
  52. /** Used like the ioctl function to control the echo canceller parameters
  53. *
  54. * @param state Encoder state
  55. * @param request ioctl-type request (one of the SPEEX_ECHO_* macros)
  56. * @param ptr Data exchanged to-from function
  57. * @return 0 if no error, -1 if request in unknown
  58. */
  59. int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr);
  60. #ifdef __cplusplus
  61. }
  62. #endif
  63. #endif
粤ICP备19079148号