Setting audio output device

This forum is about all development around libVLC.
Hanley
Blank Cone
Blank Cone
Posts: 22
Joined: 30 May 2013 04:56

Setting audio output device

Postby Hanley » 13 Jul 2013 08:10

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?

Rémi Denis-Courmont
Developer
Developer
Posts: 15267
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Setting audio output device

Postby Rémi Denis-Courmont » 13 Jul 2013 10:04

Should be fixed now.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Hanley
Blank Cone
Blank Cone
Posts: 22
Joined: 30 May 2013 04:56

Re: Setting audio output device

Postby Hanley » 13 Jul 2013 16:00

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?

Rémi Denis-Courmont
Developer
Developer
Posts: 15267
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Setting audio output device

Postby Rémi Denis-Courmont » 13 Jul 2013 18:45

Should work with version 2.1.0-pre1-15-g991cb0b or later. I have not tried though.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Hanley
Blank Cone
Blank Cone
Posts: 22
Joined: 30 May 2013 04:56

Re: Setting audio output device

Postby Hanley » 13 Jul 2013 21:13

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?

Rémi Denis-Courmont
Developer
Developer
Posts: 15267
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Setting audio output device

Postby Rémi Denis-Courmont » 14 Jul 2013 14:08

I cannot reproduce the problem; it works fine here now. Patch welcome.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 5 guests