Logo Search packages:      
Sourcecode: pulseaudio version File versions  Download package

float pa_cvolume_get_fade ( const pa_cvolume v,
const pa_channel_map map 

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). If no fade value is applicable to this channel map the return value will always be 0.0f. See pa_channel_map_can_fade().


Definition at line 758 of file volume.c.

References pa_volume_t.

    pa_volume_t front, rear;


    pa_return_val_if_fail(pa_cvolume_compatible_with_channel_map(v, map), 0.0f);

    if (!pa_channel_map_can_fade(map))
        return 0.0f;

    get_avg_fr(map, v, &front, &rear);

    if (front == rear)
        return 0.0f;

    if (rear > front)
        return -1.0f + ((float) front / (float) rear);
        return 1.0f - ((float) rear / (float) front);

Generated by  Doxygen 1.6.0   Back to index