File tree Expand file tree Collapse file tree 2 files changed +17
-9
lines changed
Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change 99
1010lint :
1111 cargo fmt -- --check --color always
12- cargo clippy --all-targets --all-features -- -D warnings
12+ cargo clippy --all-targets -- -D warnings
1313
1414build-wasm :
1515 cargo build --release --target wasm32-unknown-unknown
Original file line number Diff line number Diff line change @@ -66,15 +66,17 @@ impl VolumeEnvelope {
6666 }
6767
6868 fn step ( & mut self ) {
69- if self . delay > 1 {
70- self . delay -= 1 ;
71- } else if self . delay == 1 {
72- self . delay = self . period ;
73- if self . goes_up && self . volume < 15 {
74- self . volume += 1 ;
75- } else if !self . goes_up && self . volume > 0 {
76- self . volume -= 1 ;
69+ match self . delay {
70+ 2 .. => self . delay -= 1 ,
71+ 1 => {
72+ self . delay = self . period ;
73+ if self . goes_up && self . volume < 15 {
74+ self . volume += 1 ;
75+ } else if !self . goes_up && self . volume > 0 {
76+ self . volume -= 1 ;
77+ }
7778 }
79+ _ => { }
7880 }
7981 }
8082}
@@ -463,6 +465,12 @@ pub struct Sound {
463465 output_period : u32 ,
464466}
465467
468+ impl Default for Sound {
469+ fn default ( ) -> Self {
470+ Self :: new ( )
471+ }
472+ }
473+
466474impl Sound {
467475 pub fn new ( ) -> Sound {
468476 let mut ch1_blip = BlipBuf :: new ( OUTPUT_SAMPLE_COUNT_U32 * 2 ) ;
You can’t perform that action at this time.
0 commit comments