apu
This commit is contained in:
parent
d0896707bd
commit
bbeb38475c
|
@ -16,7 +16,7 @@ pub struct Apu {
|
|||
|
||||
struct Square {
|
||||
sample: u16,
|
||||
duty_cycle: usize,
|
||||
duty_cycle: u8,
|
||||
length_counter_halt: bool, // (this bit is also the envelope's loop flag)
|
||||
constant_volume_flag: bool, // (0: use volume from envelope; 1: use constant volume)
|
||||
timer: usize,
|
||||
|
@ -49,6 +49,12 @@ struct DMC {
|
|||
sample: u16,
|
||||
}
|
||||
|
||||
struct Envelope {
|
||||
start_flag: bool,
|
||||
divider: usize,
|
||||
delay_level_counter: usize,
|
||||
}
|
||||
|
||||
impl Apu {
|
||||
fn new() -> Self {
|
||||
let square_table = (0..31).map(|x| 95.52/(8128.0 / x as f32) + 100.0).collect();
|
||||
|
|
|
@ -17,7 +17,8 @@ impl super::Square {
|
|||
}
|
||||
|
||||
pub fn duty(&mut self, value: u8) {
|
||||
|
||||
self.duty_cycle = value >> 6;
|
||||
self.length_counter_halt =
|
||||
}
|
||||
|
||||
pub fn sweep(&mut self, value: u8) {
|
||||
|
|
Loading…
Reference in New Issue