private static double readFromInBuffer(ResampleContext rCtx, int i) {
        if (rCtx.srcFloat) {
            return rCtx.inBuffer.getDouble(i);
        } else {
            switch (rCtx.bps) {
                case 1:
                    return NORMALIZE_FACTOR_8 * (double) (((short) rCtx.inBuffer.get(i) & 0xff) - 128);
                case 2:
                    return NORMALIZE_FACTOR_16 * rCtx.inBuffer.getShort(i);
                case 3:
                    if (rCtx.srcByteOrder == ByteOrder.LITTLE_ENDIAN) {
                        return NORMALIZE_FACTOR_24 * (double) (((int) rCtx.inBuffer.getShort(i) & 0xffff) | ((int) rCtx.inBuffer.get(i + 2) << 24) >> 8);
                    } else {
                        return NORMALIZE_FACTOR_24 * (double) ((((int) rCtx.inBuffer.get(i) << 24) >> 8) | ((int) rCtx.inBuffer.getShort(i + 1) & 0xffff));
                    }
                case 4:
                    return NORMALIZE_FACTOR_32 * (double) rCtx.inBuffer.getInt(i);
            }
        }
        return 0;
    }