Skip to content

bug: cubic or linear volume unhandled #34

@LurkAndLoiter

Description

@LurkAndLoiter

Currently always displays cubic curve of volume which is a non default behavior for Pipewire. (it's from old alsamixer here)

volumes.at(i) = x;

example currently volume 60% displays as 45%
Display percentage using the cubic curve (≈ perceptual/dB feel):
display_% = pow(linear, 3.0f) × 100
0.60³ ≈ 0.216, display as ~45%

wireplumber/.../modules/module-mixer-api.cL375

static inline gdouble
volume_from_linear (float vol, gint scale)
{
  if (vol <= 0.0f)
    return 0.0;
  else if (scale == SCALE_CUBIC)
    return cbrt(vol);
  else
    return vol;
}

wireplumber/.../modules/module-mixer-api.cL386

static inline float
volume_to_linear (gdouble vol, gint scale)
{
  if (vol <= 0.0f)
    return 0.0;
  else if (scale == SCALE_CUBIC)
    return vol * vol * vol;
  else
    return vol;
}

I'd try to do a PR but I can't compile C++ to save my life. <3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions