style: code refactoring

This commit is contained in:
2022-10-10 20:31:12 -03:00
parent dc7cad9691
commit bcacac64df
9 changed files with 65 additions and 89 deletions

View File

@@ -1,5 +1,5 @@
// const std = @import("std");
const io = @import("../bus/io.zig");
const util = @import("../../util.zig");
const Scheduler = @import("../scheduler.zig").Scheduler;
const FrameSequencer = @import("../apu.zig").FrameSequencer;
@@ -79,10 +79,6 @@ pub fn channelTimerOverflow(self: *Self, late: u64) void {
self.sample = if (self.enabled) self.square.sample(self.duty) * @as(i8, self.env_dev.vol) else 0;
}
pub fn amplitude(self: *const Self) i16 {
return @as(i16, self.sample);
}
/// NR10, NR11, NR12
pub fn setSoundCnt(self: *Self, value: u32) void {
self.setSoundCntL(@truncate(u8, value));
@@ -181,7 +177,7 @@ pub fn setNr14(self: *Self, fs: *const FrameSequencer, byte: u8) void {
self.enabled = self.isDacEnabled();
}
self.square.updateLength(Self, fs, self, new);
util.audio.length.update(Self, self, fs, new);
self.freq = new;
}