CWaveFile.h
上传用户:btjhwmj
上传日期:2007-03-02
资源大小:7k
文件大小:2k
源码类别:

Audio

开发平台:

WINDOWS

  1. //CWaveViewCtrl.h
  2. #include <windows.h>
  3. #include <mmsystem.h>
  4. #include <DSOUND.h>
  5. typedef struct FormatChunk{
  6. //long chunkSize;
  7. short wFormatTag;
  8. unsigned short wChannels;
  9. unsigned long dwSamplesPerSec;
  10. unsigned long awAvgBytesPerSec;
  11. unsigned short wBlockAlign;
  12. unsigned short wBitsPerSample;
  13. }fchunk;
  14. typedef struct RIFF{
  15. char ID[4];
  16. DWORD Size;
  17. }riff;
  18. class CWaveViewCtrl:public CWnd
  19. {
  20. DECLARE_SERIAL(CWaveViewCtrl);          // to make this class siralizeable
  21. // Construction
  22. public:
  23. CWaveViewCtrl(); //default constructor
  24. // Attributes
  25. public:
  26. void *m_data;
  27. // Operations
  28. public:
  29. // Overrides
  30. // ClassWizard generated virtual function overrides
  31. //{{AFX_VIRTUAL(CWaveEditCtrl)
  32. public:
  33. virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
  34. //}}AFX_VIRTUAL
  35. // Implementation
  36. void Serialize( CArchive& ar );      //to do siralization
  37. void Command(bool state=true);  //to play sound
  38. virtual ~CWaveViewCtrl();//distructor
  39. protected:
  40. //{{AFX_MSG(CWaveEditCtrl)
  41. afx_msg void OnLButtonDown( UINT nFlags, CPoint point );
  42. afx_msg void OnLButtonUp( UINT nFlags, CPoint point );
  43. afx_msg int  OnCreate( LPCREATESTRUCT lpCreateStruct );
  44. afx_msg void OnMouseMove( UINT nFlags, CPoint point );
  45. afx_msg void OnSize( UINT nType, int cx, int cy );
  46. afx_msg void OnKillFocus( CWnd* pNewWnd );
  47. afx_msg void OnSetFocus( CWnd* pOldWnd );
  48. afx_msg void OnTimer( UINT nIDEvent );
  49. afx_msg void OnPaint();
  50. //}}AFX_MSG
  51. public:
  52. CDC m_MDC;
  53. CBitmap m_bitmap,*m_pOldBitmap;
  54. CRect memrec;
  55. fchunk* m_pfch;
  56. RIFF* m_pRiff;
  57. private:
  58. CRect rect;
  59. int m_selpoint;
  60. bool isComm,m_shiftcaret,m_MouseSel;
  61. POINT m_PBP;
  62. LPVOID lpvFile;
  63. IDirectSound* DSound;
  64. IDirectSoundBuffer* DSoundBuff;
  65. void CreateCaret(bool Flag);
  66. void DrawTimeRuler(CPaintDC* PaintDC);
  67. DECLARE_MESSAGE_MAP()
  68. };