move Phrase::process_in logic to Track::process

This commit is contained in:
🪞👃🪞 2024-07-04 18:24:08 +03:00
parent 4b909ffdc3
commit 163ecaaed6
6 changed files with 107 additions and 105 deletions

View file

@ -21,10 +21,18 @@ pub fn all_notes_off (output: &mut MIDIChunk) {
}
}
pub fn parse_midi_input (input: MidiIter) -> Box<dyn Iterator<Item=(usize, LiveEvent, &[u8])> + '_> {
Box::new(input.map(|RawMidi { time, bytes }|(
time as usize,
LiveEvent::parse(bytes).unwrap(),
bytes
)))
}
/// Write to JACK port from output buffer (containing notes from sequence and/or monitor)
pub fn write_output (writer: &mut ::jack::MidiWriter, output: &mut MIDIChunk, frames: usize) {
pub fn write_midi_output (writer: &mut ::jack::MidiWriter, output: &MIDIChunk, frames: usize) {
for time in 0..frames {
if let Some(Some(frame)) = output.get_mut(time ) {
if let Some(Some(frame)) = output.get(time) {
for event in frame.iter() {
writer.write(&::jack::RawMidi { time: time as u32, bytes: &event })
.expect(&format!("{event:?}"));