use std::io::BufReader;
use std::path::PathBuf;

use std::thread;
use std::time::Duration;
extern crate rodio;
mod base;
use base::*;
use rodio::Source;

use imgui::*;
mod support;



   

fn main() {
    let dev = rodio::default_output_device().unwrap();


    let hat = Sound::new("media/c64sid-ch1.wav").unwrap();
    let snare = Sound::new("media/c64sid-snare12.wav").unwrap();
    let kick = Sound::new("media/c64sid-kick5.wav").unwrap();

    let mut bar = Bar::default();
    bar.bpm = 160;
    
    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(200));

    let system = support::init(file!());


    system.main_loop(|_, ui| {
        Window::new(im_str!("yo"))
            .size([300.0, 100.0], Condition::FirstUseEver)
            .build(ui, || {
                ui.text(im_str!("Hello world!"));
                ui.text(im_str!("こんにちは世界！"));
                ui.text(im_str!("This...is...imgui-rs!"));
                ui.separator();
                let mouse_pos = ui.io().mouse_pos;
                ui.text(format!(
                    "Mouse Position: ({:.1},{:.1})",
                    mouse_pos[0], mouse_pos[1]
                ));
            });
    });

    
    

}