conv.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #pragma once
  2. //wav头的结构如下所示:
  3. typedef struct __WAV_HEADER{
  4. char fccID[4]; /* should be "RIFF" */
  5. unsigned long dwSize; /* byte_number behind it */
  6. char fccType[4]; /* should be "WAVE" */
  7. }HEADER;
  8. typedef struct __WAV_FMT{
  9. char fccID[4]; /* should be "fmt " */
  10. unsigned long dwSize; /* should be 0x10 */
  11. unsigned short wFormatTag; /* should be 1 */
  12. unsigned short wChannels; //| 声道数目,1--单声道;2--双声道 | |
  13. unsigned long dwSamplesPerSec; //采样频率
  14. unsigned long dwAvgBytesPerSec; //每秒所需字节数
  15. unsigned short wBlockAlign; //数据块对齐单位(每个采样需要的字节数)
  16. unsigned short uiBitsPerSample; //每个采样需要的bit数
  17. //unsigned char ExInfo[2]; //附加信息(可选,通过Size来判断有无)
  18. }FMT;
  19. typedef struct __WAV_DATA{
  20. char fccID[4]; /* should be "data" */
  21. unsigned long dwSize; /* byte_number of PCM data in byte*/
  22. }DATA;
  23. typedef struct{
  24. DWORD dwRIFF;
  25. DWORD dwFileLen;
  26. DWORD dwWAVE;
  27. DWORD dw_fmt;
  28. DWORD dwFmtLen;
  29. WORD wDataType;
  30. WORD wNChannels;
  31. DWORD dwSamplingRate;
  32. DWORD dwNBytesPerSec;
  33. WORD wAlignment;
  34. WORD wNBitsPerSam;
  35. DWORD dwdata;
  36. DWORD dwDataLen;
  37. }WAVEHEADER;
  38. extern int PcmToALow(char *pSrcFileName, char *pDescFileName);