Package builder.resid.resid
Klasse WaveformGenerator
java.lang.Object
builder.resid.resid.WaveformGenerator
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. The noise
waveform is taken from intermediate bits of a 23 bit shift register. This
register is clocked by bit 19 of the accumulator.
Java port of the reSID 1.0 waveformgenerator by Dag Lem.
- Autor:
- Ken Händel, Dag Lem, Antti Lankila
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungprotected intCurrent and previous accumulator value.protected intCurrent and previous accumulator value.private final short[]private intprotected intprivate final short[][]private booleanprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprotected booleanprotected booleanThe control register bits.private short[]private intThe control register right-shifted 4 bits; used for output function table lookup.private int -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected voidclock()SID clocking - 1 cycle.private voidshortoutput(WaveformGenerator ringModulator) 12-bit waveform output.bytereadOSC(int ringAccumulator, int myAccumulator) Read OSC3 value (6581, not latched/delayed version)byteprotected bytereadOSC6581(WaveformGenerator ring_modulator) Read OSC3 value (6581, not latched/delayed version)protected bytereadOSC8580(WaveformGenerator ring_modulator) Read OSC3 value (8580, 1-clock latched version).protected voidreset()SID reset.private voidprivate voidprotected voidsetChipModel(ChipModel chipModel) Set nonlinearity parameter for imperfect analog DAC emulation. 1.0 means perfect 8580-like linearity, values between 0.95 - 0.97 are probably realistic 6581 nonlinearity values.protected voidsetWaveformModels(short[][] models) protected voidsynchronize(WaveformGenerator syncDest, WaveformGenerator syncSource) Synchronize oscillators.private voidprotected voidwriteCONTROL_REG(byte control) Register functions.protected voidwriteFREQ_HI(byte freq_hi) Register functions.protected voidwriteFREQ_LO(byte freq_lo) Register functions.protected voidwritePW_HI(byte pw_hi) Register functions.protected voidwritePW_LO(byte pw_lo) Register functions.
-
Felddetails
-
model_wave
private final short[][] model_wave -
dac
private final short[] dac -
accumulator
protected int accumulatorCurrent and previous accumulator value. -
accumulator_prev
protected int accumulator_prevCurrent and previous accumulator value. -
msb_rising
private boolean msb_rising -
freq
protected int freq -
pw
private int pw -
shift_register
private int shift_register -
shift_register_reset
private int shift_register_reset -
shift_pipeline
private int shift_pipeline -
ring_msb_mask
private int ring_msb_mask -
no_noise
private int no_noise -
noise_output
private int noise_output -
no_noise_or_noise_output
private int no_noise_or_noise_output -
no_pulse
private int no_pulse -
pulse_output
private int pulse_output -
waveform
private int waveformThe control register right-shifted 4 bits; used for output function table lookup. -
test
protected boolean testThe control register bits. Gate is handled by EnvelopeGenerator. -
sync
protected boolean sync -
floating_output_ttl
private int floating_output_ttl -
wave
private short[] wave -
waveform_output
private int waveform_output
-
-
Konstruktordetails
-
WaveformGenerator
protected WaveformGenerator()Constructor.
-
-
Methodendetails
-
setWaveformModels
protected void setWaveformModels(short[][] models) -
setChipModel
Set nonlinearity parameter for imperfect analog DAC emulation. 1.0 means perfect 8580-like linearity, values between 0.95 - 0.97 are probably realistic 6581 nonlinearity values.- Parameter:
chipModel- TheChipModelto use.
-
clock
protected void clock()SID clocking - 1 cycle. -
synchronize
Synchronize oscillators. This must be done after all the oscillators have been clock()'ed, so that they are in the same state.- Parameter:
syncDest- The oscillator I am syncingsyncSource- The oscillator syncing me.
-
clock_shift_register
private void clock_shift_register() -
write_shift_register
private void write_shift_register() -
reset_shift_register
private void reset_shift_register() -
set_noise_output
private void set_noise_output() -
output
12-bit waveform output.- Parameter:
ringModulator- The oscillator ring-modulating me.- Gibt zurück:
- output from waveformgenerator
-
readOSC
public byte readOSC(int ringAccumulator, int myAccumulator) Read OSC3 value (6581, not latched/delayed version)- Gibt zurück:
- OSC3 value
-
readOSC6581
Read OSC3 value (6581, not latched/delayed version)- Parameter:
ring_modulator- The ring modulating partner of this waveform- Gibt zurück:
- OSC3 value
-
readOSC8580
Read OSC3 value (8580, 1-clock latched version). Waveforms 0 and 8 and above are not appropriately delayed by 1 clock. It should not be noticeable for 0 and > 8, but noise is not correctly delayed.- Parameter:
ring_modulator- The ring modulating partner of this waveform- Gibt zurück:
- OSC3 value
-
readOSC
-
writeFREQ_LO
protected void writeFREQ_LO(byte freq_lo) Register functions.- Parameter:
freq_lo- low 8 bits of frequency
-
writeFREQ_HI
protected void writeFREQ_HI(byte freq_hi) Register functions.- Parameter:
freq_hi- high 8 bits of frequency
-
writePW_LO
protected void writePW_LO(byte pw_lo) Register functions. The original form was (acc >> 12) >= pw, where truth value is not affected by the contents of the low 12 bits. Therefore the lowest bits must be zero in the new formulation acc >= (pw << 12).- Parameter:
pw_lo- low 8 bits of pulse width
-
writePW_HI
protected void writePW_HI(byte pw_hi) Register functions.- Parameter:
pw_hi- high 8 bits of pulse width
-
writeCONTROL_REG
protected void writeCONTROL_REG(byte control) Register functions.- Parameter:
control- control register value
-
reset
protected void reset()SID reset.
-