Comment 2 for bug 672420

Revision history for this message
Raymond (superquad-vortex2) wrote :

Using 4 controls : Volume , Balance, Fade and Bass to control six or eight channels is not easy especially when gnome-media cannot save/restore the settings of this four controls

This bug is in pa_cvolume_set_balance() since left and right will be zero when you set the volume to 0%

 655 get_avg_lr(map, v, &left, &right);
 656
 657 m = PA_MAX(left, right);
 658
 659 if (new_balance <= 0) {
 660 nright = (new_balance + 1.0f) * m;
 661 nleft = m;
 662 } else {
 663 nleft = (1.0f - new_balance) * m;
 664 nright = m;
 665 }
 666
 667 for (c = 0; c < map->channels; c++) {
 668 if (on_left(map->map[c])) {
 669 if (left == 0)
 670 v->values[c] = nleft;
 671 else
 672 v->values[c] = (pa_volume_t) PA_CLAMP_VOLUME(((uint64_t) v->values[c] * (uint64_t) nleft) / (uint64_t) left);
 673 } else if (on_right(map->map[c])) {
 674 if (right == 0)
 675 v->values[c] = nright;
 676 else
 677 v->values[c] = (pa_volume_t) PA_CLAMP_VOLUME(((uint64_t) v->values[c] * (uint64_t) nright) / (uint64_t) right);
 678 }
 679 }
 680

pa_cvolume_get_balance() return 0 when

623 if (left == right)
624 return 0.0f;