[Bug 211684] audio/pulseaudio: Respect hw.snd.default_unit

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Aug 9 23:14:50 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211684

--- Comment #1 from lightside <lightside at gmx.com> ---
Created attachment 173479
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=173479&action=edit
Proposed patch (since 419133 revision) for v8.0

Hello Tobias Kortkamp.

I investigated this issue and corrected the approach by PulseAudio's
developer(s), which recognizes hw.snd.default_unit value, by parsing and
comparing the last "default" string for /dev/sndstat output.
I attached patch for current audio/pulseaudio 8.0 version. If it works for you,
then I can propose it (with slight modifications) for 9.0 version update in bug
210548.

The other possible approach is to use SNDCTL_AUDIOINFO to get necessary values
(e.g. mixer_dev):
-8<--
// cc snd_default_unit.c -o snd_default_unit.o && ./snd_default_unit.o
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/soundcard.h>
#include <stdio.h>

int main() {
        int mixerfd = open("/dev/dsp", O_RDWR, 0);
        oss_audioinfo ainfo;
        ainfo.dev = -1; // specify -1 to get default device

        int result = ioctl(mixerfd, SNDCTL_AUDIOINFO, &ainfo);
        close(mixerfd);

        if (result == -1 ) {
                printf("error getting device (%s) info.\n", ainfo.name);
                return 1;
        }

        printf("default device name: %s\ndefault device node name: %s\n\
default device number: %d\ndefault device mixer number: %d\n",\
                ainfo.name, ainfo.devnode, ainfo.dev, ainfo.mixer_dev);

        return 0;
}
-->8-

The idea about how to get default sound device for above approach is from
changes in bug 209742, proposed by Shane Ambler.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.


More information about the freebsd-gnome mailing list