📄 mixhw.h
字号:
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Copyright (c) 1999 Microsoft Corporation
Module Name:
mixhw.h
Abstract:
Defines the structures that describe the mixer hardware of the hardware platform
Environment:
Notes:
Revision History:
11/11/1999
-------------------------------------------------------------------*/
#ifndef _MIXHW_H_
#define _MIXHW_H_
enum
{
//Line 0 (line out) controls
LINE_OUT_VOLUME = 0,
LINE_OUT_MUTE,
// Line 1 (wave recorder)
WAVE_IN_GAIN,
WAVE_IN_MUTE,
WAVE_IN_SELECTOR, // record selector
// controls for PCM player
// PCM volume (AC97 register)
PCM_VOLUME, //9
// PCM mute (AC97 register)
PCM_MUTE,
// controls for line in
// LINE IN volume (AC97 register)
LINE_IN_VOLUME, //9
// LINE IN mute (AC97 register)
LINE_IN_MUTE,
// controls for microphone
MIC_VOLUME,
MIC_MUTE,
MAX_CONTROLS // keep last!
};
#define MAX_MULTIPLEXERS 1
#define MAX_MUX_INPUTS 3 // maximum number of inputs for a multiplexer
#define MAX_ATTENUATION 10000
// some helpful definitions
#define MONO 1
#define STEREO 2
#define MUTE TRUE
#define UNMUTE FALSE
#define LEFT_CHANNEL 0
#define RIGHT_CHANNEL 1
#define MIXERDRIVER_NAME TEXT("Mariner Audio Mixer")
// the lines are:
// two destination (line out - speakers), and wave in (recorder)
// three sources: line in , PCM output, mic in
typedef enum
{
NO_CONNECTION = -1,
LINE_OUT = 0,
WAVE_IN,
DESTINATION_LINES_COUNT,
// sources
PCM = DESTINATION_LINES_COUNT,
LINE_IN,
MICROPHONE,
LINES_COUNT
} MIXER_LINES;
typedef struct
{
DWORD dwMuxID;
MIXER_LINES muxedLines[MAX_MUX_INPUTS];
} MULTIPLEXER;
typedef struct
{
DWORD dwLineID; // the line with which the control is associated
DWORD dwControlType;
DWORD dwLogicalValue;
// that's the exposed value: the one mixerGetControlDetails() returns
// TRUE/FALSE for MUTE controls, 1 and 0 for MUX, 0 to 0x27102710 for volumes
// (0x2710 is decimal 10000). The value is interpreted as an hundredth of dB attenuation,
// so 10000 corresponds to -100 dB, and a smaller value means louder sound
// the driver handles the scaling from the logical value to the real (hardware) value
// Note: The hardware supported range is not as wide as the logical range;
// if the attenuation is larger than the hardware supports, the driver sets the
// (real) volume to minimum and mutes the corresponding line.
// This handling is completely transparent for the application (for example, when an application
// sets the volume to 10000 (-100 dB), the driver mutes the line. If the app calls
// mixerGetControlDetails to inquire about the line status, the driver reports that it's unmuted)
// Note: for volumes, the high word is LEFT, low word is RIGHT
// Note: We don't deal with balance; the application must do it by itself
DWORD dwRegister; // the AC97 register; only for VOLUME/MUTE; the mux controls have special handlers
DWORD dwMinimum; // hardware value corresponding to minimum sound level
DWORD dwMaximum; // hardware value corresponding to maximum sound level
//
// Note: those values are for internal use only. Applications inquiring about the limits will always get 0 and 10000
// as minimim and maximum. There is a small mistery here: the documentation doesn't clearly explain the
// semantics of those values: does "minimum" mean "minimum numeric value acceptable for the argument", or
// "numeric value that sets the volume to minimum"? We choose to go with the first interpretation,
// so all input values are considered to be attenuations, and "10000" is thhe maximum acceptable value
// for the parameter and indicates that the volume should be set to minimum (-100 dB)
//
TCHAR szShortName[MIXER_SHORT_NAME_CHARS];
TCHAR szName[MIXER_LONG_NAME_CHARS];
} SHORTMIXERCONTROL, *PSHORTMIXERCONTROL, FAR *LPSHORTMIXERCONTROL;
//extern MIXERLINE g_mixerLines[MAX_PLATFORMS][LINES_COUNT];
extern MIXERLINE g_mixerLines[LINES_COUNT];
extern MIXER_LINES g_Connections[DESTINATION_LINES_COUNT][LINES_COUNT - DESTINATION_LINES_COUNT];
extern SHORTMIXERCONTROL g_Controls[MAX_CONTROLS];
extern MULTIPLEXER g_Multiplexers[MAX_MULTIPLEXERS];
// mixer functions
DWORD SetMixerMute(PDRIVER_CONTEXT pDriverContext, DWORD dwId, BOOL bMute);
DWORD SetMixerVolume(PDRIVER_CONTEXT pDriverContext, DWORD dwId, DWORD dwLeft, DWORD dwRight );
DWORD GetMixerVolume(PDRIVER_CONTEXT pDriverContext, DWORD dwId, DWORD *pdwLeft, DWORD *pdwRight );
DWORD GetMixerMute(PDRIVER_CONTEXT pDriverContext, DWORD dwId, BOOL *pbMute );
DWORD GetMuxValue(PDRIVER_CONTEXT pDriverContext, DWORD dwControlID, PDWORD pdwValue);
DWORD SetMuxValue(PDRIVER_CONTEXT pDriverContext, DWORD dwControlID, DWORD dwValue);
DWORD GetUnsignedValue(PDRIVER_CONTEXT pDriverContext, DWORD dwControlID, PDWORD pdwValue);
DWORD SetUnsignedValue(PDRIVER_CONTEXT pDriverContext, DWORD dwControlID, DWORD dwValue);
LPMIXERLINE FindMixerLine(DWORD mxLine);
#endif // _CSMIX_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -