diff --git a/src/core/emu.zig b/src/core/emu.zig index 8d3d9d7..a1c7259 100644 --- a/src/core/emu.zig +++ b/src/core/emu.zig @@ -105,7 +105,8 @@ pub fn runFrame(sched: *Scheduler, cpu: *Arm7tdmi) void { } fn audioSync(audio_sync: bool, stream: *SDL.SDL_AudioStream, is_buffer_full: *bool) void { - const sample_size = 2 * @sizeOf(u16); + comptime std.debug.assert(@import("../platform.zig").sample_format == SDL.AUDIO_F32); + const sample_size = 2 * @sizeOf(f32); const max_buf_size: c_int = 0x400; // Determine whether the APU is busy right at this moment diff --git a/src/platform.zig b/src/platform.zig index 9d8e989..f4325dd 100644 --- a/src/platform.zig +++ b/src/platform.zig @@ -202,7 +202,10 @@ pub const Gui = struct { SDL.SDLK_s => io.keyinput.shoulder_r.set(), SDL.SDLK_RETURN => io.keyinput.start.set(), SDL.SDLK_RSHIFT => io.keyinput.select.set(), - SDL.SDLK_i => log.err("Sample Count: {}", .{@intCast(u32, SDL.SDL_AudioStreamAvailable(cpu.bus.apu.stream)) / (2 * @sizeOf(u16))}), + SDL.SDLK_i => { + comptime std.debug.assert(sample_format == SDL.AUDIO_F32); + log.err("Sample Count: {}", .{@intCast(u32, SDL.SDL_AudioStreamAvailable(cpu.bus.apu.stream)) / (2 * @sizeOf(f32))}); + }, SDL.SDLK_j => log.err("Scheduler Capacity: {} | Scheduler Event Count: {}", .{ scheduler.queue.capacity(), scheduler.queue.count() }), SDL.SDLK_k => { // Dump IWRAM to file