Skip to content
Snippets Groups Projects
Verified Commit 12e7ce50 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

feat: support for variable audio speed

parent 8b902ffd
No related branches found
No related tags found
No related merge requests found
Pipeline #2478 failed
......@@ -548,6 +548,7 @@ export class GameboyEmulator extends EmulatorBase implements Emulator {
set frequency(value: number) {
value = Math.max(value, 0);
this.logicFrequency = value;
this.gameBoy?.set_clock_freq(value);
this.trigger("frequency", value);
}
......
......@@ -312,9 +312,10 @@ impl Apu {
self.audio_buffer.push_back(self.output());
}
// @TODO the CPU clock is hardcoded here, we must handle situations
// where there's some kind of overclock, and for that to happen the
// current CPU clock must be propagated here
// calculates the rate at which a new audio sample should be
// created based on the (base/CPU) clock frequency and the
// sampling rate, this is basically the amount of APU clock
// calls that should be performed until an audio sample is created
self.output_timer += (self.clock_freq as f32 / self.sampling_rate as f32) as i16;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment