Team Fortress 2 Source Code as on 22/4/2020
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.

76 lines
2.6 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. /* This product contains Speex software. The license terms of the Speex
  9. software, distributed with this product, are as follows:
  10. 2002-2003, Jean-Marc Valin/Xiph.Org Foundation
  11. Redistribution and use in source and binary forms, with or without
  12. modification, are permitted provided that the following conditions are met:
  13. - Redistributions of source code must retain the above copyright notice,
  14. this list of conditions and the following disclaimer.
  15. - Redistributions in binary form must reproduce the above copyright notice,
  16. this list of conditions and the following disclaimer in the documentation
  17. and/or
  18. other materials provided with the distribution.
  19. Neither the name of the Xiph.org Foundation nor the names of its
  20. contributors may be used to endorse or promote products derived from this
  21. software without specific prior written permission.
  22. This software is provided by the copyright holders and contributors "as is"
  23. and any express or implied warranties, including, but not limited to, the
  24. implied warranties of merchantability and fitness for a particular purpose
  25. are disclaimed. In no event shall the foundation or contributors be liable
  26. for any direct, indirect, incidental, special, exemplary, or consequential
  27. damages (including, but not limited to, procurement of substitute goods or
  28. services; loss of use, data, or profits; or business interruption) however
  29. caused and on any theory of liability, whether in contract, strict
  30. liability, or tort (including negligence or otherwise) arising in any way
  31. out of the use of this software, even if advised of the possibility of such
  32. damage. */
  33. #if !defined VOICEENCODER_SPEEX_H
  34. #define VOICEENCODER_SPEEX_H
  35. #pragma once
  36. #include "iframeencoder.h"
  37. #include <speex.h>
  38. class VoiceEncoder_Speex : public IFrameEncoder
  39. {
  40. public:
  41. VoiceEncoder_Speex();
  42. virtual ~VoiceEncoder_Speex();
  43. // Interfaces IFrameDecoder
  44. bool Init(int quality, int &rawFrameSize, int &encodedFrameSize);
  45. void Release();
  46. void DecodeFrame(const char *pCompressed, char *pDecompressedBytes);
  47. void EncodeFrame(const char *pUncompressedBytes, char *pCompressed);
  48. bool ResetState();
  49. private:
  50. bool InitStates();
  51. void TermStates();
  52. int m_Quality; // voice codec quality ( 0,2,4,6,8 )
  53. void * m_EncoderState; // speex internal encoder state
  54. void * m_DecoderState; // speex internal decoder state
  55. SpeexBits m_Bits; // helpful bit buffer structure
  56. };
  57. #endif // !defined(AFX_FRAMEENCODER_SPEEX_H__C160B146_3782_4D91_A022_0B852C57BAB9__INCLUDED_)