Index of refz


Declare Function auxGetVolume Lib "winmm.dll" (ByVal uDeviceID As Long, lpdwVolume As Long) As Long

Platforms

  • Windows 95: Supported.
  • Windows 98: Supported.
  • Windows NT: Requires Windows NT 3.1 or later.
  • Windows 2000: Supported.
  • Windows CE: Not Supported.

Description & Usage

auxGetVolume retrieves the current volume setting for an auxiliary audio device. This function will retreive the volume whether the device supports dual-channel volume control or not.

Return Value

If an error occured, the function returns a non-zero error code. If successful, the function returns 0.

Visual Basic-Specific Issues

None.

Parameters

uDeviceID
The device ID of the auxiliary audio device to retrieve the volume of. Valid values range from 0 to the number of auxiliary audio devices minus one.
lpdwVolume
Receives the volume settings of the device. If the device supports separate left and right channel volumes, the low-order word contains the left channel volume and the high-order word contains the right channel volume. If the device does not support separate volumes, the low-order word contains the overall volume. Valid volume settings range from &H0 or &HFFFF.

Example

' This code is licensed according to the terms and conditions listed here. ' Display the current volume setting of whatever device happens ' to be auxiliary audio device 0.  This example identifies whether the ' device has dual-channel volumes or not. Dim auxinfo As AUXCAPS  ' receives information about the device Dim numvols As Long  ' identifies number of volumes on the device Dim lrvol As Long  ' volumes of both channels (or just the overall volume) Dim lvol As Integer, rvol As Integer  ' volumes of left and right channels Dim retval As Long  ' return value ' Figure out whether the device has one or two volume settings. retval = auxGetDevCaps(0, auxinfo, Len(auxinfo)) If retval <> 0 Then  ' error   Debug.Print "Could not access auxiliary audio device 0 -- aborting."   End  ' give up End If If (auxinfo.dwSupport And AUXCAPS_LRVOLUME) = AUXCAPS_LRVOLUME Then   numvols = 2  ' separate left and right volumes Else   numvols = 1  ' only one overall volume End If ' Determine the device's current volume. retval = auxGetVolume(0, lrvol) ' Display the current volume setting for the device. If numvols = 2 Then   ' Separate the left and right channel volumes.  The next two lines look   ' like an excessively complicated way of doing it, but because of a   ' quirk in Visual Basic, the "obvious" way doesn't work properly.   lvol = Val("&H" & Hex(lrvol And (Not &HFFFF0000)))   rvol = (lrvol And &HFFFF0000) / &H10000   ' Display the results in hexadecimal.   Debug.Print "Left Channel volume: "; Hex(lvol)   Debug.Print "Right Channel volume: "; Hex(rvol) Else   ' Extract the useful information as above, although we only want   ' the low-order word (placed into lvol).   lvol = Val("&H" & Hex(lrvol And (Not &HFFFF0000)))   ' Display the results in hexadecimal.   Debug.Print "Volume: "; hex(lvol)  ' here, lvol is the overall volume End If

See Also

auxSetVolume

Category

Audio

Go back to the alphabetical Function listing.
Go back to the Reference section index.


Last Modified: September 10, 1999
This page is copyright © 1999 Paul Kuliniewicz. Copyright Information Revised October 29, 2000
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/a/auxgetvolume.html



Windows API Guide
Windows API Guide - Reference - Volume 1: Version 3.0 For the MS-DOS and PC-DOS Operating Systems
ISBN: B001V0KQIY
EAN: N/A
Year: 1998
Pages: 610

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net