mixer.h

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

H
64
字号
// Mixer.h: interface for the CMixer class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_MIXER_H__B661E6C2_5CEC_46FE_8E35_1BAE1F7F6F85__INCLUDED_)
#define AFX_MIXER_H__B661E6C2_5CEC_46FE_8E35_1BAE1F7F6F85__INCLUDED_

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

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


namespace AudioEngine {

class CMixerLine
{
public:
  CMixerLine(int src, int dest) { m_Source = src; m_Dest = dest; }
  int m_Source;
  int m_Dest;

  bool IsValidForMixer(HMIXER mixer, int &lineid, int &channels) const;
  
  bool SetControlValue(HMIXER mixer, int lineid, int control, int channels, int value) const;
  int GetControlValue(HMIXER mixer, int lineid, int control, int channels) const;

  void GetControlInfo(HMIXER mixer, int controltype, int lineid, int &id) const;
  
};

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

  void Init();
  void UnInit();

  bool SetVolume(const CMixerLine &line, int vol_0_to_65535);
  int GetVolume(const CMixerLine &line);

  bool Mute(const CMixerLine &line);
  bool UnMute(const CMixerLine &line);

  // common src->dest line mappings
  static const CMixerLine Master; 
  static const CMixerLine WaveOut;
  static const CMixerLine CDAudio;

protected:
  bool m_Valid;
  HMIXER m_hMixer;

};


} // namespace
#endif // !defined(AFX_MIXER_H__B661E6C2_5CEC_46FE_8E35_1BAE1F7F6F85__INCLUDED_)

⌨️ 快捷键说明

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