Class APU

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

class APU : public Component

NES APU emulator. APU is normally a part of 2A03 but for the sake of modularity it is separated in this project.

Available ports: signal “IRQ”, which periodically sends an interrupt request to the CPU if enabled. Available connectors:

  • data “CPU”, which is meant to be used by the CPU to control the APU via registers,

  • signal “CLK”, which is used to clock the APU, standard clock rate is 1.789773 MHz / 2 (half of CPU’s clock rate).

Public Functions

APU()
~APU() override = default
virtual void init() override

Reset APU to the initial state.

void clock()

APU master clock. Emulates the APU Frame Counter (Sequencer). APU is clocked on every other CPU cycle (2 CPU cycles == 1 APU cycle).

float output()

Raw audio output.

Returns

Approx audio level from 0.0 to 1.0.

virtual std::vector<EmulatorWindow> getGUIs() override

Get GUI windows: metadata and rendering functions.

Note

For Component developer: If the component have a debugger or other GUI, return an arbitrary count of windows, they will be rendered on a load of a system which contains the component.

Returns

A vector of windows to be rendered.

virtual SoundSampleSources getSoundSampleSources() override

Get audio sources: a list of functions to request a stereo audio sample (frame).

Note

For Component developer: If the component has any sound outputs, return a functions to get samples from them here. You can return any number of outputs, they will be mixed seamlessly.