waveOutGetDevCaps Function

Declare Function waveOutGetDevCaps Lib "winmm.dll" Alias "waveOutGetDevCapsA" (ByVal uDeviceID As Long, lpCaps As WAVEOUTCAPS, ByVal uSize As Long) As Long

Platforms: Win 95/98, Win NT

waveOutGetDevCaps reads the capabilities and other information about a given waveform output device. This information is placed in the structure passed as lpCaps. This function can determine what operations a waveform output device can perform. The function returns 0 if successful, or a non-zero error code if an error occured.

uDeviceID
The device identifier of the waveform output device to get information about. Remember that the first device has an identifier of 0.
lpCaps
Receives the information about the waveform output device.
uSize
The size in bytes of lpCaps.
' List the names and number of channels of every installed waveform output
' device.  Note how we only check the valid device identifiers.
Dim outinfo As WAVEOUTCAPS ' receives info about each device
Dim numdevs As Long  ' number of installed devices
Dim thisdev As Long  ' counter for which device we're checking
Dim outname As String  ' buffer for device's name
Dim retval As Long  ' return value

' First, determine the number of waveform output devices.
numdevs = waveOutGetNumDevs()
' Loop through each device and display the desired information.  Keep in mind that the first
' device has an identifier of 0, etc.
For thisdev = 0 To numdevs - 1
  ' Get the capabilities of the device
  retval = waveOutGetDevCaps(thisdev, outinfo, Len(outinfo))
  If retval = 0 Then  ' only continue if the above function succeeded
    Debug.Print "Device #"; thisdev
    ' Extract device name from fixed-length string
    outname = Left(outinfo.szPname, InStr(outinfo.szPname, vbNullChar) - 1)
    Debug.Print "  "; outname;
    ' Display number of channels -- i.e., is it mono or stereo?
    If outinfo.nChannels = 1 Then
      Debug.Print " (mono)"
    Else
      Debug.Print " (stereo)"
    End If
  End If
Next thisdev

Category: Audio

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


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
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/w/waveoutgetdevcaps.html