WavEncoder.h 979 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef NULLSOFT_WAVENCODERH
  2. #define NULLSOFT_WAVENCODERH
  3. #include <mmreg.h>
  4. #include <msacm.h>
  5. #include "../nsv/enc_if.h"
  6. #define WFSIZ 0x800
  7. struct EXT_WFX
  8. {
  9. WAVEFORMATEX wfx;
  10. BYTE crap[WFSIZ];
  11. };
  12. class WavEncoder : public AudioCoder
  13. {
  14. public:
  15. WavEncoder(int srate, int nch, int bps, int res_srate = 0, int res_bps = 0, int res_nch = 0);
  16. virtual ~WavEncoder();
  17. virtual int Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail);
  18. void FinishAudio(HANDLE fh, WavEncoder *coder);
  19. int GetLastError();
  20. int m_did_header;
  21. int m_nch, m_srate, m_bps;
  22. int m_bytes_done;
  23. int m_error;
  24. int m_hlen;
  25. int m_nsam;
  26. EXT_WFX m_convert_wfx;
  27. WAVEFORMATEX m_wfx_src;
  28. HACMSTREAM hStream, hStreamResample;
  29. ACMSTREAMHEADER ahd, ahdResample;
  30. unsigned char *m_acm_buf, *m_acm_outbuf;
  31. int m_bytes_inbuf, m_bytes_outbuf;
  32. unsigned char *m_acm_resample_buf, *m_acm_resample_outbuf;
  33. int m_bytes_inbuf_resample, m_bytes_outbuf_resample;
  34. };
  35. #endif