Jump to content

Getting a list of sound devices in the system


Recommended Posts

Hi there,

I would like the user of my app to be able to select which audio device/soundcard to read from. At the moment I am just reading from Device 0. This works because Device 0 is the soundcard if no external device is plugged in and then any device I add is assigned to Device 0 instead.

This is a bit limited though. I know there must be a Windows api call to get an enumerated list of the active devices (in fact the express vi for sound capture has just this list). Does anyone know how to do it please?

Thanks very much,

Martin

Link to comment

There's a really handy couple of VIs in vi.lib\sound2\lvsound.llb:

1. Get Num Devices - this lists the number of input and output devices in your system

2. Sound Device Info - returns the *NAME* of the sound device associated with a number

I normally use #1 to set N on a for loop, and populate a ring control with the names out of #2.

Shaun

  • Like 2
Link to comment
  • 8 years later...

Getting the audio devive list by using the function "SoundNumDevices" in lvsound2.dll only works once.

If the devices on the PC change, and this function is called again, it always returns the same device list.  It is as if this DLL obtains the device list form the PC when it is loaded (maybe a class is instantiated then).  The only way to get an updated list is to relaunch your EXE or if in the dev enviroment to close all VIs that use sound tools in the dev project then open them again.

 

Does any one know a way to refresh the audio device list without restarting the app (or closing and reloading the VI)?

 

NOTE: I am using Labview 2017 SP1

Edited by ekaetz
Link to comment
  • 2 years later...
On 9/9/2018 at 4:54 AM, ekaetz said:

Getting the audio devive list by using the function "SoundNumDevices" in lvsound2.dll only works once.

If the devices on the PC change, and this function is called again, it always returns the same device list.  It is as if this DLL obtains the device list form the PC when it is loaded (maybe a class is instantiated then).  The only way to get an updated list is to relaunch your EXE or if in the dev enviroment to close all VIs that use sound tools in the dev project then open them again.

 

Does any one know a way to refresh the audio device list without restarting the app (or closing and reloading the VI)?

 

NOTE: I am using Labview 2017 SP1

Yeah that is really annoying!!! 😤😤😤😤

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.