Adds a viewboard (?)

This commit is contained in:
Dandaedre 2024-12-07 11:40:54 -06:00
parent 940486c3fa
commit 670b1540c1
2 changed files with 19 additions and 20 deletions

View File

@ -60,24 +60,22 @@ pub fn connect_loop_with_callback(
// Handle MIDI messages here
let (command, note, _value) = (message[0], message[1], message[2]);
//println!("Received MIDI message: {:?}", message);
match (command, note) {
(144, 3..=4) => {
for (id, f) in calls.iter() {
if note == *id {
f();
}
let mut list = vec![];
if note == 3 {
list.push([command, 3, 2]);
list.push([command, 4, 3]);
} else {
list.push([command, 3, 1]);
list.push([command, 4, 4]);
}
for n in list.iter() {
conn_clone.lock().unwrap().send(n).unwrap();
conn_clone.lock().unwrap().send(n).unwrap();
}
if let (144, 3..=4) = (command, note) {
for (id, f) in calls.iter() {
if note == *id {
f();
}
let mut list = vec![];
if note == 3 {
list.push([command, 3, 2]);
list.push([command, 4, 3]);
} else {
list.push([command, 3, 1]);
list.push([command, 4, 4]);
}
for n in list.iter() {
conn_clone.lock().unwrap().send(n).unwrap();
conn_clone.lock().unwrap().send(n).unwrap();
}
}
}

View File

@ -29,7 +29,6 @@ struct RecvCommander<'a> {
impl RecvCommander<'_> {
fn new(output_interface: &mut Arc<Mutex<MidiOutputConnection>>) -> RecvCommander {
// Assert all vectors are of the same size
assert_eq!(70, 70);
RecvCommander {
midi_address: output_interface,
list_notes: (0..89).collect(),
@ -73,5 +72,7 @@ fn main() {
send_note_on(&mut output_interface.lock().unwrap(), 2, 1);
// sleep(Duration::from_millis(1000));
board.update();
loop {}
loop {
sleep(Duration::from_millis(500));
}
}