mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2026-01-04 11:08:50 -05:00
Implement base_volume for ALSA sinks/sources
This commit is contained in:
parent
6130c5c11b
commit
fb4c111d18
2 changed files with 47 additions and 32 deletions
|
|
@ -1506,6 +1506,7 @@ int pa__init(pa_module*m) {
|
|||
suitable = TRUE;
|
||||
}
|
||||
|
||||
if (suitable) {
|
||||
if (snd_mixer_selem_get_playback_dB_range(u->mixer_elem, &u->hw_dB_min, &u->hw_dB_max) < 0)
|
||||
pa_log_info("Mixer doesn't support dB information.");
|
||||
else {
|
||||
|
|
@ -1519,16 +1520,22 @@ int pa__init(pa_module*m) {
|
|||
else {
|
||||
pa_log_info("Volume ranges from %0.2f dB to %0.2f dB.", (double) u->hw_dB_min/100.0, (double) u->hw_dB_max/100.0);
|
||||
u->hw_dB_supported = TRUE;
|
||||
|
||||
if (u->hw_dB_max > 0) {
|
||||
u->sink->base_volume = pa_sw_volume_from_dB(- (double) u->hw_dB_max/100.0);
|
||||
pa_log_info("Fixing base volume to %0.2f dB", pa_sw_volume_to_dB(u->sink->base_volume));
|
||||
} else
|
||||
pa_log_info("No particular base volume set, fixing to 0 dB");
|
||||
}
|
||||
}
|
||||
|
||||
if (suitable &&
|
||||
!u->hw_dB_supported &&
|
||||
if (!u->hw_dB_supported &&
|
||||
u->hw_volume_max - u->hw_volume_min < 3) {
|
||||
|
||||
pa_log_info("Device doesn't do dB volume and has less than 4 volume levels. Falling back to software volume control.");
|
||||
suitable = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (suitable) {
|
||||
u->mixer_seperate_channels = pa_alsa_calc_mixer_map(u->mixer_elem, &map, u->mixer_map, TRUE) >= 0;
|
||||
|
|
|
|||
|
|
@ -1328,6 +1328,7 @@ int pa__init(pa_module*m) {
|
|||
suitable = TRUE;
|
||||
}
|
||||
|
||||
if (suitable) {
|
||||
if (snd_mixer_selem_get_capture_dB_range(u->mixer_elem, &u->hw_dB_min, &u->hw_dB_max) < 0)
|
||||
pa_log_info("Mixer doesn't support dB information.");
|
||||
else {
|
||||
|
|
@ -1341,16 +1342,23 @@ int pa__init(pa_module*m) {
|
|||
else {
|
||||
pa_log_info("Volume ranges from %0.2f dB to %0.2f dB.", (double) u->hw_dB_min/100.0, (double) u->hw_dB_max/100.0);
|
||||
u->hw_dB_supported = TRUE;
|
||||
|
||||
if (u->hw_dB_max > 0) {
|
||||
u->source->base_volume = pa_sw_volume_from_dB(- (double) u->hw_dB_max/100.0);
|
||||
pa_log_info("Fixing base volume to %0.2f dB", pa_sw_volume_to_dB(u->source->base_volume));
|
||||
} else
|
||||
pa_log_info("No particular base volume set, fixing to 0 dB");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (suitable &&
|
||||
!u->hw_dB_supported &&
|
||||
if (!u->hw_dB_supported &&
|
||||
u->hw_volume_max - u->hw_volume_min < 3) {
|
||||
|
||||
pa_log_info("Device has less than 4 volume levels. Falling back to software volume control.");
|
||||
suitable = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (suitable) {
|
||||
u->mixer_seperate_channels = pa_alsa_calc_mixer_map(u->mixer_elem, &map, u->mixer_map, FALSE) >= 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue