gb::APU class

Emulate Gameboy sound functions.

Contents

Public types

enum (anonymous) { CHANNEL_COUNT = 2, SAMPLE_RATE = 44100 }
using Ptr = std::unique_ptr<APU>
Smart pointer type.
using AudioSampleCallback = std::function<void(int16_t, int16_t)>
Callback used to provide audio to the host system.

Public functions

void update(uint8_t cycles)
auto getSound1Volume() -> uint8_t
auto getSound2Volume() -> uint8_t
auto getSound3Volume() -> uint8_t
auto getSound4Volume() -> uint8_t
void setAudioSampleCallback(AudioSampleCallback callback)

Enum documentation

enum gb::APU::(anonymous)

Enumerators
CHANNEL_COUNT

Number of audio channels the APU provides (Stereo sound: left, right)

SAMPLE_RATE

Audio sample rate.

Function documentation

void gb::APU::update(uint8_t cycles)

Update APU with the elasped cycles. For use by the CPU

uint8_t gb::APU::getSound1Volume()

Get Sound 1 output

uint8_t gb::APU::getSound2Volume()

Get Sound 2 output

uint8_t gb::APU::getSound3Volume()

Get Sound 3 output

uint8_t gb::APU::getSound4Volume()

Get Sound 4 output

void gb::APU::setAudioSampleCallback(AudioSampleCallback callback)

Set the host callback