Page MenuHomeFreeBSD

audio/pulseaudio: improve OSS support
Needs ReviewPublic

Authored by makc on Thu, Oct 1, 10:55 AM.
Tags
None
Referenced Files
F174497451: D60197.diff
Sat, Oct 3, 5:32 PM
F174438113: D60197.id.diff
Sat, Oct 3, 5:31 AM
Unknown Object (File)
Fri, Oct 2, 1:55 PM
Unknown Object (File)
Fri, Oct 2, 1:06 PM
Unknown Object (File)
Thu, Oct 1, 3:45 PM

Details

Reviewers
None
Group Reviewers
desktop
multimedia
Summary
  1. Set vol or pcm, but not both. Changing both channels makes volume feedback non-linear.
  2. Set / read monitor channel.

Diff Detail

Repository
R11 FreeBSD ports repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

makc requested review of this revision.Thu, Oct 1, 10:55 AM
makc created this revision.
arrowd added inline comments.
audio/pulseaudio/files/patch-src_modules_oss_module-oss.c
104

That doesn't seem right. If we have both SOUND_MASK_VOLUME and SOUND_MASK_PCM requests, we should handle both.

What's the root problem this patch tries to solve?

audio/pulseaudio/files/patch-src_modules_oss_module-oss.c
104

Pulseaudio does not allow to change pcm and vol for oss mixer independently. When changing volume in plasma-pa applet or using pactl set-sink-volume it set both vol and pcm channels to the same value. As a result real sound volume drops dramatically when you move volume slider away from 100%. Usually you want to keep pcm constant and change real volume via vol channel. KMix worked this way before we switched to Plasma-pa by default.

For the context: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/blob/master/src/modules/oss/module-oss.c?ref_type=heads&plain=1#L840

static void sink_set_volume(pa_sink *s) {

    struct userdata *u;

    pa_assert_se(u = s->userdata);

    pa_assert(u->mixer_devmask & (SOUND_MASK_VOLUME|SOUND_MASK_PCM));

    if (u->mixer_devmask & SOUND_MASK_VOLUME)
        (void) pa_oss_set_volume(u->mixer_fd, SOUND_MIXER_WRITE_VOLUME, &s->sample_spec, &s->real_volume);

    if (u->mixer_devmask & SOUND_MASK_PCM)
        (void) pa_oss_set_volume(u->mixer_fd, SOUND_MIXER_WRITE_PCM, &s->sample_spec, &s->real_volume);
}

Please upstream this first, the last few commits to this file there were by us.

audio/pulseaudio/files/patch-src_modules_oss_module-oss.c
104

Are you sure it is really a PulseAudio API problem?

I do see the problem - if I move the volume scrollbar in Plasma System settings and then run mixer from the console, both vol and pcm get changed indeed. But it might be Plasma problem, not a PulseAudio one.

Do you have a reproducer that does not involve Plasma clients?

audio/pulseaudio/files/patch-src_modules_oss_module-oss.c
104

I just reproduced this on cinnamon, which uses the API directly. PulseAudio's own pavucontrol should exhibit the same.

@christos Maybe you have an idea what's the correct fix here?

audio/pulseaudio/files/patch-src_modules_oss_module-oss.c
104

Do you have a reproducer that does not involve Plasma clients?

Sure, you can use pactl utility from pulseaudio package.

At least after this patch sink_set_volume behaves consistently with sink_get_volume.
sink_get_volume attempts to read vol channel first and returns its values, otherwise it tries pcm channel.

I wonder whether we need to read/set pcm at all in these functions. Are there mixers which have pcm channel but not vol?