📄 wmaudio.h
字号:
* in decibels.
* channels One or more of the WM_CHANNEL_XXX constants.
*
*
* Returns: WMSTATUS
* WMS_SUCCESS - success
* WMS_UNSUPPORTED - signal is not supported, or doesn't
* support volume control
* WMS_NO_SUPPORTED_DEVICE - device support not present
* See WMStatus.h for all other values and meanings.
*---------------------------------------------------------------------------*/
WMSTATUS WMAudioSetSignalVolumeDb( WM_DEVICE_HANDLE hDevice,
WM_AUDIO_SIGNAL signal,
int dbVol,
WM_AUDIO_CHANNELS channels
);
/*-----------------------------------------------------------------------------
* Function: WMAudioSetSignalVolumesDb
*
* Set the signal level relative to full-scale.
*
* Note: the underlying device may not use dB steps. In this case, the applied
* level will be rounded to the nearest available step. For example, if the device
* has a 1.5dB step size (typical of AC'97 devices), a level of 4 or 5 would both
* result in a 4.5dBFS signal.
*
* Parameters:
* hDevice The handle to the device (from WMOpenDevice).
* signal The signal to set.
* leftVol The relative amplification or attenuation to apply
* to the left channel, in decibels.
* rightVol The relative amplification or attenuation to apply
* to the right channel, in decibels.
*
*
* Returns: WMSTATUS
* WMS_SUCCESS - success
* WMS_UNSUPPORTED - signal is not supported, or doesn't
* support volume control
* WMS_NO_SUPPORTED_DEVICE - device support not present
* See WMStatus.h for all other values and meanings.
*---------------------------------------------------------------------------*/
WMSTATUS WMAudioSetSignalVolumesDb( WM_DEVICE_HANDLE hDevice,
WM_AUDIO_SIGNAL signal,
int leftVol,
int rightVol
);
/*-----------------------------------------------------------------------------
* Function: WMAudioGetSignalVolumeDb
*
* Returns the signal level relative to full-scale, rounded to the nearest dB
* relative to a full-scale signal.
*
* Note: If multiple channels are specified (e.g. WM_CHANNEL_STEREO) this function
* assumes all channels are at the same level and returns the level of the first
* channel it finds. To check for different levels on different channels, call this
* function once for each channel (e.g. once with WM_CHANNEL_LEFT and once with
* WM_CHANNEL_RIGHT).
*
* Parameters:
* hDevice The handle to the device (from WMOpenDevice).
* signal The signal to get.
* pVol Receives the relative signal level in decibels.
* channel One of the WM_CHANNEL_XXX constants.
*
* Returns: WMSTATUS
* WMS_SUCCESS - success
* WMS_UNSUPPORTED - signal is not supported, or doesn't
* support volume control
* WMS_NO_SUPPORTED_DEVICE - device support not present
* See WMStatus.h for all other values and meanings.
*---------------------------------------------------------------------------*/
WMSTATUS WMAudioGetSignalVolumeDb( WM_DEVICE_HANDLE hDevice,
WM_AUDIO_SIGNAL signal,
int *pVol,
WM_AUDIO_CHANNELS channel
);
/*-----------------------------------------------------------------------------
* Function: WMAudioSetSignalVolumeAdv
*
* Set the signal level relative to full-scale, specifying the level in 1/16dB
* steps relative to full scale. The WM_SIGNAL_LEVEL macro can convert from
* a dB value to the corresponding 1/16dB value. E.g. WM_SIGNAL_LEVEL( 1.5 )
* gives 0x18, which corresponds to 1.5dBFS.
*
* Note: the underlying device will probably not be able to set this level
* precisely. The applied level will be rounded to the nearest available
* step. For example, if the device has a 1.5dB step size (typical of AC'97
* devices), a level of WM_SIGNAL_LEVEL(4) (0x40), WM_SIGNAL_LEVEL(4.125) (0x42),
* WM_SIGNAL_LEVEL(4.5) (0x48) or WM_SIGNAL_LEVEL( 5 ) (0x50) would all
* result in a 4.5dBFS signal.
*
* Parameters:
* hDevice The handle to the device (from WMOpenDevice).
* signal The signal to set.
* baseVol The relative amplification or attenuation to apply,
* in 1/16 dB steps.
* channels One or more of the WM_CHANNEL_XXX constants.
*
* Returns: WMSTATUS
* WMS_SUCCESS - success
* WMS_UNSUPPORTED - signal is not supported, or doesn't
* support volume control
* WMS_NO_SUPPORTED_DEVICE - device support not present
* See WMStatus.h for all other values and meanings.
*---------------------------------------------------------------------------*/
WMSTATUS WMAudioSetSignalVolumeAdv( WM_DEVICE_HANDLE hDevice,
WM_AUDIO_SIGNAL signal,
int baseVol,
WM_AUDIO_CHANNELS channels
);
/*-----------------------------------------------------------------------------
* Function: WMAudioSetSignalVolumesAdv
*
* Set the signal level relative to full-scale, specifying the level in 1/16dB
* steps relative to full scale. The WM_SIGNAL_LEVEL macro can convert from
* a dB value to the corresponding 1/16dB value. E.g. WM_SIGNAL_LEVEL( 1.5 )
* gives 0x18, which corresponds to 1.5dBFS.
*
* Note: the underlying device will probably not be able to set this level
* precisely. The applied level will be rounded to the nearest available
* step. For example, if the device has a 1.5dB step size (typical of AC'97
* devices), a level of WM_SIGNAL_LEVEL(4) (0x40), WM_SIGNAL_LEVEL(4.125) (0x42),
* WM_SIGNAL_LEVEL(4.5) (0x48) or WM_SIGNAL_LEVEL( 5 ) (0x50) would all
* result in a 4.5dBFS signal.
*
* Parameters:
* hDevice The handle to the device (from WMOpenDevice).
* signal The signal to set.
* leftVol The relative amplification or attenuation to apply,
* in 1/16 dB steps.
* rightVol The relative amplification or attenuation to apply,
* in 1/16 dB steps.
*
* Returns: WMSTATUS
* WMS_SUCCESS - success
* WMS_UNSUPPORTED - signal is not supported, or doesn't
* support volume control
* WMS_NO_SUPPORTED_DEVICE - device support not present
* See WMStatus.h for all other values and meanings.
*---------------------------------------------------------------------------*/
WMSTATUS WMAudioSetSignalVolumesAdv( WM_DEVICE_HANDLE hDevice,
WM_AUDIO_SIGNAL signal,
int leftVol,
int rightVol
);
/*-----------------------------------------------------------------------------
* Function: WMAudioGetSignalVolumeAdv
*
* Returns the signal level relative to full-scale, using 1/16dB steps.
*
* Note: If multiple channels are specified (e.g. WM_CHANNEL_STEREO) this function
* assumes all channels are at the same level and returns the level of the first
* channel it finds. To check for different levels on different channels, call this
* function once for each channel (e.g. once with WM_CHANNEL_LEFT and once with
* WM_CHANNEL_RIGHT).
*
* Parameters:
* hDevice The handle to the device (from WMOpenDevice).
* signal The signal to get.
* pVol Receives the relative signal level in 1/16 dB steps.
* channel One of the WM_CHANNEL_XXX constants.
*
* Returns: WMSTATUS
* WMS_SUCCESS - success
* WMS_UNSUPPORTED - signal is not supported, or doesn't
* support volume control
* WMS_NO_SUPPORTED_DEVICE - device support not present
* See WMStatus.h for all other values and meanings.
*---------------------------------------------------------------------------*/
WMSTATUS WMAudioGetSignalVolumeAdv( WM_DEVICE_HANDLE hDevice,
WM_AUDIO_SIGNAL signal,
int *pVol,
WM_AUDIO_CHANNELS channel
);
/*-----------------------------------------------------------------------------
* Function: WMAudioVolToDbAdv
*
* Called to calculate the dB volume for a given perceived volume level.
* Experiments have shown that a 10dB increase in sound level corresponds
* approximately to a perceived doubling of loudness. We take 0x10000 as
* 0dBFS, and scale from there (so 0xFFFF is loudest, 0x8000 is -10dBFS,
* 0x4000 is -20dBFS, etc).
*
* Note: Linearly reducing the perceived volume does _not_ result in a linear
* attenuation of the output signal.
*
* Parameters:
* hDevice device handle
* perceivedVolume 16-bit volume where 0xFFFF is 0dBFS
*
* Returns: int
* corresponding volume in 1/16dB steps
*---------------------------------------------------------------------------*/
int WMAudioVolToDbAdv( WM_DEVICE_HANDLE hDevice, unsigned short perceivedVolume );
/*-----------------------------------------------------------------------------
* Function: WMAudioSetSignalVolume
*
* Set the perceived volume for the given signal.
* Experiments have shown that a 10dB increase in sound level corresponds
* approximately to a perceived doubling of loudness. We take 0x10000 as
* 0dBFS, and scale from there (so 0xFFFF is loudest, 0x8000 is -10dBFS,
* 0x4000 is -20dBFS, etc).
*
* Note: Linearly reducing the perceived volume does _not_ result in a linear
* attenuation of the output signal.
*
* Parameters:
* hDevice The handle to the device (from WMOpenDevice).
* signal The signal to set.
* volume The level to apply, where 0xFFFF is 0dBFS.
* channels One or more of the WM_CHANNEL_XXX constants.
*
*
* Returns: WMSTATUS
* WMS_SUCCESS - success
* WMS_UNSUPPORTED - signal is not supported, or doesn't
* support volume control
* WMS_NO_SUPPORTED_DEVICE - device support not present
* See WMStatus.h for all other values and meanings.
*---------------------------------------------------------------------------*/
WMSTATUS WMAudioSetSignalVolume( WM_DEVICE_HANDLE hDevice,
WM_AUDIO_SIGNAL signal,
unsigned short volume,
WM_AUDIO_CHANNELS channels
);
/*-----------------------------------------------------------------------------
* Function: WMAudioSetSignalVolumes
*
* Set the perceived volumes for the given stereo signal.
* Experiments have shown that a 10dB increase in sound level corresponds
* approximately to a perceived doubling of loudness. We take 0x10000 as
* 0dBFS, and scale from there (so 0xFFFF is loudest, 0x8000 is -10dBFS,
* 0x4000 is -20dBFS, etc).
*
* Note: Linearly reducing the perceived volume does _not_ result in a linear
* attenuation of the output signal.
*
* Parameters:
* hDevice The handle to the device (from WMOpenDevice).
* signal The signal to set.
* leftVol The level to apply to the left channel, where 0xFFFF
* is 0dBFS.
* rightVol The level to apply to the right channel, where 0xFFFF
* is 0dBFS.
*
* Returns: WMSTATUS
* WMS_SUCCESS - success
* WMS_UNSUPPORTED - signal is not supported, or doesn't
* support volume control
* WMS_NO_SUPPORTED_DEVICE - device support not present
* See WMStatus.h for all other values and meanings.
*---------------------------------------------------------------------------*/
WMSTATUS WMAudioSetSignalVolumes( WM_DEVICE_HANDLE hDevice,
WM_AUDIO_SIGNAL signal,
unsigned short leftVol,
unsigned short rightVol
);
/*-----------------------------------------------------------------------------
* Macro: WMAudioSetOutputAttenuation
*
* This function is deprecated and may be removed in a future release.
* Use WMAudioSetSignalVolumeDb or WMAudioSetSignalVolumeAdv instead.
*---------------------------------------------------------------------------*/
#define WMAudioSetOutputAttenuation( _hDevice,_output, _attenuationDB ) \
WMAudioSetOutputAttenuations( _hDevice, \
_output, \
_output, \
_attenuationdB, \
_attenuationdB, \
WM_CHANNELS_STEREO \
)
/*-----------------------------------------------------------------------------
* Function: WMAudioSetOutputAttenuations
*
* This function is deprecated and may be removed in a future release.
* Use WMAudioSetSignalVolumeDb or WMAudioSetSignalVolumeAdv instead.
*---------------------------------------------------------------------------*/
WMSTATUS WMAudioSetOutputAttenuations( WM_DEVICE_HANDLE hDevice,
WM_AUDIO_SIGNAL outputL,
WM_AUDIO_SIGNAL outputR,
int attenuationdBLeft,
int attenuationdBRight
);
/*-----------------------------------------------------------------------------
* Macro: WMAudioSetOutputVolume
*
* This function is deprecated and may be removed in a future release.
* Use WMAudioSetSignalVolume instead.
*---------------------------------------------------------------------------*/
#define WMAudioSetOutputVolume( _hDevice, _output, _volPercent ) \
WMAudioSetOutputVolumes( _hDevice, \
_output, \
_volPercent, \
_volPercent, \
WM_CHANNEL_STEREO \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -