chore: improve code quality
This commit is contained in:
parent
3d82465b04
commit
1a8506c04f
19
src/sound.rs
19
src/sound.rs
|
@ -240,19 +240,6 @@ impl From<SoundDuty> for u8 {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<WavePattern> for u8 {
|
||||
fn from(pattern: WavePattern) -> Self {
|
||||
use WavePattern::*;
|
||||
|
||||
match pattern {
|
||||
OneEighth => 0b00,
|
||||
OneQuarter => 0b01,
|
||||
OneHalf => 0b10,
|
||||
ThreeQuarters => 0b11,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum WavePattern {
|
||||
OneEighth = 0, // 12.5% ( _-------_-------_------- )
|
||||
|
@ -267,6 +254,12 @@ impl Default for WavePattern {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<WavePattern> for u8 {
|
||||
fn from(pattern: WavePattern) -> Self {
|
||||
pattern as u8
|
||||
}
|
||||
}
|
||||
|
||||
impl From<u8> for WavePattern {
|
||||
fn from(byte: u8) -> Self {
|
||||
match byte {
|
||||
|
|
Loading…
Reference in New Issue