Adds a viewboard (?)
This commit is contained in:
parent
940486c3fa
commit
670b1540c1
34
src/midi.rs
34
src/midi.rs
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in New Issue