md_audio.h
来自「MDEngine2plus游戏开发库! 用来开发游戏超级简单!」· C头文件 代码 · 共 58 行
H
58 行
//********************************************************************
// MD 引擎 音乐管理 内核部件的定义
// Powered by @J--S Studio Johnhans 2002.9.18
//********************************************************************
#ifndef MD_AUDIO_H
#define MD_AUDIO_H
#ifdef MDENGINE2P_EXPORTS
#define MDENGINE_API __declspec(dllexport)
#else
#define MDENGINE_API __declspec(dllimport)
#endif
#define DIRECTSOUND_VERSION 0x0700
#ifndef MDENGINE2P_EXPORTS
#include <mmsystem.h>
#endif
#define DIRECTSOUND_VERSION 0x0700
#include <dsound.h>
#include "common.h"
#define VOLUME_MIN DMUS_VOLUME_MIN
#define VOLUME_MAX DMUS_VOLUME_MAX
#define NOSTREAM -1
class MDENGINE_API CMD_Audio
{
public:
CMD_Audio();
virtual ~CMD_Audio();
public:
bool Create(HWND hWnd, DWORD dwSample=44100, unsigned short dwBit=16,bool Stereo=true,int istream=5);
HWND GetHWnd(void) { return m_hWnd; }
void Free(void);
void SetStreamMin(int len){ m_iStreamLen = len; }
int GetStreamMin(void){ return m_iStreamLen; }
bool ChangeAudioFormat(DWORD dwSample=44100, unsigned short dwBit=16,bool Stereo=true);
LPDIRECTSOUND *GetDSObject(void) { return &m_lpDS; }
void EnableSound(bool Enable=true) { m_bEnableSound=Enable; }
bool IsEnableSound(void) { return m_bEnableSound; }
void SetVolume(long volume);
long GetVolume(void);
private:
LPDIRECTSOUND m_lpDS; // DirectSound内核
bool m_bEnableSound; // 允许播放声音
int m_iStreamLen; // 使用流的长度底限(超过这个长度的音乐将启用流)
HWND m_hWnd;
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?