libsidplayfp  2.0.2
Public Member Functions | List of all members
reSIDfp::WaveformGenerator Class Reference

#include <WaveformGenerator.h>

Public Member Functions

void setWaveformModels (matrix_t *models)
 
void setChipModel (ChipModel chipModel)
 
void clock ()
 
void synchronize (WaveformGenerator *syncDest, const WaveformGenerator *syncSource) const
 
 WaveformGenerator ()
 
void writeFREQ_LO (unsigned char freq_lo)
 
void writeFREQ_HI (unsigned char freq_hi)
 
void writePW_LO (unsigned char pw_lo)
 
void writePW_HI (unsigned char pw_hi)
 
void writeCONTROL_REG (unsigned char control)
 
void reset ()
 
float output (const WaveformGenerator *ringModulator)
 
unsigned char readOSC () const
 
unsigned int readAccumulator () const
 
unsigned int readFreq () const
 
bool readTest () const
 
bool readSync () const
 

Detailed Description

A 24 bit accumulator is the basis for waveform generation. FREQ is added to the lower 16 bits of the accumulator each cycle. The accumulator is set to zero when TEST is set, and starts counting when TEST is cleared.

Waveforms are generated as follows:

Operation: Calculate EOR result, shift register, set bit 0 = result.

               reset    -------------------------------------------
                 |     |                                           |
          test--OR-->EOR<--                                        |
                 |         |                                       |
                 2 2 2 1 1 1 1 1 1 1 1 1 1                         |
Register bits:   2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 <---
                     |   |       |     |   |       |     |   |
Waveform bits:       1   1       9     8   7       6     5   4
                     1   0

The low 4 waveform bits are zero (grounded).

Constructor & Destructor Documentation

◆ WaveformGenerator()

reSIDfp::WaveformGenerator::WaveformGenerator ( )
inline

Constructor.

Member Function Documentation

◆ clock()

RESID_INLINE void reSIDfp::WaveformGenerator::clock ( )

SID clocking - 1 cycle.

◆ output()

RESID_INLINE float reSIDfp::WaveformGenerator::output ( const WaveformGenerator ringModulator)

12-bit waveform output as an analogue float value.

Parameters
ringModulatorThe oscillator ring-modulating current one.
Returns
output the waveform generator output

◆ readAccumulator()

unsigned int reSIDfp::WaveformGenerator::readAccumulator ( ) const
inline

Read accumulator value.

◆ readFreq()

unsigned int reSIDfp::WaveformGenerator::readFreq ( ) const
inline

Read freq value.

◆ readOSC()

unsigned char reSIDfp::WaveformGenerator::readOSC ( ) const
inline

Read OSC3 value.

◆ readSync()

bool reSIDfp::WaveformGenerator::readSync ( ) const
inline

Read sync value.

◆ readTest()

bool reSIDfp::WaveformGenerator::readTest ( ) const
inline

Read test value.

◆ reset()

void reSIDfp::WaveformGenerator::reset ( )

SID reset.

◆ setChipModel()

void reSIDfp::WaveformGenerator::setChipModel ( ChipModel  chipModel)

Set the chip model. This determines the type of the analog DAC emulation: 8580 is perfectly linear while 6581 is nonlinear.

Parameters
chipModel

◆ synchronize()

void reSIDfp::WaveformGenerator::synchronize ( WaveformGenerator syncDest,
const WaveformGenerator syncSource 
) const

Synchronize oscillators. This must be done after all the oscillators have been clock()'ed, so that they are in the same state.

Parameters
syncDestThe oscillator I am syncing
syncSourceThe oscillator syncing me.

◆ writeCONTROL_REG()

void reSIDfp::WaveformGenerator::writeCONTROL_REG ( unsigned char  control)

Write CONTROL REGISTER register.

Parameters
controlcontrol register value

◆ writeFREQ_HI()

void reSIDfp::WaveformGenerator::writeFREQ_HI ( unsigned char  freq_hi)
inline

Write FREQ HI register.

Parameters
freq_hihigh 8 bits of frequency

◆ writeFREQ_LO()

void reSIDfp::WaveformGenerator::writeFREQ_LO ( unsigned char  freq_lo)
inline

Write FREQ LO register.

Parameters
freq_lolow 8 bits of frequency

◆ writePW_HI()

void reSIDfp::WaveformGenerator::writePW_HI ( unsigned char  pw_hi)
inline

Write PW HI register.

Parameters
pw_hihigh 8 bits of pulse width

◆ writePW_LO()

void reSIDfp::WaveformGenerator::writePW_LO ( unsigned char  pw_lo)
inline

Write PW LO register.

Parameters
pw_lolow 8 bits of pulse width

The documentation for this class was generated from the following files: