Compare commits
2 Commits
9a2b7a48c0
...
3fe577abb9
Author | SHA1 | Date |
---|---|---|
Rekai Nyangadzayi Musuka | 3fe577abb9 | |
Rekai Nyangadzayi Musuka | e20120569a |
|
@ -1 +1 @@
|
|||
Subproject commit a1b01ffeab452790790034b8a0e97aa30bbeb800
|
||||
Subproject commit dbc6b8e54ad753b0605feaeecc8e79dba3572ed3
|
|
@ -1 +1 @@
|
|||
Subproject commit 016b8bcf98e50ae9408f6a9606bbec5a9bc6f677
|
||||
Subproject commit 3cc4bb6dfba885de2c2d6f7c5ee6bc68a5be02bf
|
|
@ -58,10 +58,7 @@ pub fn load(allocator: Allocator, file_path: []const u8) !void {
|
|||
const contents = try config_file.readToEndAlloc(allocator, try config_file.getEndPos());
|
||||
defer allocator.free(contents);
|
||||
|
||||
var parser = try toml.parseFile(allocator, file_path);
|
||||
defer parser.deinit();
|
||||
|
||||
const table = try parser.parse();
|
||||
const table = try toml.parseContents(allocator, contents, null);
|
||||
defer table.deinit();
|
||||
|
||||
// TODO: Report unknown config options
|
||||
|
|
|
@ -94,9 +94,10 @@ pub fn sound1CntL(self: *const Self) u8 {
|
|||
pub fn setSound1CntL(self: *Self, value: u8) void {
|
||||
const new = io.Sweep{ .raw = value };
|
||||
|
||||
if (!new.direction.read()) {
|
||||
// If at least one (1) sweep calculation has been made with
|
||||
// the negate bit set (since last trigger), disable the channel
|
||||
if (self.sweep.direction.read() and !new.direction.read()) {
|
||||
// Sweep Negate bit has been cleared
|
||||
// If At least 1 Sweep Calculation has been made since
|
||||
// the last trigger, the channel is immediately disabled
|
||||
|
||||
if (self.sweep_dev.calc_performed) self.enabled = false;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ pub fn tick(self: *Self, ch1: *ToneSweep) void {
|
|||
if (self.timer == 0) {
|
||||
const period = ch1.sweep.period.read();
|
||||
self.timer = if (period == 0) 8 else period;
|
||||
if (!self.calc_performed) self.calc_performed = true;
|
||||
|
||||
if (self.enabled and period != 0) {
|
||||
const new_freq = self.calculate(ch1.sweep, &ch1.enabled);
|
||||
|
@ -51,10 +52,7 @@ pub fn calculate(self: *Self, sweep: io.Sweep, ch_enable: *bool) u12 {
|
|||
const shadow_shifted = shadow >> sweep.shift.read();
|
||||
const decrease = sweep.direction.read();
|
||||
|
||||
const freq = if (decrease) blk: {
|
||||
self.calc_performed = true;
|
||||
break :blk shadow - shadow_shifted;
|
||||
} else shadow + shadow_shifted;
|
||||
const freq = if (decrease) shadow - shadow_shifted else shadow + shadow_shifted;
|
||||
if (freq > 0x7FF) ch_enable.* = false;
|
||||
|
||||
return freq;
|
||||
|
|
Loading…
Reference in New Issue