Page 1 of 1

Setting audio output device

Posted: 13 Jul 2013 08:10
by Hanley
Using 2.1 on Windows 8.

I want my app to display the available audio output devices and let the user choose which one vlc's audio goes out of, like VLC Media Player 2.1. But...

libvlc_audio_output_device_id and libvlc_audio_output_device_count are deprecated and just return 0 anyway.

And the newer libvlc_audio_output_device_list_get just returns empty as well.

I've tried it with both waveout and directsound. I know the devices exist because if I write in the device names as they appear in VLC Media Player's list into the libvlc_audio_output_device_set method it works. But this obviously won't work since I have no way of knowing what devices the user will have.

Any suggestions?

Re: Setting audio output device

Posted: 13 Jul 2013 10:04
by Rémi Denis-Courmont
Should be fixed now.

Re: Setting audio output device

Posted: 13 Jul 2013 16:00
by Hanley
Thanks for the quick reply. I tried the latest nightly (2.2) and am still getting no devices. Maybe I'm doing something wrong:

This is the codeI'm using to print out the available device names. (DBG is a JUCE macro that outputs the string to Visual's output, and String is a JUCE class)

Code: Select all

libvlc_audio_output_t* outputs; outputs = libvlc_audio_output_list_get(vlc_instan); DBG ("AUDIO OUTPUTS"); libvlc_audio_output_device_t* devices; while (outputs) { DBG(String(outputs->psz_name)); devices = libvlc_audio_output_device_list_get(vlc_instan, outputs->psz_name); if (devices) { DBG("Devices found"); } else { DBG("No devices found"); } outputs = outputs->p_next; }
I get the available audio outputs just fine, but no device names. Am I doing something wrong?

Re: Setting audio output device

Posted: 13 Jul 2013 18:45
by Rémi Denis-Courmont
Should work with version 2.1.0-pre1-15-g991cb0b or later. I have not tried though.

Re: Setting audio output device

Posted: 13 Jul 2013 21:13
by Hanley
Same problem with the latest 2.1.

I did notice that VLC takes the name of the device and does the following:

1. If it's longer than 32 characters, it chops off the 33rd+ characaters.
2. It adds "($1,$64)" on the end.

So "Speakers (Realtek High Definition)" becomes "Speakers (Realtek High Definiti ($1,$64)".

So as a workaround I'm taking the name of my application's currently active output device (which I get from JUCE), chopping off the 33rd+ characters, adding
($1,$64)" and sending that in as the argument for libvlc_audio_output_device_set. It works on my system, and I'll know soon enough if that's going to work or not on other users' computers, but out of curiosity do you foresee any obvious problems with that method?

Re: Setting audio output device

Posted: 14 Jul 2013 14:08
by Rémi Denis-Courmont
I cannot reproduce the problem; it works fine here now. Patch welcome.