sound.h

来自「Visual C++编程宝典随书光盘里的代码」· C头文件 代码 · 共 115 行

H
115
字号
// Sound.h

#ifndef __SOUND_H__
#define __SOUND_H__

#include "stdafx.h"
#include <mmsystem.h>

class CWave
{

public:
	CWave();
	CWave( const char * );
	CWave( const char *, HINSTANCE );
	CWave( int, HINSTANCE );
	~CWave();

	int DeviceCount( void );

	BOOL Load( const char * );
	BOOL Load( const char *, HINSTANCE );
	BOOL Load( int, HINSTANCE );

	BOOL Play( BOOL bLoop = FALSE );
	BOOL PlayFromDisk( const char * );
	BOOL PlayFromRes( const char *, HINSTANCE );
	BOOL PlayFromRes( int, HINSTANCE );
	BOOL Stop( void );
	BOOL Close( void );

	BOOL IsLoaded( void );

protected:
	void InitVars( void );

	int m_nDevices;
	BOOL m_bLoaded;
	char *m_lpSoundData;
	HANDLE m_hResHandle;

};

class CCDAudio
{

public:
	CCDAudio();
	~CCDAudio();

	BOOL Open( void );
	void Close( void );
	BOOL Play( void );
	void Stop( void );
	void Pause( void );
	int GetTotalTracks( void );
	int GetCurrentTrack( void );
	void GetTotalLength( int *, int* );
	void GetTrackLength( int, int *, int * );
	int GetMinutes( void );
	int GetSeconds( void );
	int GetFrames( void );
	BOOL IsDriveReady( void );
	BOOL IsPlaying( BOOL * );
	BOOL IsAudioTrack( int );
	BOOL SeekTo( int, int, int, int );
	void SkipForward( int );
	void SkipBack( int );
	void CloseDrive( void );
	void OpenDrive( void );

private:
	BOOL m_bOpened, m_bPaused, m_bPlaying;
	WORD m_wDeviceID;

};

class CMidi
{

public:
	CMidi();
	~CMidi();

	int DeviceCount( void );

	BOOL Open( const char * );
	BOOL Close( void );

	BOOL Play( void );
	BOOL Stop( void );
	BOOL Pause( void );
	BOOL IsPlaying( void );

	BOOL GetLength( int *, int * );
	int GetMinutes( void );
	int GetSeconds( void );

	BOOL SeekTo( int, int );
	BOOL SkipForward( int );
	BOOL SkipBack( int );

	int GetTempo( void );
	BOOL SetTempo( int );

protected:
	BOOL m_bOpened, m_bPaused, m_bPlaying;
	WORD m_wDeviceID;
	int m_nDevices;

};

#endif

⌨️ 快捷键说明

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