⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 3dsoundeffect.h

📁 游戏音频程序设计-Beginning.Game.Audio.Programming
💻 H
字号:
// 3DSoundEffect.h: interface for the C3DSoundEffect class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_3DSOUNDEFFECT_H__1F33E87C_F389_4D68_B492_41DFBBB0DD8F__INCLUDED_)
#define AFX_3DSOUNDEFFECT_H__1F33E87C_F389_4D68_B492_41DFBBB0DD8F__INCLUDED_

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

#include <dsound.h>

#include "DirectMusicSegment.h"

namespace AudioEngine {

class C3DSoundEffect : public CDirectMusicSegment  
{
public:
	C3DSoundEffect(CAudioManager *mgr);
	virtual ~C3DSoundEffect();

  // override segment's function to play out our own audiopath
  virtual bool Play() { return(CDirectMusicSegment::Play(NULL, false, m_AudioPath)); }
  virtual bool Play(CSoundInstance *newinst, bool control) { return(CDirectMusicSegment::Play(newinst, control, m_AudioPath)); }
  virtual bool PlayAsPrimary(CSoundInstance *newinst) {
    return(CDirectMusicSegment::Play(newinst, true, m_AudioPath));
  }
  
  // properties
  void SetPosition(D3DVECTOR position) { m_Props.vPosition = position; RefreshProps(); }
  D3DVECTOR GetPosition() { return(m_Props.vPosition); }

  void SetVelocity(D3DVECTOR Velocity) { m_Props.vVelocity = Velocity; RefreshProps(); }
  D3DVECTOR GetVelocity() { return(m_Props.vVelocity); }

  void SetInsideConeAngle(int angle) { m_Props.dwInsideConeAngle = angle; RefreshProps(); }
  int GetInsideConeAngle() { return(m_Props.dwInsideConeAngle); }

  void SetOutsideConeAngle(int angle) { m_Props.dwOutsideConeAngle = angle; RefreshProps(); }
  int GetOutsideConeAngle() { return(m_Props.dwOutsideConeAngle); }

  void SetConeOrientation(D3DVECTOR ConeOrientation) { m_Props.vConeOrientation = ConeOrientation; RefreshProps(); }
  D3DVECTOR GetConeOrientation() { return(m_Props.vConeOrientation); }

  void SetConeOutsideVolume(int vol) { m_Props.lConeOutsideVolume = vol; RefreshProps(); }
  int GetConeOutsideVolume() { return(m_Props.lConeOutsideVolume); }

  void SetMinDistance(float value) { m_Props.flMinDistance = value; RefreshProps(); }
  float GetMinDistance() { return(m_Props.flMinDistance); }

  void SetMaxDistance(float value) { m_Props.flMaxDistance = value; RefreshProps(); }
  float GetMaxDistance() { return(m_Props.flMaxDistance); }

  void SetHeadRelativeMode(bool value) { m_Props.dwMode = (value ? DS3DMODE_HEADRELATIVE : DS3DMODE_NORMAL); RefreshProps(); }
  bool IsHeadRelativeMode() { return(m_Props.dwMode == DS3DMODE_HEADRELATIVE); }

protected:
  void RefreshProps();
  DS3DBUFFER m_Props;
  IDirectMusicAudioPath8 *m_AudioPath;
  IDirectSound3DBuffer8 *m_3DBuffer;

};

} // namespace

#endif // !defined(AFX_3DSOUNDEFFECT_H__1F33E87C_F389_4D68_B492_41DFBBB0DD8F__INCLUDED_)

⌨️ 快捷键说明

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