-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad26e7e
commit f8d5dce
Showing
11 changed files
with
34 additions
and
43 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
mod envelope; | ||
mod length_counter; | ||
mod sequencer; | ||
mod sweep; | ||
mod timer; | ||
|
||
pub use envelope::Envelope; | ||
pub use length_counter::LengthCounter; | ||
pub use sequencer::Sequencer; | ||
pub use sweep::Sweep; | ||
pub use timer::Timer; | ||
|
||
pub trait Channel { | ||
fn write_register(&mut self, address: u16, value: u8); | ||
fn raw_sample(&self) -> u8; | ||
fn is_active(&self) -> bool; | ||
fn is_mute(&self) -> bool; | ||
fn set_enabled(&mut self, value: bool); | ||
|
||
fn get_sample(&self) -> f32 { | ||
match self.is_mute() { | ||
true => 0.0, | ||
false => self.raw_sample() as f32, | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,9 @@ | ||
mod common; | ||
mod noise; | ||
mod pulse; | ||
mod triangle; | ||
|
||
pub use common::Channel; | ||
pub use noise::Noise; | ||
pub use pulse::Pulse; | ||
pub use triangle::Triangle; | ||
|
||
pub trait Channel { | ||
fn write_register(&mut self, address: u16, value: u8); | ||
fn raw_sample(&self) -> u8; | ||
fn is_active(&self) -> bool; | ||
fn is_mute(&self) -> bool; | ||
fn set_enabled(&mut self, value: bool); | ||
|
||
fn get_sample(&self) -> f32 { | ||
match self.is_mute() { | ||
true => 0.0, | ||
false => self.raw_sample() as f32, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters