Wave.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* Copyright (c) 2002-2012 Croteam Ltd.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of version 2 of the GNU General Public License as published by
  4. the Free Software Foundation
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License along
  10. with this program; if not, write to the Free Software Foundation, Inc.,
  11. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
  12. #ifndef SE_INCL_WAVE_H
  13. #define SE_INCL_WAVE_H
  14. #ifdef PRAGMA_ONCE
  15. #pragma once
  16. #endif
  17. /*
  18. * PCM Wave Input
  19. */
  20. class PCMWaveInput {
  21. private:
  22. // Wave data
  23. WAVEFORMATEX pwi_wfeWave;
  24. WAVEFORMATEX pwi_wfeDesired;
  25. ULONG pwi_ulRiffLength, pwi_ulDataLength;
  26. BOOL pwi_bInfoLoaded, pwi_bDataLoaded; // Status
  27. SWORD *pwi_pswMemory; // Memory
  28. /* Conversion */
  29. DOUBLE pwi_dRatio;
  30. // get and store data
  31. inline ULONG GetData_t( CTStream *pCstrInput);
  32. inline void StoreData( ULONG ulData);
  33. void CopyData_t( CTStream *pCstrInput);
  34. void ShrinkData_t( CTStream *pCstrInput);
  35. public:
  36. // Check wave format
  37. static void CheckWaveFormat_t( WAVEFORMATEX SwfeCheck, char *pcErrorString);
  38. /* Constructor */
  39. inline PCMWaveInput(void) { pwi_bInfoLoaded = FALSE; pwi_bDataLoaded = FALSE; };
  40. /* Load Wave info */
  41. WAVEFORMATEX LoadInfo_t( CTStream *pCstrInput);
  42. /* Load and convert Wave data */
  43. void LoadData_t( CTStream *pCstrInput, SWORD *pswMemory, WAVEFORMATEX &SwfeDesired);
  44. /* Length in bytes / blocks / seconds */
  45. ULONG GetByteLength(void);
  46. ULONG GetDataLength(void);
  47. ULONG GetDataLength( WAVEFORMATEX SwfeDesired);
  48. DOUBLE GetSecondsLength(void);
  49. /* Buffer length in bytes */
  50. ULONG DetermineBufferSize(void);
  51. ULONG DetermineBufferSize( WAVEFORMATEX SwfeDesired);
  52. };
  53. #endif /* include-once check. */