Struct APU::apu_pulse

Nested Relationships

This struct is a nested type of Class APU.

Struct Documentation

struct apu_pulse

Public Functions

apu_pulse(bool useTwosComplement)
void setupSweep(uint8_t value)
void clockSweep()
void updateTargetPeriod()
void reset()
void clock()
uint8_t output()
float oscOutput()

Public Members

const uint8_t sequences[4] = {0x40, 0x60, 0x78, 0x9F}

Duty Cycle Sequences This array contains sequencer output waveforms: 0: 0100 0000 (12.5 %) 1: 0110 0000 (25 %) 2: 0111 1000 (50 %) 3: 1001 1111 (25 % negated)

const double sequencesOsc[4] = {0.125, 0.25, 0.5, 0.75}
uint8_t sequencerPos = 0

Current position in the sequence (value 0-7). The position is updated when the timer goes from 0 to t (underflows).

uint16_t timer = 0

11-bit timer current value.

uint16_t timerPeriod = 0

Timer reset value.

uint8_t dutyCycle = 0

Current duty cycle (sequences array 2-bit index).

apu_envelope envelope

Volume envelope.

apu_lengthCounter lengthCounter

Length counter.

bool useTwosComplement = false

Sweep unit.

bool sweepReload = false
bool sweepEnabled = false
bool sweepNegate = false
uint8_t sweepShiftCount = 0
uint8_t sweepPeriod = 0
uint8_t sweepCounter = 0
uint16_t targetPeriod = 0
double phaseIndex = 0

Oscillator index in the generated pulse.