private void calculateGain()
    {
        // If using linear attenuation, calculate the source's gain:
        if( attModel == SoundSystemConfig.ATTENUATION_LINEAR )
        {
            if( distanceFromListener <= 0 )
            {
                gain = 1.0f;
            }
            else if( distanceFromListener >= distOrRoll )
            {
                gain = 0.0f;
            }
            else
            {
                gain = 1.0f - (distanceFromListener / distOrRoll);
            }
            if( gain > 1.0f )
                gain = 1.0f;
            if( gain < 0.0f )
                gain = 0.0f;
        }
        else
        {
            gain = 1.0f;
        }
    }