mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-01 22:58:47 -04:00
get rid of pa_alsa_volume_divide() since we have pa_sw_volume_divide() now
This commit is contained in:
parent
da4ad5ed01
commit
83b1d7a305
4 changed files with 2 additions and 28 deletions
|
|
@ -1109,27 +1109,3 @@ pa_rtpoll_item* pa_alsa_build_pollfd(snd_pcm_t *pcm, pa_rtpoll *rtpoll) {
|
|||
|
||||
return item;
|
||||
}
|
||||
|
||||
pa_cvolume *pa_alsa_volume_divide(pa_cvolume *r, const pa_cvolume *t) {
|
||||
unsigned i;
|
||||
|
||||
pa_assert(r);
|
||||
pa_assert(t);
|
||||
pa_assert(r->channels == t->channels);
|
||||
|
||||
for (i = 0; i < r->channels; i++) {
|
||||
double a, b, c;
|
||||
|
||||
a = pa_sw_volume_to_linear(r->values[i]); /* the hw volume */
|
||||
b = pa_sw_volume_to_linear(t->values[i]); /* the intended volume */
|
||||
|
||||
if (a <= 0)
|
||||
c = 0;
|
||||
else
|
||||
c = b / a;
|
||||
|
||||
r->values[i] = pa_sw_volume_from_linear(c);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,6 +92,4 @@ int pa_alsa_recover_from_poll(snd_pcm_t *pcm, int revents);
|
|||
|
||||
pa_rtpoll_item* pa_alsa_build_pollfd(snd_pcm_t *pcm, pa_rtpoll *rtpoll);
|
||||
|
||||
pa_cvolume *pa_alsa_volume_divide(pa_cvolume *r, const pa_cvolume *t);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -936,7 +936,7 @@ static int sink_set_volume_cb(pa_sink *s) {
|
|||
|
||||
/* Match exactly what the user requested by software */
|
||||
|
||||
pa_alsa_volume_divide(&r, &s->volume);
|
||||
pa_sw_cvolume_divide(&r, &s->volume, &r);
|
||||
pa_sink_set_soft_volume(s, &r);
|
||||
|
||||
pa_log_debug("Requested volume: %s", pa_cvolume_snprint(t, sizeof(t), &s->volume));
|
||||
|
|
|
|||
|
|
@ -881,7 +881,7 @@ static int source_set_volume_cb(pa_source *s) {
|
|||
|
||||
/* Match exactly what the user requested by software */
|
||||
|
||||
pa_alsa_volume_divide(&r, &s->volume);
|
||||
pa_sw_cvolume_divide(&r, &s->volume, &r);
|
||||
pa_source_set_soft_volume(s, &r);
|
||||
|
||||
pa_log_debug("Requested volume: %s", pa_cvolume_snprint(t, sizeof(t), &s->volume));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue