diff options
| author | Tom Barrett <tom@tombarrett.xyz> | 2020-03-11 08:04:30 -0500 | 
|---|---|---|
| committer | Tom Barrett <tom@tombarrett.xyz> | 2020-03-11 08:04:30 -0500 | 
| commit | 66825cfceb599a854d41a9f05ed165213e17ead3 (patch) | |
| tree | aa7b0de1eebe7ecc3283b9b6b1f01175f72512b0 /src | |
| parent | 0e447ca05ff0c0fe91ec9a9a9091940680f967ba (diff) | |
reverses waveform and appends iterator directly
Diffstat (limited to 'src')
| -rw-r--r-- | src/audio.rs | 16 | ||||
| -rw-r--r-- | src/tom.rs | 2 | 
2 files changed, 10 insertions, 8 deletions
diff --git a/src/audio.rs b/src/audio.rs index ef92408..961c8ed 100644 --- a/src/audio.rs +++ b/src/audio.rs @@ -31,14 +31,14 @@ pub fn init() -> (StreamingSource, Vec<i16>) {          _track_length += samples.len() as f32 / sample_channels; -        samples = samples -            .into_iter() -            .enumerate() -            .filter(|(i, _)| i % 2 == 0) -            .map(|(_, s)| s) -            .collect(); - -        waveform.append(&mut samples); +        waveform.append( +            &mut samples +                .into_iter() +                .enumerate() +                .filter(|(i, _)| i % 2 == 0) +                .map(|(_, s)| s) +                .collect(), +        );      }      (stream, waveform) @@ -141,6 +141,8 @@ impl Tom {              });          } +        self.wave.reverse(); +          self.last_x += constants::SAMPLE_RATE / 60;      }  }  | 
