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 TypFeldBeschreibung(Package privat) intCurrent and previous accumulator value.(Package privat) intCurrent and previous accumulator value.private final short[]private int(Package privat) intprivate final short[][]private booleanprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate int(Package privat) boolean(Package privat) 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 TypMethodeBeschreibung(Package privat) 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)byte(Package privat) bytereadOSC6581(WaveformGenerator ring_modulator) Read OSC3 value (6581, not latched/delayed version)(Package privat) bytereadOSC8580(WaveformGenerator ring_modulator) Read OSC3 value (8580, 1-clock latched version).(Package privat) voidreset()SID reset.private voidprivate void(Package privat) voidsetChipModel(ChipModel chipModel) Set a 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.(Package privat) voidsetWaveformModels(short[][] models) (Package privat) voidsynchronize(WaveformGenerator syncDest, WaveformGenerator syncSource) Synchronize oscillators.private void(Package privat) voidwriteCONTROL_REG(byte control) Register functions.(Package privat) voidwriteFREQ_HI(byte freq_hi) Register functions.(Package privat) voidwriteFREQ_LO(byte freq_lo) Register functions.(Package privat) voidwritePW_HI(byte pw_hi) Register functions.(Package privat) voidwritePW_LO(byte pw_lo) Register functions.
-
Felddetails
-
model_wave
private final short[][] model_wave -
dac
private final short[] dac -
accumulator
int accumulatorCurrent and previous accumulator value. -
accumulator_prev
int accumulator_prevCurrent and previous accumulator value. -
msb_rising
private boolean msb_rising -
freq
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
boolean testThe control register bits. Gate is handled by EnvelopeGenerator. -
sync
boolean sync -
floating_output_ttl
private int floating_output_ttl -
wave
private short[] wave -
waveform_output
private int waveform_output
-
-
Konstruktordetails
-
WaveformGenerator
WaveformGenerator()Constructor.
-
-
Methodendetails
-
setWaveformModels
void setWaveformModels(short[][] models) -
setChipModel
Set a 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
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
void writeFREQ_LO(byte freq_lo) Register functions.- Parameter:
freq_lo- low 8 bits of frequency
-
writeFREQ_HI
void writeFREQ_HI(byte freq_hi) Register functions.- Parameter:
freq_hi- high 8 bits of frequency
-
writePW_LO
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
void writePW_HI(byte pw_hi) Register functions.- Parameter:
pw_hi- high 8 bits of pulse width
-
writeCONTROL_REG
void writeCONTROL_REG(byte control) Register functions.- Parameter:
control- control register value
-
reset
void reset()SID reset.
-