Browse Source

make clean

woelper 4 years ago
parent
commit
de8f20ee05
2 changed files with 2 additions and 22 deletions
  1. 2 3
      src/base.rs
  2. 0 19
      src/main.rs

+ 2 - 3
src/base.rs

@@ -5,15 +5,14 @@ use std::time::Duration;
 use std::fs::File;
 
 #[derive(Clone)]
-pub struct Sound<'a> {
+pub struct Sound {
     pub location: PathBuf,
-    pub dec: rodio::Decoder<std::io::BufReader<std::fs::File>>,
 }
 
 impl Sound {
     pub fn play(&self, device: &rodio::Device) {
         if let Ok(file) = std::fs::File::open(&self.location) {
-            let dec = rodio::Decoder::new(BufReader::new(file)).unwrap();
+            // let dec = rodio::Decoder::new(BufReader::new(file)).unwrap();
             let reader = BufReader::new(file);
             let d = device.clone();
             let sink = rodio::play_once(d, reader).unwrap().detach();

+ 0 - 19
src/main.rs

@@ -7,28 +7,11 @@ extern crate rodio;
 mod base;
 use base::*;
 
-fn play(location: &PathBuf) {
-    let dev = rodio::default_output_device().unwrap();
-
-    let file = std::fs::File::open(&location).unwrap();
-    let sink = rodio::play_once(&dev, BufReader::new(file)).unwrap();
-    // let source = rodio::Decoder::new(BufReader::new(file)).unwrap();
-    // rodio::play_raw(&dev, source);
-
-    thread::sleep(Duration::from_millis(1500));
-
-}
 
 fn main() {
-    // let device = rodio::default_output_device().unwrap();
-
-
-
 
     let dev = rodio::default_output_device().unwrap();
 
-
-
     let hat = Sound{location: PathBuf::from("media/c64sid-ch1.wav")};
     let snare = Sound{location: PathBuf::from("media/c64sid-snare12.wav")};
     let kick = Sound{location: PathBuf::from("media/c64sid-kick5.wav")};
@@ -49,6 +32,4 @@ fn main() {
     bar.play(&dev);
 
 
-    //thread::sleep(Duration::from_millis(1500));
-
 }