Example #1
0
        //friend class SID;



        // ----------------------------------------------------------------------------
        // Inline functions.
        // The following function is defined inline because it is called every
        // time a sample is calculated.
        // ----------------------------------------------------------------------------

        //#if RESID_INLINING || defined(RESID_VOICE_CC)

        // ----------------------------------------------------------------------------
        // Amplitude modulated waveform output (20 bits).
        // Ideal range [-2048*255, 2047*255].
        // ----------------------------------------------------------------------------

        // The output for a voice is produced by a multiplying DAC, where the
        // waveform output modulates the envelope output.
        //
        // As noted by Bob Yannes: "The 8-bit output of the Envelope Generator was then
        // sent to the Multiplying D/A converter to modulate the amplitude of the
        // selected Oscillator Waveform (to be technically accurate, actually the
        // waveform was modulating the output of the Envelope Generator, but the result
        // is the same)".
        //
        //          7   6   5   4   3   2   1   0   VGND
        //          |   |   |   |   |   |   |   |     |   Missing
        //         2R  2R  2R  2R  2R  2R  2R  2R    2R   termination
        //          |   |   |   |   |   |   |   |     |
        //          --R---R---R---R---R---R---R--   ---
        //          |          _____
        //        __|__     __|__   |
        //        -----     =====   |
        //        |   |     |   |   |
        // 12V ---     -----     ------- GND
        //               |
        //              vout
        //
        // Bit on:  wout (see figure in wave.h)
        // Bit off: 5V (VGND)
        //
        // As is the case with all MOS 6581 DACs, the termination to (virtual) ground
        // at bit 0 is missing. The MOS 8580 has correct termination.
        //

        public Int32 output()
        {
            // Multiply oscillator output with envelope output.
            return((wave.output() - wave_zero) * envelope.output());
        }