|
@@ -1,17 +1,54 @@
|
|
|
-extern crate rodio;
|
|
|
-
|
|
|
use std::io::BufReader;
|
|
|
+use std::path::PathBuf;
|
|
|
+
|
|
|
use std::thread;
|
|
|
use std::time::Duration;
|
|
|
+extern crate rodio;
|
|
|
+mod base;
|
|
|
+use base::*;
|
|
|
|
|
|
-fn main() {
|
|
|
- let device = rodio::default_output_device().unwrap();
|
|
|
+fn play(location: &PathBuf) {
|
|
|
+ let dev = rodio::default_output_device().unwrap();
|
|
|
|
|
|
- let file = std::fs::File::open("media/c64sid-ch1.wav").unwrap();
|
|
|
- let beep1 = rodio::play_once(&device, BufReader::new(file)).unwrap();
|
|
|
- beep1.set_volume(0.2);
|
|
|
- println!("Started beep1");
|
|
|
+ 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")};
|
|
|
+
|
|
|
+ let mut bar = Bar::default();
|
|
|
+ bar.repeat = 2;
|
|
|
+ bar.sounds = vec!(
|
|
|
+ kick.clone(),
|
|
|
+ hat.clone(),
|
|
|
+ snare.clone(),
|
|
|
+ hat.clone(),
|
|
|
+ kick.clone(),
|
|
|
+ hat.clone(),
|
|
|
+ snare.clone(),
|
|
|
+ hat.clone(),
|
|
|
+ );
|
|
|
+
|
|
|
+ bar.play(&dev);
|
|
|
+
|
|
|
+
|
|
|
+ //thread::sleep(Duration::from_millis(1500));
|
|
|
+
|
|
|
}
|