Help!! how to locate the last USB Speaker device

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: polybear (poly_at_mega)
Date: 06/17/04


Date: Thu, 17 Jun 2004 13:57:10 +0800

Help!!
Q: How can i locate the USB Speaker(last plug in) and make it sounds in the
multiple USB Speakers in OS Win2000 ???

Following are the answers by Sir. Scott McPhillips [MVP] in BaseService
Group .
============================================================================
=========================================

"Scott McPhillips [MVP]" <scottmcp@mvps.org.nothere> ¦b¶l¥ó
news:escCGkBVEHA.2360@TK2MSFTNGP10.phx.gbl ¤¤¼¶¼g...
> polybear wrote:
> > How can i open a specific waveform-audio output device in a
system???If
> > there is more then one USB SPEAKER in my system
> >
> >
> >
============================================================================
==========
>
> Check out waveOutGetNumDevs and waveOutGetDevCaps. After looping
> through the devices to find the one that you want, use the corresponding
> uDeviceID in waveOutOpen.
>
> "Use the waveOutGetNumDevs function to determine the number of
> waveform-audio output devices present in the system. If the value
> specified by the uDeviceID parameter is a device identifier, it can vary
> from zero to one less than the number of devices present."
>
> --
> Scott McPhillips [VC++ MVP]
>

PolyBear says :

Thank for your kidly answers
I had done the way you says,But i still have problem that
I have two USB waveform-audio output device , i do need to
recognize them, they don't have a particular handle and name
 , such as :
index handle cap.name (return by waveOutGetDevCaps)
0 0x00faabc0 Sound card device
1 0x00faabc0 USB sound device
2 0x00faabc0 USB sound device (2)

for example
If i remove device which is index 1 , the follow device will
be rearange like below
index handle cap.name
0 0x00faabc0 Sound card device
1 0x00faabc0 USB sound device <----it was USB
sound device (2)

now i plug it back
index handle cap.name
0 0x00faabc0 Sound card device
1 0x00faabc0 USB sound device <----plug now
2 0x00faabc0 USB sound device (2) <----it becomes
USB sound device (2) again.

How can i recognize the New plug USB speaker (if i can't find it by handle
or cap.name)
and How can other wave-functions gets the specific device by the handles
all the same ?

????????????????????????????
???????????????????????????????????????????????????