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

📄 effect.cpp

📁 游戏音频程序设计-Beginning.Game.Audio.Programming
💻 CPP
字号:
// Effect.cpp: implementation of the CEffect class.
//
//////////////////////////////////////////////////////////////////////

#include "Effect.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

namespace AudioEngine {

CEffect::CEffect()
{

}

CEffect::~CEffect()
{

}

void CChorusEffect::SetAllParameters(IDirectMusicAudioPath8 *audiopath)
{
  HRESULT hr;
  IDirectSoundFXChorus8* effect = NULL;
  
  // get the effect's interface
  hr = audiopath->GetObjectInPath(DMUS_PCHANNEL_ALL,
      DMUS_PATH_BUFFER_DMO, 0, GUID_All_Objects, 0, IID_IDirectSoundFXChorus8,
      (LPVOID*) &effect);
  ThrowIfFailed(hr, "CChorusEffect::SetAllParameters(): couldn't get effect interface.");

  // set the effect's params
  hr = effect->SetAllParameters(&m_Params);

  // release the effect's interface
  SAFE_RELEASE(effect);
}

void CCompressorEffect::SetAllParameters(IDirectMusicAudioPath8 *audiopath)
{
  HRESULT hr;
  IDirectSoundFXCompressor8* effect = NULL;
  
  // get the effect's interface
  hr = audiopath->GetObjectInPath(DMUS_PCHANNEL_ALL,
      DMUS_PATH_BUFFER_DMO, 0, GUID_All_Objects, 0, IID_IDirectSoundFXCompressor8,
      (LPVOID*) &effect);
  ThrowIfFailed(hr, "CCompressorEffect::SetAllParameters(): couldn't get effect interface.");

  // set the effect's params
  hr = effect->SetAllParameters(&m_Params);

  // release the effect's interface
  SAFE_RELEASE(effect);
}

void CDistortionEffect::SetAllParameters(IDirectMusicAudioPath8 *audiopath)
{
  HRESULT hr;
  IDirectSoundFXDistortion8* effect = NULL;
  
  // get the effect's interface
  hr = audiopath->GetObjectInPath(DMUS_PCHANNEL_ALL,
      DMUS_PATH_BUFFER_DMO, 0, GUID_All_Objects, 0, IID_IDirectSoundFXDistortion8,
      (LPVOID*) &effect);
  ThrowIfFailed(hr, "CDistortionEffect::SetAllParameters(): couldn't get effect interface.");

  // set the effect's params
  hr = effect->SetAllParameters(&m_Params);

  // release the effect's interface
  SAFE_RELEASE(effect);
}

void CEchoEffect::SetAllParameters(IDirectMusicAudioPath8 *audiopath)
{
  HRESULT hr;
  IDirectSoundFXEcho8* effect = NULL;
  
  // get the effect's interface
  hr = audiopath->GetObjectInPath(DMUS_PCHANNEL_ALL,
      DMUS_PATH_BUFFER_DMO, 0, GUID_All_Objects, 0, IID_IDirectSoundFXEcho8,
      (LPVOID*) &effect);
  ThrowIfFailed(hr, "CEchoEffect::SetAllParameters(): couldn't get effect interface.");

  // set the effect's params
  hr = effect->SetAllParameters(&m_Params);

  // release the effect's interface
  SAFE_RELEASE(effect);
}

void CFlangeEffect::SetAllParameters(IDirectMusicAudioPath8 *audiopath)
{
  HRESULT hr;
  IDirectSoundFXFlanger8* effect = NULL;
  
  // get the effect's interface
  hr = audiopath->GetObjectInPath(DMUS_PCHANNEL_ALL,
      DMUS_PATH_BUFFER_DMO, 0, GUID_All_Objects, 0, IID_IDirectSoundFXFlanger8,
      (LPVOID*) &effect);
  ThrowIfFailed(hr, "CFlangeEffect::SetAllParameters(): couldn't get effect interface.");

  // set the effect's params
  hr = effect->SetAllParameters(&m_Params);

  // release the effect's interface
  SAFE_RELEASE(effect);
}

void CGargleEffect::SetAllParameters(IDirectMusicAudioPath8 *audiopath)
{
  HRESULT hr;
  IDirectSoundFXGargle8* effect = NULL;
  
  // get the effect's interface
  hr = audiopath->GetObjectInPath(DMUS_PCHANNEL_ALL,
      DMUS_PATH_BUFFER_DMO, 0, GUID_All_Objects, 0, IID_IDirectSoundFXGargle8,
      (LPVOID*) &effect);
  ThrowIfFailed(hr, "CGargleEffect::SetAllParameters(): couldn't get effect interface.");

  // set the effect's params
  hr = effect->SetAllParameters(&m_Params);

  // release the effect's interface
  SAFE_RELEASE(effect);
}

void CParamEqEffect::SetAllParameters(IDirectMusicAudioPath8 *audiopath)
{
  HRESULT hr;
  IDirectSoundFXParamEq8* effect = NULL;
  
  // get the effect's interface
  hr = audiopath->GetObjectInPath(DMUS_PCHANNEL_ALL,
      DMUS_PATH_BUFFER_DMO, 0, GUID_All_Objects, 0, IID_IDirectSoundFXParamEq8,
      (LPVOID*) &effect);
  ThrowIfFailed(hr, "CParamEqEffect::SetAllParameters(): couldn't get effect interface.");

  // set the effect's params
  hr = effect->SetAllParameters(&m_Params);

  // release the effect's interface
  SAFE_RELEASE(effect);
}

void CWavesReverbEffect::SetAllParameters(IDirectMusicAudioPath8 *audiopath)
{
  HRESULT hr;
  IDirectSoundFXWavesReverb8* effect = NULL;
  
  // get the effect's interface
  hr = audiopath->GetObjectInPath(DMUS_PCHANNEL_ALL,
      DMUS_PATH_BUFFER_DMO, 0, GUID_All_Objects, 0, IID_IDirectSoundFXWavesReverb8,
      (LPVOID*) &effect);
  ThrowIfFailed(hr, "CWavesReverbEffect::SetAllParameters(): couldn't get effect interface.");

  // set the effect's params
  hr = effect->SetAllParameters(&m_Params);

  // release the effect's interface
  SAFE_RELEASE(effect);
}

} // namespace

⌨️ 快捷键说明

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