📄 dmusicc.h
字号:
/************************************************************************
* *
* dmusicc.h -- This module defines the DirectMusic core API's *
* *
* Copyright (c) 1998, Microsoft Corp. All rights reserved. *
* *
************************************************************************/
#ifndef _DMUSICC_
#define _DMUSICC_
#include <windows.h>
#define COM_NO_WINDOWS_H
#include <objbase.h>
#include <mmsystem.h>
#include "dls1.h"
#include "dmerror.h"
#include "dmdls.h"
#include "dsound.h"
#include "dmusbuff.h"
#include <pshpack8.h>
#ifdef __cplusplus
extern "C" {
#endif
#define DMUS_MAX_DESCRIPTION 128
#define DMUS_MAX_DRIVER 128
typedef struct _DMUS_BUFFERDESC *LPDMUS_BUFFERDESC;
typedef struct _DMUS_BUFFERDESC{
DWORD dwSize;
DWORD dwFlags;
GUID guidBufferFormat;
DWORD cbBuffer;
} DMUS_BUFFERDESC;
/* DMUS_EFFECT_ flags are used in the dwEffectFlags fields of both DMUS_PORTCAPS
* and DMUS_PORTPARAMS.
*/
#define DMUS_EFFECT_NONE 0x00000000
#define DMUS_EFFECT_REVERB 0x00000001
#define DMUS_EFFECT_CHORUS 0x00000002
/* For DMUS_PORTCAPS dwClass
*/
#define DMUS_PC_INPUTCLASS (0)
#define DMUS_PC_OUTPUTCLASS (1)
/* For DMUS_PORTCAPS dwFlags
*/
#define DMUS_PC_DLS (0x00000001)
#define DMUS_PC_EXTERNAL (0x00000002)
#define DMUS_PC_SOFTWARESYNTH (0x00000004)
#define DMUS_PC_MEMORYSIZEFIXED (0x00000008)
#define DMUS_PC_GMINHARDWARE (0x00000010)
#define DMUS_PC_GSINHARDWARE (0x00000020)
#define DMUS_PC_XGINHARDWARE (0x00000040)
#define DMUS_PC_DIRECTSOUND (0x00000080)
#define DMUS_PC_SHAREABLE (0x00000100)
#define DMUS_PC_DLS2 (0x00000200)
#define DMUS_PC_SYSTEMMEMORY (0x7FFFFFFF)
typedef struct _DMUS_PORTCAPS *LPDMUS_PORTCAPS;
typedef struct _DMUS_PORTCAPS
{
DWORD dwSize;
DWORD dwFlags;
GUID guidPort;
DWORD dwClass;
DWORD dwType;
DWORD dwMemorySize;
DWORD dwMaxChannelGroups;
DWORD dwMaxVoices;
DWORD dwMaxAudioChannels;
DWORD dwEffectFlags;
WCHAR wszDescription[DMUS_MAX_DESCRIPTION];
} DMUS_PORTCAPS;
/* Values for DMUS_PORTCAPS dwType. This field indicates the underlying
* driver type of the port.
*/
#define DMUS_PORT_WINMM_DRIVER (0)
#define DMUS_PORT_USER_MODE_SYNTH (1)
#define DMUS_PORT_KERNEL_MODE (2)
/* These flags (set in dwValidParams) indicate which other members of the */
/* DMUS_PORTPARAMS are valid. */
/* */
#define DMUS_PORTPARAMS_VOICES 0x00000001
#define DMUS_PORTPARAMS_CHANNELGROUPS 0x00000002
#define DMUS_PORTPARAMS_AUDIOCHANNELS 0x00000004
#define DMUS_PORTPARAMS_SAMPLERATE 0x00000008
#define DMUS_PORTPARAMS_EFFECTS 0x00000020
#define DMUS_PORTPARAMS_SHARE 0x00000040
typedef struct _DMUS_PORTPARAMS *LPDMUS_PORTPARAMS;
typedef struct _DMUS_PORTPARAMS
{
DWORD dwSize;
DWORD dwValidParams;
DWORD dwVoices;
DWORD dwChannelGroups;
DWORD dwAudioChannels;
DWORD dwSampleRate;
DWORD dwEffectFlags;
BOOL fShare;
} DMUS_PORTPARAMS;
typedef struct _DMUS_SYNTHSTATS *LPDMUS_SYNTHSTATS;
typedef struct _DMUS_SYNTHSTATS
{
DWORD dwSize; /* Size in bytes of the structure */
DWORD dwValidStats; /* Flags indicating which fields below are valid. */
DWORD dwVoices; /* Average number of voices playing. */
DWORD dwTotalCPU; /* Total CPU usage as percent * 100. */
DWORD dwCPUPerVoice; /* CPU per voice as percent * 100. */
DWORD dwLostNotes; /* Number of notes lost in 1 second. */
DWORD dwFreeMemory; /* Free memory in bytes */
long lPeakVolume; /* Decibel level * 100. */
} DMUS_SYNTHSTATS;
#define DMUS_SYNTHSTATS_VOICES (1 << 0)
#define DMUS_SYNTHSTATS_TOTAL_CPU (1 << 1)
#define DMUS_SYNTHSTATS_CPU_PER_VOICE (1 << 2)
#define DMUS_SYNTHSTATS_LOST_NOTES (1 << 3)
#define DMUS_SYNTHSTATS_PEAK_VOLUME (1 << 4)
#define DMUS_SYNTHSTATS_FREE_MEMORY (1 << 5)
#define DMUS_SYNTHSTATS_SYSTEMMEMORY DMUS_PC_SYSTEMMEMORY
typedef struct _DMUS_WAVES_REVERB_PARAMS
{
float fInGain; /* Input gain in dB (to avoid output overflows) */
float fReverbMix; /* Reverb mix in dB. 0dB means 100% wet reverb (no direct signal)
Negative values gives less wet signal.
The coeficients are calculated so that the overall output level stays
(approximately) constant regardless of the ammount of reverb mix. */
float fReverbTime; /* The reverb decay time, in milliseconds. */
float fHighFreqRTRatio; /* The ratio of the high frequencies to the global reverb time.
Unless very 'splashy-bright' reverbs are wanted, this should be set to
a value < 1.0.
For example if dRevTime==1000ms and dHighFreqRTRatio=0.1 than the
decay time for high frequencies will be 100ms.*/
} DMUS_WAVES_REVERB_PARAMS;
/* Note: Default values for Reverb are:
fInGain = 0.0dB (no change in level)
fReverbMix = -10.0dB (a reasonable reverb mix)
fReverbTime = 1000.0ms (one second global reverb time)
fHighFreqRTRatio = 0.001 (the ratio of the high frequencies to the global reverb time)
*/
typedef enum
{
DMUS_CLOCK_SYSTEM = 0,
DMUS_CLOCK_WAVE = 1
} DMUS_CLOCKTYPE;
typedef struct _DMUS_CLOCKINFO *LPDMUS_CLOCKINFO;
typedef struct _DMUS_CLOCKINFO
{
DWORD dwSize;
DMUS_CLOCKTYPE ctType;
GUID guidClock; /* Identifies this time source */
WCHAR wszDescription[DMUS_MAX_DESCRIPTION];
} DMUS_CLOCKINFO;
interface IDirectMusic;
interface IDirectMusicBuffer;
interface IDirectMusicPort;
interface IDirectMusicThru;
interface IReferenceClock;
#ifndef __cplusplus
typedef interface IDirectMusic IDirectMusic;
typedef interface IDirectMusicBuffer IDirectMusicBuffer;
typedef interface IDirectMusicPort IDirectMusicPort;
typedef interface IDirectMusicThru IDirectMusicThru;
typedef interface IReferenceClock IReferenceClock;
#endif
typedef IDirectMusic *LPDIRECTMUSIC;
typedef IDirectMusicBuffer *LPDIRECTMUSICBUFFER;
typedef IDirectMusicPort *LPDIRECTMUSICPORT;
#undef INTERFACE
#define INTERFACE IDirectMusic
DECLARE_INTERFACE_(IDirectMusic, IUnknown)
{
/* IUnknown */
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/* IDirectMusic */
STDMETHOD(EnumPort) (THIS_ DWORD dwIndex,
LPDMUS_PORTCAPS pPortCaps) PURE;
STDMETHOD(CreateMusicBuffer) (THIS_ LPDMUS_BUFFERDESC pBufferDesc,
LPDIRECTMUSICBUFFER *ppBuffer,
LPUNKNOWN pUnkOuter) PURE;
STDMETHOD(CreatePort) (THIS_ REFCLSID rclsidPort,
LPDMUS_PORTPARAMS pPortParams,
LPDIRECTMUSICPORT *ppPort,
LPUNKNOWN pUnkOuter) PURE;
STDMETHOD(EnumMasterClock) (THIS_ DWORD dwIndex,
LPDMUS_CLOCKINFO lpClockInfo) PURE;
STDMETHOD(GetMasterClock) (THIS_ LPGUID pguidClock,
IReferenceClock **ppReferenceClock) PURE;
STDMETHOD(SetMasterClock) (THIS_ REFGUID rguidClock) PURE;
STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE;
STDMETHOD(GetDefaultPort) (THIS_ LPGUID pguidPort) PURE;
STDMETHOD(SetDirectSound) (THIS_ LPDIRECTSOUND pDirectSound,
HWND hWnd) PURE;
};
#undef INTERFACE
#define INTERFACE IDirectMusicBuffer
DECLARE_INTERFACE_(IDirectMusicBuffer, IUnknown)
{
/* IUnknown */
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/* IDirectMusicBuffer */
STDMETHOD(Flush) (THIS) PURE;
STDMETHOD(TotalTime) (THIS_ LPREFERENCE_TIME prtTime) PURE;
STDMETHOD(PackStructured) (THIS_ REFERENCE_TIME rt,
DWORD dwChannelGroup,
DWORD dwChannelMessage) PURE;
STDMETHOD(PackUnstructured) (THIS_ REFERENCE_TIME rt,
DWORD dwChannelGroup,
DWORD cb,
LPBYTE lpb) PURE;
STDMETHOD(ResetReadPtr) (THIS) PURE;
STDMETHOD(GetNextEvent) (THIS_ LPREFERENCE_TIME prt,
LPDWORD pdwChannelGroup,
LPDWORD pdwLength,
LPBYTE *ppData) PURE;
STDMETHOD(GetRawBufferPtr) (THIS_ LPBYTE *ppData) PURE;
STDMETHOD(GetStartTime) (THIS_ LPREFERENCE_TIME prt) PURE;
STDMETHOD(GetUsedBytes) (THIS_ LPDWORD pcb) PURE;
STDMETHOD(GetMaxBytes) (THIS_ LPDWORD pcb) PURE;
STDMETHOD(GetBufferFormat) (THIS_ LPGUID pGuidFormat) PURE;
STDMETHOD(SetStartTime) (THIS_ REFERENCE_TIME rt) PURE;
STDMETHOD(SetUsedBytes) (THIS_ DWORD cb) PURE;
};
#undef INTERFACE
#define INTERFACE IDirectMusicInstrument
DECLARE_INTERFACE_(IDirectMusicInstrument, IUnknown)
{
/* IUnknown */
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/* IDirectMusicInstrument */
STDMETHOD(GetPatch) (THIS_ DWORD* pdwPatch) PURE;
STDMETHOD(SetPatch) (THIS_ DWORD dwPatch) PURE;
};
#undef INTERFACE
#define INTERFACE IDirectMusicDownloadedInstrument
DECLARE_INTERFACE_(IDirectMusicDownloadedInstrument, IUnknown)
{
/* IUnknown */
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/* IDirectMusicDownloadedInstrument */
/* None at this time */
};
#undef INTERFACE
#define INTERFACE IDirectMusicCollection
DECLARE_INTERFACE_(IDirectMusicCollection, IUnknown)
{
/* IUnknown */
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/* IDirectMusicCollection */
STDMETHOD(GetInstrument) (THIS_ DWORD dwPatch,
IDirectMusicInstrument** ppInstrument) PURE;
STDMETHOD(EnumInstrument) (THIS_ DWORD dwIndex,
DWORD* pdwPatch,
LPWSTR pwszName,
DWORD dwNameLen) PURE;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -