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

pa_volume_t pa_sw_volume_multiply ( pa_volume_t  a,
pa_volume_t  b 
)

Multiply two volume specifications, return the result. This uses PA_VOLUME_NORM as neutral element of multiplication. This is only valid for software volumes!

Definition at line 202 of file volume.c.

References PA_VOLUME_INVALID, 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);

    /* cbrt((a/PA_VOLUME_NORM)^3*(b/PA_VOLUME_NORM)^3)*PA_VOLUME_NORM = a*b/PA_VOLUME_NORM */

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

Generated by  Doxygen 1.6.0   Back to index