|
@@ -23,17 +23,29 @@ fn collect_sounds (root: &str) -> Vec<Sound> {
|
|
|
}
|
|
|
fn main() {
|
|
|
env_logger::init();
|
|
|
+ let dev = rodio::default_output_device().unwrap();
|
|
|
+
|
|
|
let mut sounds = collect_sounds("media");
|
|
|
- let mut active_sound: usize = 0;
|
|
|
|
|
|
+ let mut timeline = Timeline::default();
|
|
|
+ // let mut track = Track::default();
|
|
|
+ // track.test();
|
|
|
+ // track.bar_mut(0).bpm = 1;
|
|
|
+ // track.bars[0].bpm = 1;
|
|
|
+ // let mut x = &mut track.bars[0];
|
|
|
+ // x.bpm = 1;
|
|
|
|
|
|
+ // dbg!(&track);
|
|
|
|
|
|
- let dev = rodio::default_output_device().unwrap();
|
|
|
+ // return;
|
|
|
+ let mut active_sound: usize = 0;
|
|
|
+ let mut active_track: usize = 0;
|
|
|
+ // let mut active_bar: usize = 0;
|
|
|
|
|
|
- let mut bar = Bar::default();
|
|
|
- bar.bpm = 160;
|
|
|
|
|
|
- let mut timeline = Timeline::default();
|
|
|
+ // let mut active_bar = Bar::default();
|
|
|
+ let mut active_bar = &mut timeline.tracks[0].bars[0];
|
|
|
+
|
|
|
|
|
|
let mut system = support_ogl::init(file!());
|
|
|
let s = system.imgui.style_mut();
|
|
@@ -58,7 +70,7 @@ fn main() {
|
|
|
ui.tree_node(&im_str!("{}", s.name)).build(|| {
|
|
|
// ui.same_line(0.0);
|
|
|
if ui.small_button(im_str!("add to bar")) {
|
|
|
- bar.sounds[active_sound] = Some(s.clone());
|
|
|
+ active_bar.sounds[active_sound] = Some(s.clone());
|
|
|
}
|
|
|
ui.same_line(0.0);
|
|
|
if ui.small_button(im_str!("play")) {
|
|
@@ -72,51 +84,50 @@ fn main() {
|
|
|
Window::new(im_str!("bar"))
|
|
|
.size([300.0, 100.0], Condition::FirstUseEver)
|
|
|
.build(ui, || {
|
|
|
- ui.text(im_str!("bars"));
|
|
|
- ui.same_line(0.0);
|
|
|
- ui.text(im_str!("snd {}", active_sound));
|
|
|
|
|
|
- for i in 0..bar.length() {
|
|
|
+ for i in 0..active_bar.length() {
|
|
|
ui.same_line(0.0);
|
|
|
|
|
|
let token = match active_sound == i {
|
|
|
true => ui.push_style_color(StyleColor::Button, [1.0, 0.0, 0.0, 1.0]),
|
|
|
false => ui.push_style_color(StyleColor::CheckMark, [0.0, 0.0, 0.0, 1.0])
|
|
|
};
|
|
|
-
|
|
|
if ui.small_button(&im_str!("{}", i)) {
|
|
|
active_sound = i as usize;
|
|
|
}
|
|
|
-
|
|
|
token.pop(ui);
|
|
|
|
|
|
}
|
|
|
if ui.small_button(&im_str!("extend")) {
|
|
|
- bar.extend(1);
|
|
|
+ active_bar.extend(1);
|
|
|
}
|
|
|
|
|
|
- if ui.small_button(&im_str!("dbg")) {
|
|
|
- dbg!(&bar);
|
|
|
- }
|
|
|
+
|
|
|
if ui.small_button(&im_str!("ply")) {
|
|
|
- bar.play(&dev);
|
|
|
+ active_bar.play(&dev);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
Window::new(im_str!("sound"))
|
|
|
.size([300.0, 100.0], Condition::FirstUseEver)
|
|
|
.build(ui, || {
|
|
|
- let snd = &bar.sounds[active_sound];
|
|
|
+ let snd = &active_bar.sounds[active_sound];
|
|
|
if let Some(s) = snd{
|
|
|
ui.text(im_str!("name {}", s.name));
|
|
|
ui.text(im_str!("roll {}", s.roll));
|
|
|
ui.text(im_str!("volume {}", s.volume));
|
|
|
ui.text(im_str!("rate {}", s.rate));
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
});
|
|
|
|
|
|
+ Window::new(im_str!("tracks"))
|
|
|
+ .size([300.0, 100.0], Condition::FirstUseEver)
|
|
|
+ .build(ui, || {
|
|
|
+
|
|
|
+ if ui.small_button(&im_str!("add")) {
|
|
|
+ active_bar.play(&dev);
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
|
|
|
});
|