Skip to content

GB_set_sample_rate

Lior Halphon edited this page Nov 30, 2024 · 4 revisions

Definition

void GB_set_sample_rate(GB_gameboy_t *gb, unsigned sample_rate);

void GB_set_sample_rate_by_clocks(GB_gameboy_t *gb, double cycles_per_sample);

unsigned GB_get_sample_rate(GB_gameboy_t *gb);

In apu.h

Description

GB_set_sample_rate and GB_set_sample_rate_by_clocks control the output sample rate of an emulator instance. GB_set_sample_rate sets the sample rate in Hz, and GB_set_sample_rate_by_clocks sets it by the number of APU ticks each sample should last. The APU normally ticks at 2MHz (2,097,152Hz) when emulating a non-Super Game Boy model without overclocking or underclocking.

GB_get_sample_rate will return the current sample rate in Hertz.

Thread Safety

GB_set_sample_rate must not be called if the instance is being run in another thread, but may be called from the current one (via a callback).

Notes

The default sample rate is 0, which disables audio rendering.

See Also

Clone this wiki locally