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

double pa_sw_volume_to_linear ( pa_volume_t  v  ) 

Convert a volume to a linear factor. This is only valid for software volumes!

Definition at line 267 of file volume.c.

References PA_VOLUME_INVALID, PA_VOLUME_MUTED, and PA_VOLUME_NORM.

                                             {
    double f;

    pa_return_val_if_fail(v != PA_VOLUME_INVALID, 0.0);

    if (v <= PA_VOLUME_MUTED)
        return 0.0;

    if (v == PA_VOLUME_NORM)
        return 1.0;

    f = ((double) v / PA_VOLUME_NORM);

    return f*f*f;
}


Generated by  Doxygen 1.6.0   Back to index