|
@@ -63,7 +63,6 @@ fn main() {
|
|
|
style.window_rounding = 1.5;
|
|
|
style.anti_aliased_lines = false;
|
|
|
style.anti_aliased_fill = false;
|
|
|
-
|
|
|
|
|
|
const PURPLE: [f32; 4] = [0.07, 0.05, 0.27, 1.00];
|
|
|
system.main_loop(move |_, ui| {
|
|
@@ -222,37 +221,50 @@ fn main() {
|
|
|
Window::new(im_str!("sound"))
|
|
|
.size([300.0, 100.0], Condition::FirstUseEver)
|
|
|
.build(ui, || {
|
|
|
- // let snd = &active_bar.sounds[pattern_col];
|
|
|
+ // check if active sounds is some
|
|
|
if let Some(s) = &mut active_sound {
|
|
|
ui.text(im_str!("name {}", s.name));
|
|
|
- // let _ = DragFloat::new()
|
|
|
+
|
|
|
ui.drag_float(im_str!("volume"), &mut s.volume)
|
|
|
.min(-1.0)
|
|
|
.max(2.0)
|
|
|
.speed(0.01)
|
|
|
.build();
|
|
|
+
|
|
|
ui.drag_float(im_str!("speed"), &mut s.speed)
|
|
|
.min(0.0)
|
|
|
.max(2.0)
|
|
|
.speed(0.01)
|
|
|
- .build();
|
|
|
+ .build();
|
|
|
+
|
|
|
ui.drag_int(im_str!("roll"), &mut s.roll)
|
|
|
.max(32)
|
|
|
.speed(0.05)
|
|
|
.build();
|
|
|
-
|
|
|
+
|
|
|
+ if ui.small_button(&im_str!("adjust speed to pattern")) {
|
|
|
+ if let Some(sd) = s.duration() {
|
|
|
+ let ad = active_pattern.duration();
|
|
|
+ dbg!(&sd.as_millis());
|
|
|
+ let scale = sd.as_millis() as f32 / ad as f32;
|
|
|
+ dbg!(&scale);
|
|
|
+ s.speed = scale;
|
|
|
+ }
|
|
|
+ // dbg!(&l);
|
|
|
+ // let bpm = active_pattern.bpm;
|
|
|
+ }
|
|
|
ui.checkbox(im_str!("reverse"), &mut s.reverse);
|
|
|
|
|
|
- if ui.small_button(&im_str!("play")) {
|
|
|
- s.play(&dev);
|
|
|
- }
|
|
|
+ if ui.small_button(&im_str!("play")) {s.play(&dev)}
|
|
|
|
|
|
}
|
|
|
- if ui.small_button(&im_str!("clear")) {
|
|
|
- active_sound = None;
|
|
|
- }
|
|
|
+
|
|
|
+ if ui.small_button(&im_str!("clear")) {active_sound = None}
|
|
|
});
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
Window::new(im_str!("tracks"))
|
|
|
.size([300.0, 100.0], Condition::FirstUseEver)
|
|
|
.build(ui, || {
|
|
@@ -261,26 +273,27 @@ fn main() {
|
|
|
active_pattern.play(&dev);
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
- Window::new(im_str!("settings"))
|
|
|
- .size([300.0, 100.0], Condition::FirstUseEver)
|
|
|
- .build(ui, || {
|
|
|
-
|
|
|
- let mut scale = 1.0;
|
|
|
- if ui.drag_float(im_str!("speed"), &mut scale)
|
|
|
- .min(0.0)
|
|
|
- .max(3.0)
|
|
|
- .speed(0.01)
|
|
|
- .build() {
|
|
|
- // let s = system.imgui.style_mut();
|
|
|
-
|
|
|
- // s.scale_all_sizes(scale);
|
|
|
|
|
|
- }
|
|
|
|
|
|
- });
|
|
|
|
|
|
|
|
|
+
|
|
|
+ // Window::new(im_str!("settings"))
|
|
|
+ // .size([300.0, 100.0], Condition::FirstUseEver)
|
|
|
+ // .build(ui, || {
|
|
|
+
|
|
|
+ // let mut scale = 1.0;
|
|
|
+ // if ui.drag_float(im_str!("size"), &mut scale)
|
|
|
+ // .min(0.0)
|
|
|
+ // .max(3.0)
|
|
|
+ // .speed(0.01)
|
|
|
+ // .build() {
|
|
|
+ // // let s = system.imgui.style_mut();
|
|
|
+ // // s.scale_all_sizes(scale);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+
|
|
|
+ // Discard color token
|
|
|
colors.pop(&ui);
|
|
|
|
|
|
});
|