quantum_entangler/midi/
time.rs

1use std::sync::Mutex;
2  
3pub struct MidiBuffer {
4  pub timestamp: u64,
5  pub message: Vec<u8>,
6}
7
8pub struct NoteMap {
9  pub duration: u64,
10  pub timing: Vec<usize>,
11}
12  
13lazy_static! {
14  pub static ref MIDI_BUFFER: Mutex<Vec<MidiBuffer>> = Mutex::new(vec![]);
15}
16
17lazy_static! {
18  pub static ref NOTE_MAP: Mutex<Vec<NoteMap>> = Mutex::new(vec![]);
19}
20
21/*
22  Figure out how to map notes
23*/
24impl NoteMap {
25  // fn map(&self){
26  //   let buffer = MIDI_BUFFER.lock().unwrap();
27  //   for (index, item) in buffer.iter().enumerate() {
28  //     if index % 2 == 0 && index + 2 < buffer.len() - 1 {
29  //       let duration = buffer[index + 2].timestamp - item.timestamp;
30  //     }
31  //   }
32  // }
33}