📄 setvol.cls
字号:
Private Declare Function GlobalFree Lib "kernel32" _
(ByVal hmem As Long) As Long
Private Type MIXERCAPS
wMid As Integer ' manufacturer id
wPid As Integer ' product id
vDriverVersion As Long ' version of the driver
szPname As String * MAXPNAMELEN ' product name
fdwSupport As Long ' misc. support bits
cDestinations As Long ' count of destinations
End Type
Private Type MIXERCONTROL
cbStruct As Long ' size in Byte of MIXERCONTROL
dwControlID As Long ' unique control id for mixer device
dwControlType As Long ' MIXERCONTROL_CONTROLTYPE_xxx
fdwControl As Long ' MIXERCONTROL_CONTROLF_xxx
cMultipleItems As Long ' if MIXERCONTROL_CONTROLF_MULTIPLE set
szShortName As String * MIXER_SHORT_NAME_CHARS ' short name of control
szName As String * MIXER_LONG_NAME_CHARS ' long name of control
lMinimum As Long ' Minimum value
lMaximum As Long ' Maximum value
Reserved(10) As Long ' reserved structure space
End Type
Private Type MIXERCONTROLDETAILS
cbStruct As Long ' size in Byte of MIXERCONTROLDETAILS
dwControlID As Long ' control id to get/set details on
cChannels As Long ' number of channels in paDetails array
item As Long ' hwndOwner or cMultipleItems
cbDetails As Long ' size of _one_ details_XX struct
paDetails As Long ' pointer to array of details_XX structs
End Type
Private Type MIXERCONTROLDETAILS_UNSIGNED
dwValue As Long ' value of the control
End Type
Private Type MIXERCONTROLDETAILS_BOOLEAN
fValue As Long
End Type
Private Type MIXERCONTROLDETAILS_SIGNED
' The MIXERCONTROLDETAILS_SIGNED user-defined type retrieves and
' sets signed type control
' properties for an audio mixer control.
lValue As Long
End Type
Private Type MIXERCONTROLDETAILS_LISTTEXT
dwParam1 As Long
dwParam2 As Long
szName As String * MIXER_LONG_NAME_CHARS
End Type
Private Type MIXERLINE
cbStruct As Long ' size of MIXERLINE structure
dwDestination As Long ' zero based destination index
dwSource As Long ' zero based source index (if source)
dwLineID As Long ' unique line id for mixer device
fdwLine As Long ' state/information about line
dwUser As Long ' driver specific information
dwComponentType As Long ' component type line connects to
cChannels As Long ' number of channels line supports
cConnections As Long ' number of connections (possible)
cControls As Long ' number of controls at this line
szShortName As String * MIXER_SHORT_NAME_CHARS
szName As String * MIXER_LONG_NAME_CHARS
dwType As Long
dwDeviceID As Long
wMid As Integer
wPid As Integer
vDriverVersion As Long
szPname As String * MAXPNAMELEN
End Type
Private Type MIXERLINECONTROLS
cbStruct As Long ' size in Byte of MIXERLINECONTROLS
dwLineID As Long ' line id (from MIXERLINE.dwLineID)
' MIXER_GETLINECONTROLSF_ONEBYID or
dwControl As Long ' MIXER_GETLINECONTROLSF_ONEBYTYPE
cControls As Long ' count of controls pmxctrl points to
cbmxctrl As Long ' size in Byte of _one_ MIXERCONTROL
pamxctrl As Long ' pointer to first MIXERCONTROL array
End Type
Private hmixer As Long ' mixer handle
'-----------------------------------------------------------------------------
'Volume
Private volCtrl As MIXERCONTROL ' waveout volume control
Private micCtrl As MIXERCONTROL ' Microphon
Private linCtrl As MIXERCONTROL ' Line
Private cdCtrl As MIXERCONTROL ' CD
Private synCtrl As MIXERCONTROL ' Synthisizer
Private wavCtrl As MIXERCONTROL ' Wave
'Mute
Private volMute As MIXERCONTROL ' waveout volume control
Private micMute As MIXERCONTROL ' Microphon
Private linMute As MIXERCONTROL ' Line
Private cdMute As MIXERCONTROL ' CD
Private synMute As MIXERCONTROL ' Synthisizer
Private wavMute As MIXERCONTROL ' Wave
'Fader
Private volFad As MIXERCONTROL
Private micFad As MIXERCONTROL
Private linFad As MIXERCONTROL
Private cdFad As MIXERCONTROL
Private synFad As MIXERCONTROL
Private wavFad As MIXERCONTROL
'Bass
Private volBass As MIXERCONTROL
Private micBass As MIXERCONTROL
Private linBass As MIXERCONTROL
Private cdBass As MIXERCONTROL
Private synBass As MIXERCONTROL
Private wavBass As MIXERCONTROL
'Treble
Private volTreb As MIXERCONTROL
Private micTreb As MIXERCONTROL
Private linTreb As MIXERCONTROL
Private cdTreb As MIXERCONTROL
Private synTreb As MIXERCONTROL
Private wavTreb As MIXERCONTROL
'Pan
Private volPan As MIXERCONTROL
Private micPan As MIXERCONTROL
Private linPan As MIXERCONTROL
Private cdPan As MIXERCONTROL
Private synPan As MIXERCONTROL
Private wavPan As MIXERCONTROL
'-----------------------------------------------------------------------------
Private rc As Long ' return code
Private ok As Boolean ' boolean return code
' Audiolevel------------------------------------------------------------------
Private Const CALLBACK_FUNCTION = &H30000
Private Const MM_WIM_DATA = &H3C0
Private Const WHDR_DONE = &H1 ' done bit
Private Const GMEM_FIXED = &H0 ' Global Memory Flag used by GlobalAlloc functin
Private Type WAVEHDR
' The WAVEHDR user-defined type defines the header used to identify a waveform-audio buffer.
lpData As Long ' Address of the waveform buffer.
dwBufferLength As Long ' Length, in bytes, of the buffer.
dwBytesRecorded As Long ' When the header is used in input, this member specifies how much
' data is in the buffer.
dwUser As Long ' User data.
dwFlags As Long ' Flags supplying information about the buffer. Set equal to zero.
dwLoops As Long ' Number of times to play the loop. Set equal to zero.
lpNext As Long ' Not used
Reserved As Long ' Not used
End Type
Private Type WAVEINCAPS
' The WAVEINCAPS user-defined variable describes the capabilities of a waveform-audio input
' device.
wMid As Integer ' Manufacturer identifier for the device driver for the
' waveform-audio input device. Manufacturer identifiers
' are defined in Manufacturer and Product Identifiers in
' the Platform SDK product documentation.
wPid As Integer ' Product identifier for the waveform-audio input device.
' Product identifiers are defined in Manufacturer and Product
' Identifiers in the Platform SDK product documentation.
vDriverVersion As Long ' Version number of the device driver for the
' waveform-audio input device. The high-order byte
' is the major version number, and the low-order byte
' is the minor version number.
szPname As String * 32 ' Product name in a null-terminated string.
dwFormats As Long ' Standard formats that are supported. See the Platform
' SDK product documentation for more information.
wChannels As Integer ' Number specifying whether the device supports
' mono (1) or stereo (2) input.
End Type
Private Type WAVEFORMAT
' The WAVEFORMAT user-defined type describes the format of waveform-audio data. Only
' format information common to all waveform-audio data formats is included in this
' user-defined type.
wFormatTag As Integer ' Format type. Use the constant WAVE_FORMAT_PCM Waveform-audio data
' to define the data as PCM.
nChannels As Integer ' Number of channels in the waveform-audio data. Mono data uses one
' channel and stereo data uses two channels.
nSamplesPerSec As Long ' Sample rate, in samples per second.
nAvgBytesPerSec As Long ' Required average data transfer rate, in bytes per second. For
' example, 16-bit stereo at 44.1 kHz has an average data rate of
' 176,400 bytes per second (2 channels
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -