static long convert_gain(long gain)
{
    /* Don't allow unreasonably low or high gain changes.
     * Our math code can't handle it properly anyway. :) */
    gain = MAX(gain, FP_MIN);
    gain = MIN(gain, FP_MAX);

    return fp_factor(gain, FP_BITS) << (24 - FP_BITS);
}
static long convert_gain(long gain)
{
    /* Don't allow unreasonably low or high gain changes.
     * Our math code can't handle it properly anyway. :)
     */
    if (gain < (-48 * FP_ONE))
    {
        gain = -48 * FP_ONE;
    }

    if (gain > (17 * FP_ONE))
    {
        gain = 17 * FP_ONE;
    }

    gain = fp_factor(gain, FP_BITS) << (24 - FP_BITS);

    return gain;
}