soundinstance.h

来自「游戏音频程序设计-Beginning.Game.Audio.Programmin」· C头文件 代码 · 共 65 行

H
65
字号
// SoundInstance.h: interface for the CSoundInstance class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SOUNDINSTANCE_H__AC82C068_C016_4367_85C6_99906A7950CC__INCLUDED_)
#define AFX_SOUNDINSTANCE_H__AC82C068_C016_4367_85C6_99906A7950CC__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <windows.h>
#include <mmreg.h>

#include <dmusicc.h>
#include <dmusici.h>
#include <dsound.h>
#include "dxutil.h"

#include "DirectMusicSegment.h"
#include "Effect.h"

#pragma warning (disable:4786)
#include <vector>

namespace AudioEngine {

class CSound;
class CAudioManager;

class CSoundInstance  
{
public:
	CSoundInstance();
	virtual ~CSoundInstance();

  void Init(CDirectMusicSegment *seg, IDirectMusicAudioPath8 *path, bool control = false);
  void UnInit();

  bool IsPlaying();
  bool IsValid() { return(m_Valid); }
  bool Stop(MUSIC_TIME time = 0, DWORD flags = 0);

  void SetVolume(const CVolume &vol, int fadeoverms = 0);

  IDirectMusicSegmentState8 *GetSegmentState() { return(m_SegmentState); }

  void AddEffect(CEffect *effect);
  void RemoveAllEffects();
  void ApplyEffectsToAudioPath();

protected:
  void ClearEffectsVector();
  
  std::vector<CEffect *> m_Effects;
  bool m_Valid;
  IDirectMusicSegmentState8 *m_SegmentState;
  IDirectMusicAudioPath8 *m_AudioPath;
  IDirectSoundBuffer8 *m_DirectSoundBuffer;
};

}; // namespace

#endif // !defined(AFX_SOUNDINSTANCE_H__AC82C068_C016_4367_85C6_99906A7950CC__INCLUDED_)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?