**************
 *             __________               __   ___.
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
 *                     \/            \/     \/    \/            \/
 * $Id$
 *
 * Copyright (C) 2006-2007 Adam Gashlin (hcs)
 * Copyright (C) 2004-2007 Shay Green (blargg)
 * Copyright (C) 2002 Brad Martin
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
 *
 ****************************************************************************/
static inline int apply_gen_envx( struct voice_t* voice, int output )
{
    return (output * voice->envx) >> 11;
}

static inline int apply_gen_volume( struct voice_t* voice, int output,
                                    int* amp_0, int* amp_1 )
{
    *amp_0 = voice->volume [0] * output;
    *amp_1 = voice->volume [1] * output;
    return output;
}

static inline int apply_gen_amp( struct voice_t* voice, int output,
                                 int* amp_0, int* amp_1)
{
    output = apply_gen_envx( voice, output );
    output = apply_gen_volume( voice, output, amp_0, amp_1 );
    return output;
}

#if !SPC_NOINTERP

#ifndef SPC_GAUSSIAN_FAST_INTERP
static inline int gaussian_fast_interp( int16_t const* samples,
                                        int32_t position,
                                        int16_t const* fwd,
                                        int16_t const* rev )
{
    samples += position >> 12;
    return (fwd [0] * samples [0] +
            fwd [1] * samples [1] +
            rev [1] * samples [2] +
           