waveInSetVolume(3mms) — Subroutines
Name
waveInSetVolume --- Set the current volume of the specified waveform audio input device
Syntax
#include <mme/mme_api.h>
MMRESULT waveInSetVolume(UINT uClassDeviceID,
DWORD dwVolume);
Arguments
UINT uClassDeviceID
Identifies the waveform audio input device.
DWORD dwVolume
Specifies the new volume setting. The low-order word contains the left-channel volume setting and the high-order word contains the right-channel setting.
A value of 0xFFFF represents full volume and a value of 0x0000 represents full muting (silence). If a device does not support both left and right volume control, the low-order word of the dwVolume argument specifies the volume level and the high-order word is ignored.
Description
The waveInSetVolume function sets the current volume of the specified waveform audio input device. Not all devices support volume changes. To determine whether the device supports volume control, use the WAVECAPS_VOLUME flag to test the dwSupport field of the WAVEOUTCAPS data structure filled by the waveOutGetDevCaps function.
To determine whether the device supports volume control on both the left and right channels, use the WAVECAPS_LRVOLUME flag to test the dwSupport field of the WAVEOUTCAPS data structure filled by the waveOutGetDevCaps function.
Most devices do not support the full 16 bits of volume-level control and do not use the high-order bits of the requested volume setting. For example, for a device supporting 4 bits of volume control, requested volume level values of 0x4000, 0x4fff, and 0x43be produce the same physical volume setting, 0x4000.
The waveInGetVolume function returns the full 16-bit setting that is set with the waveInSetVolume function. Volume settings are interpreted logarithmically. This means that the perceived increase in volume is the same when increasing the volume level from 0x5000 to 0x6000 as it is from 0x4000 to 0x5000.
It is important that you do not set the input volume controls too high. If the volume is set too high, data can be clipped from your application.
Extensions
The waveInSetVolume function is a Digital extension to the Microsoft multimedia API specification.
Return Values
Returns MMSYSERR_NOERROR if the function is successful; otherwise, it returns one of the following error codes:
MMSYSERR_INVALHANDLE@T{ The specified device handle is invalid. T} MMSYSERR_NODRIVER@T{ The driver is not installed. T} MMSYSERR_NOTSUPPORTED@T{ The function is not supported. T}