Results 1 to 9 of 9

Thread: Getting sound devices

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2003
    Location
    Amsterdam, The Netherlands
    Posts
    53

    Getting sound devices

    I need to get a list of sound devices available so the user can select which one to use.. How do I find these?

  2. #2
    Hyperactive Member jovton's Avatar
    Join Date
    Nov 2000
    Location
    South Africa
    Posts
    266
    Again, many thanks to persons like "Ken" and "Mike Hildner", they gave me a method that works almost prefectly. But I think it only works for Win 2K and up. It uses WMI.

    Take a look at this thread:

    http://www.vbforums.com/showthread.p...postid=1593456

    This is for modems, but the same principle can be applied to sound devices. Just use "Win32_SoundDevice" instead of "Win32_POTSModem"

    For some reason I feel like I can't stress my gratitude enough.
    Last edited by jovton; Jan 3rd, 2004 at 03:28 PM.
    jovton

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 2003
    Location
    Amsterdam, The Netherlands
    Posts
    53
    It works for the modem, yes, but not for the sounddevice..

  4. #4
    Hyperactive Member jovton's Avatar
    Join Date
    Nov 2000
    Location
    South Africa
    Posts
    266
    Originally posted by paulheu
    It works for the modem, yes, but not for the sounddevice..
    Did you replace "Win32_POTSModem" with "Win32_SoundDevice"?
    jovton

  5. #5

    Thread Starter
    Member
    Join Date
    Nov 2003
    Location
    Amsterdam, The Netherlands
    Posts
    53
    yes.. I get an error if I do.. For those who wonder here's the code in question:

    VB Code:
    1. Dim moReturn As Management.ManagementObjectCollection
    2.         Dim moSearch As Management.ManagementObjectSearcher
    3.         Dim mo As Management.ManagementObject
    4.  
    5.         moSearch = New Management.ManagementObjectSearcher_
    6. ("Select * from Win32_SoundDevice")
    7.         moReturn = moSearch.Get
    8.  
    9.         For Each mo In moReturn
    10.             Debug.WriteLine(mo("Name") & " is attached to " & mo_
    11. ("AttachedTo"))
    12.         Next
    If I change the For .. next code to debug.writeline(mo) I get thsi back:

    \\P4-2G0\root\cimv2:Win32_SoundDevice.DeviceID="PCI\\VEN_1102&DEV_0004&SUBSYS_10021102&REV_04\\4&1351887D &0&50F0"

    which in itself works, but still does not help me any further but give me the location in the registry where the AudioDevice is..
    Last edited by paulheu; Jan 3rd, 2004 at 07:18 PM.

  6. #6
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    That's because SoundDevice has no property called AttachedTo, remove that and it will work. Look here for the properties of sound device.

    http://msdn.microsoft.com/library/en...asp?frame=true
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  7. #7

    Thread Starter
    Member
    Join Date
    Nov 2003
    Location
    Amsterdam, The Netherlands
    Posts
    53
    While I got this working it does not help me. I'll try to explain:

    I have a Creative Audigy using kX proect drivers. This driver gives me a total of 5 devices I can use:

    kX Wave SB0240 10k2 [ff40] 0/1
    kX Wave SB0240 10k2 [ff40] 4/5
    kX Wave SB0240 10k2 [ff40] 6/7
    kX Wave SB0240 10k2 [ff40] 8/9
    kX Wave SB0240 10k2 [ff40] HQ

    What I want to do is find these names and put them in a combobox so the user can select which device to use..

    In this case the name exists in the registry as 'FriendlyName' under each separate instance of te device.. but I cannot find any reference to the name of the device entry while I assume there must be one somewhere.. So I am looking for the way to get to this name and also selecting the desired device for output..


    Confused? I know I am.. ;^)
    Last edited by paulheu; Jan 3rd, 2004 at 07:36 PM.

  8. #8
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    I think these are not real devices rather they appear to be drivers for one device . So ,that method could be only for hardwares , not sure though .Did you try anything with DX . That's world of Audio & Video .

  9. #9

    Thread Starter
    Member
    Join Date
    Nov 2003
    Location
    Amsterdam, The Netherlands
    Posts
    53

    Update? yes an update :^)

    I found this which is quite interesting.. I converted the code to .NET but now it does not find any soundcards.. Anyone willing to have a peek can get the .NET code I have now here.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width