Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 09 Aug 2016 23:14:50 +0000
From:      bugzilla-noreply@freebsd.org
To:        gnome@FreeBSD.org
Subject:   [Bug 211684] audio/pulseaudio: Respect hw.snd.default_unit
Message-ID:  <bug-211684-6497-ycTjKWgkrW@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-211684-6497@https.bugs.freebsd.org/bugzilla/>
References:  <bug-211684-6497@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D211684

--- Comment #1 from lightside <lightside@gmx.com> ---
Created attachment 173479
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D173479&action=
=3Dedit
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 val=
ues
(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 =3D open("/dev/dsp", O_RDWR, 0);
        oss_audioinfo ainfo;
        ainfo.dev =3D -1; // specify -1 to get default device

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

        if (result =3D=3D -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.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-211684-6497-ycTjKWgkrW>