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

pa_volume_t pa_sw_volume_divide ( pa_volume_t  a,
pa_volume_t  b 
)

Divide two volume specifications, return the result. This uses PA_VOLUME_NORM as neutral element of division. This is only valid for software volumes! If a division by zero is tried the result will be 0.

Since:
0.9.13

Definition at line 212 of file volume.c.

References PA_VOLUME_INVALID, PA_VOLUME_MUTED, PA_VOLUME_NORM, and pa_volume_t.

                                                              {

    pa_return_val_if_fail(a != PA_VOLUME_INVALID, PA_VOLUME_INVALID);
    pa_return_val_if_fail(b != PA_VOLUME_INVALID, PA_VOLUME_INVALID);

    if (b <= PA_VOLUME_MUTED)
        return 0;

    return (pa_volume_t) (((uint64_t) a * (uint64_t) PA_VOLUME_NORM + (uint64_t) b / 2ULL) / (uint64_t) b);
}


Generated by  Doxygen 1.6.0   Back to index