LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
asbo

Update the lvsound2 library (Sound Input/Sound Output VIs) to support changing audio devices on-the-fly

Status: Declined

Moved to CAR database: CAR 722510

Currently the lvsound2 library -- the Sound Input and Sound Output VIs supported by lvsound2.llb and lvsound2.dll -- updates the audio device list from the operating system only when first being loaded into memory. If you change the device list (e.g.., pair/unpair a Bluetooth headset) the device IDs will not reflect the new configuration until all the lvsound2-dependent VIs have been unloaded from memory. After adding or removing a device, the VIs will generate error 4803 ("The sound driver or card does not support the desired operation.") for device IDs related to the new/removed device,  even if the ID is still actually valid and points to something else. This is extraordinarily inconvenient for test systems focused on audio device testing, but understandably a niche issue, which may be why it hasn't been caught before now.

 

In the interim, the workaround is to dynamically call any of the VIs you're interested in to force them to load/unload as necessary. There are two appropriate solutions I can think of:

 

1) Update the Sound X VIs to implement the dynamic call workaround (preferably directly around lvsound2.dll calls so we can still borrow other VIs in the LLB).

2) Update the DLL to support on-the-fly changes.

 

The latter solution is ideal, particularly for performance. This reads both as a suggestion and a bug report so that anyone else who has this problem can find a public forum documenting the issue.

14 Comments
AndreaNRG
Member

Hello,

 

I think g-audio is a great work, but i cannot find the way for set a different volume for left and right... I can't well understand how work the different "channels". Someone could help me with an example please? The "mixer" example on the package don't help because don't set different volume between L/R channels. (I am working on Debian, xubuntu linux). Thanks in advance.

Dataflow_G
Member

Hi AndreaNRG,

 

One way to set the left and right channel volume is to multiply the audio data before sending it to the playback device. This is a modified version of Audio Playback Example.vi, which adds left + right numeric controls to set the L+R volume (VI download here). Note that all audio file loading and processing is done as SGL in this example (the original example was I16).

 

Audio Playback Example (L+R).png

 

In terms of the G-Audio Mixer, a 'channel' is a logical channel (think a channel on a mixing console), not an individual audio channel. A separate pan property would be needed to handle the L+R channel volume. I'll look at adding it in a future update.

AndreaNRG
Member

Hello,

 

there is any chance to play two different wav file via two different audio devices in the same vi? I can't do it, my application crash.

 

best regards,

Andreaplaytwocards.png

Dataflow_G
Member

Hi AndreaNRG,

 

I've sent you a PM to help with the multi-device troubleshooting.

 

If anyone runs into issues with G-Audio, they can also be raised them through the github issue tracker. Thanks!