mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
before applying balance/fade check it actually makes sense
This commit is contained in:
parent
f9696c0e7f
commit
554c818d21
2 changed files with 26 additions and 7 deletions
|
|
@ -467,6 +467,9 @@ float pa_cvolume_get_balance(const pa_cvolume *v, const pa_channel_map *map) {
|
|||
pa_assert(map);
|
||||
pa_assert(map->channels == v->channels);
|
||||
|
||||
if (!pa_channel_map_can_balance(map))
|
||||
return 0.0f;
|
||||
|
||||
get_avg_lr(map, v, &left, &right);
|
||||
|
||||
if (left == right)
|
||||
|
|
@ -497,6 +500,9 @@ pa_cvolume* pa_cvolume_set_balance(pa_cvolume *v, const pa_channel_map *map, flo
|
|||
pa_assert(new_balance >= -1.0f);
|
||||
pa_assert(new_balance <= 1.0f);
|
||||
|
||||
if (!pa_channel_map_can_balance(map))
|
||||
return v;
|
||||
|
||||
get_avg_lr(map, v, &left, &right);
|
||||
|
||||
m = PA_MAX(left, right);
|
||||
|
|
@ -584,6 +590,9 @@ float pa_cvolume_get_fade(const pa_cvolume *v, const pa_channel_map *map) {
|
|||
pa_assert(map);
|
||||
pa_assert(map->channels == v->channels);
|
||||
|
||||
if (!pa_channel_map_can_fade(map))
|
||||
return 0.0f;
|
||||
|
||||
get_avg_fr(map, v, &front, &rear);
|
||||
|
||||
if (front == rear)
|
||||
|
|
@ -605,6 +614,9 @@ pa_cvolume* pa_cvolume_set_fade(pa_cvolume *v, const pa_channel_map *map, float
|
|||
pa_assert(new_fade >= -1.0f);
|
||||
pa_assert(new_fade <= 1.0f);
|
||||
|
||||
if (!pa_channel_map_can_fade(map))
|
||||
return v;
|
||||
|
||||
get_avg_fr(map, v, &front, &rear);
|
||||
|
||||
m = PA_MAX(front, rear);
|
||||
|
|
|
|||
|
|
@ -236,7 +236,9 @@ int pa_cvolume_compatible(const pa_cvolume *v, const pa_sample_spec *ss) PA_GCC_
|
|||
|
||||
/** Calculate a 'balance' value for the specified volume with the
|
||||
* specified channel map. The return value will range from -1.0f
|
||||
* (left) to +1.0f (right) \since 0.9.15 */
|
||||
* (left) to +1.0f (right). If no balance value is applicable to this
|
||||
* channel map the return value will always be 0.0f. See
|
||||
* pa_channel_map_can_balance(). \since 0.9.15 */
|
||||
float pa_cvolume_get_balance(const pa_cvolume *v, const pa_channel_map *map) PA_GCC_PURE;
|
||||
|
||||
/** Adjust the 'balance' value for the specified volume with the
|
||||
|
|
@ -245,22 +247,27 @@ float pa_cvolume_get_balance(const pa_cvolume *v, const pa_channel_map *map) PA_
|
|||
* operation might not be reversible! Also, after this call
|
||||
* pa_cvolume_get_balance() is not guaranteed to actually return the
|
||||
* requested balance value (e.g. when the input volume was zero anyway for
|
||||
* all channels) \since 0.9.15 */
|
||||
* all channels). If no balance value is applicable to
|
||||
* this channel map the volume will not be modified. See
|
||||
* pa_channel_map_can_balance(). \since 0.9.15 */
|
||||
pa_cvolume* pa_cvolume_set_balance(pa_cvolume *v, const pa_channel_map *map, float new_balance);
|
||||
|
||||
/** Calculate a 'fade' value (i.e. 'balance' between front and rear)
|
||||
* for the specified volume with the specified channel map. The return
|
||||
* value will range from -1.0f (rear) to +1.0f (left) \since
|
||||
* 0.9.15 */
|
||||
* value will range from -1.0f (rear) to +1.0f (left). If no fade
|
||||
* value is applicable to this channel map the return value will
|
||||
* always be 0.0f. See pa_channel_map_can_fade(). \since 0.9.15 */
|
||||
float pa_cvolume_get_fade(const pa_cvolume *v, const pa_channel_map *map) PA_GCC_PURE;
|
||||
|
||||
/** Adjust the 'fade' value (i.e. 'balance' between front and rear)
|
||||
* for the specified volume with the specified channel map. v will be
|
||||
* modified in place and returned. The balance is a value between
|
||||
* -1.0f and +1.0f. This operation might not be reversible! Also,
|
||||
* after this call pa_cvolume_get_fade() is not guaranteed to
|
||||
* actually return the requested fade value (e.g. when the input volume
|
||||
* was zero anyway for all channels) \since 0.9.15 */
|
||||
* after this call pa_cvolume_get_fade() is not guaranteed to actually
|
||||
* return the requested fade value (e.g. when the input volume was
|
||||
* zero anyway for all channels). If no fade value is applicable to
|
||||
* this channel map the volume will not be modified. See
|
||||
* pa_channel_map_can_fade(). \since 0.9.15 */
|
||||
pa_cvolume* pa_cvolume_set_fade(pa_cvolume *v, const pa_channel_map *map, float new_fade);
|
||||
|
||||
/** Scale the passed pa_cvolume structure so that the maximum volume
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue