|
libsidplayfp 2.3.1
|
#include <WaveformGenerator.h>
Public Member Functions | |
| void | setWaveformModels (matrix_t *models) |
| void | setDAC (float *dac) |
| void | setModel (bool is6581) |
| 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 |
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).
|
inline |
Constructor.
| RESID_INLINE void reSIDfp::WaveformGenerator::clock | ( | ) |
SID clocking.
| RESID_INLINE float reSIDfp::WaveformGenerator::output | ( | const WaveformGenerator * | ringModulator | ) |
12-bit waveform output as an analogue float value.
| ringModulator | The oscillator ring-modulating current one. |
|
inline |
Read accumulator value.
|
inline |
Read freq value.
|
inline |
Read OSC3 value.
|
inline |
Read sync value.
|
inline |
Read test value.
| void reSIDfp::WaveformGenerator::reset | ( | ) |
SID reset.
|
inline |
Set the analog DAC emulation: 8580 is perfectly linear while 6581 is nonlinear. Must be called before any operation.
| dac |
|
inline |
Set the chip model. Must be called before any operation.
| is6581 | true if MOS6581, false if CSG8580 |
| 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.
| syncDest | The oscillator that will be synced |
| syncSource | The sync source oscillator |
| void reSIDfp::WaveformGenerator::writeCONTROL_REG | ( | unsigned char | control | ) |
Write CONTROL REGISTER register.
| control | control register value |
|
inline |
Write FREQ HI register.
| freq_hi | high 8 bits of frequency |
|
inline |
Write FREQ LO register.
| freq_lo | low 8 bits of frequency |
|
inline |
Write PW HI register.
| pw_hi | high 8 bits of pulse width |
|
inline |
Write PW LO register.
| pw_lo | low 8 bits of pulse width |