Sound.h
上传用户:whgydz
上传日期:2007-01-12
资源大小:2259k
文件大小:1k
源码类别:

其他书籍

开发平台:

HTML/CSS

  1. // Sound.h: interface for the CSound class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_SOUND_H__C89CE19D_7C1D_4741_BE61_5AD0836FCF3A__INCLUDED_)
  5. #define AFX_SOUND_H__C89CE19D_7C1D_4741_BE61_5AD0836FCF3A__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #include "Base.h"
  10. class CSound : public CBase  
  11. {
  12. public:
  13. bool IsPlaying();
  14. bool Stop();
  15. bool Play(DWORD dwNumOfRepeats = 0);
  16. bool LoadSound(const char* szSoundFilePath);
  17. void InitialiseForWavMidi(IDirectMusicPerformance8* pDirectAudioPerformance, IDirectMusicLoader8* pDirectAudioLoader);
  18. void InitialiseForMP3();
  19. CSound(); //Use this constructor for mp3 files
  20. virtual ~CSound();
  21. private:
  22. enum Format {Unknown, MP3, WavMidi};
  23. IDirectMusicSegment8* m_pSegment;
  24. IDirectMusicPerformance8* m_pDirectAudioPerformance;
  25. IDirectMusicLoader8* m_pDirectAudioLoader;
  26. IGraphBuilder* m_pGraph;
  27. IMediaControl* m_pMediaControl;
  28. IMediaPosition* m_pMediaPosition;
  29. Format m_enumFormat;
  30. };
  31. #endif // !defined(AFX_SOUND_H__C89CE19D_7C1D_4741_BE61_5AD0836FCF3A__INCLUDED_)