style: improve code quality
This commit is contained in:
@@ -60,24 +60,24 @@ pub fn tick(self: *Self, comptime kind: Tick) void {
|
||||
}
|
||||
|
||||
/// NR30, NR31, NR32
|
||||
pub fn setSoundCnt(self: *Self, value: u32) void {
|
||||
self.setSoundCntL(@truncate(u8, value));
|
||||
self.setSoundCntH(@truncate(u16, value >> 16));
|
||||
pub fn setSound3Cnt(self: *Self, value: u32) void {
|
||||
self.setSound3CntL(@truncate(u8, value));
|
||||
self.setSound3CntH(@truncate(u16, value >> 16));
|
||||
}
|
||||
|
||||
/// NR30
|
||||
pub fn setSoundCntL(self: *Self, value: u8) void {
|
||||
pub fn setSound3CntL(self: *Self, value: u8) void {
|
||||
self.select.raw = value;
|
||||
if (!self.select.enabled.read()) self.enabled = false;
|
||||
}
|
||||
|
||||
/// NR31, NR32
|
||||
pub fn getSoundCntH(self: *const Self) u16 {
|
||||
pub fn sound3CntH(self: *const Self) u16 {
|
||||
return @as(u16, self.length & 0xE0) << 8;
|
||||
}
|
||||
|
||||
/// NR31, NR32
|
||||
pub fn setSoundCntH(self: *Self, value: u16) void {
|
||||
pub fn setSound3CntH(self: *Self, value: u16) void {
|
||||
self.setNr31(@truncate(u8, value));
|
||||
self.vol.raw = (@truncate(u8, value >> 8));
|
||||
}
|
||||
@@ -89,7 +89,7 @@ pub fn setNr31(self: *Self, len: u8) void {
|
||||
}
|
||||
|
||||
/// NR33, NR34
|
||||
pub fn setSoundCntX(self: *Self, fs: *const FrameSequencer, value: u16) void {
|
||||
pub fn setSound3CntX(self: *Self, fs: *const FrameSequencer, value: u16) void {
|
||||
self.setNr33(@truncate(u8, value));
|
||||
self.setNr34(fs, @truncate(u8, value >> 8));
|
||||
}
|
||||
|
Reference in New Issue
Block a user