style: code refactoring
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const io = @import("../bus/io.zig");
|
||||
const util = @import("../../util.zig");
|
||||
|
||||
const Scheduler = @import("../scheduler.zig").Scheduler;
|
||||
const FrameSequencer = @import("../apu.zig").FrameSequencer;
|
||||
@@ -123,7 +124,7 @@ pub fn setNr44(self: *Self, fs: *const FrameSequencer, byte: u8) void {
|
||||
self.enabled = self.isDacEnabled();
|
||||
}
|
||||
|
||||
self.lfsr.updateLength(fs, self, new);
|
||||
util.audio.length.ch4.update(self, fs, new);
|
||||
self.cnt = new;
|
||||
}
|
||||
|
||||
@@ -135,10 +136,6 @@ pub fn channelTimerOverflow(self: *Self, late: u64) void {
|
||||
self.sample = if (self.enabled) self.lfsr.sample() * @as(i8, self.env_dev.vol) else 0;
|
||||
}
|
||||
|
||||
pub fn amplitude(self: *const Self) i16 {
|
||||
return @as(i16, self.sample);
|
||||
}
|
||||
|
||||
fn isDacEnabled(self: *const Self) bool {
|
||||
return self.envelope.raw & 0xF8 != 0x00;
|
||||
}
|
||||
|
Reference in New Issue
Block a user