mirror of
https://github.com/dredozubov/polyrhythmix.git
synced 2024-11-22 11:57:43 +00:00
Midi meta events WIP: Mark track as Drumkit
This commit is contained in:
parent
9e49156acb
commit
c52f1e3ff4
1 changed files with 11 additions and 4 deletions
|
@ -871,17 +871,23 @@ fn create_tracks<'a>(
|
||||||
let event_grid = event_grid_tick.to_delta();
|
let event_grid = event_grid_tick.to_delta();
|
||||||
let mut drums = Vec::new();
|
let mut drums = Vec::new();
|
||||||
// let midi_tempo = MidiTempo::from_tempo(Tempo(130)).0;
|
// let midi_tempo = MidiTempo::from_tempo(Tempo(130)).0;
|
||||||
// drums.push(TrackEvent { delta: u28::from(0), kind: TrackEventKind::Meta(MetaMessage::Tempo(midi_tempo)) });
|
drums.push(TrackEvent { delta: 0.into(), kind: TrackEventKind::Midi { channel: 9.into(), message: MidiMessage::ProgramChange { program: 127.into() } } } );
|
||||||
// drums.push(TrackEvent { delta: u28::from(0), kind: TrackEventKind::Meta(MetaMessage::TimeSignature(4, 4, MIDI_CLOCKS_PER_CLICK.clone(), 8))});
|
// drums.push(TrackEvent { delta: 0.into(), kind: TrackEventKind::Meta(MetaMessage::TrackNumber(1.into())) });
|
||||||
|
drums.push(TrackEvent { delta: 0.into(), kind: TrackEventKind::Meta(MetaMessage::TrackName(b"Drumkit")) });
|
||||||
|
// drums.push(TrackEvent { delta: 0.into(), kind: TrackEventKind::Meta(MetaMessage::InstrumentName(b"Drum kit")) });
|
||||||
|
drums.push(TrackEvent { delta: 0.into(), kind: TrackEventKind::Meta(MetaMessage::MidiChannel(10.into())) });
|
||||||
|
drums.push(TrackEvent { delta: 0.into(), kind: TrackEventKind::Meta(MetaMessage::MidiPort(10.into())) });
|
||||||
|
// drums.push(TrackEvent { delta: 0.into(), kind: TrackEventKind::Meta(MetaMessage::Tempo(midi_tempo)) });
|
||||||
|
// drums.push(TrackEvent { delta: 0.into(), kind: TrackEventKind::Meta(MetaMessage::TimeSignature(4, 4, MIDI_CLOCKS_PER_CLICK.clone(), 8))});
|
||||||
for event in event_grid.events {
|
for event in event_grid.events {
|
||||||
let midi_message = match event.event_type {
|
let midi_message = match event.event_type {
|
||||||
NoteOn(part) => MidiMessage::NoteOn {
|
NoteOn(part) => MidiMessage::NoteOn {
|
||||||
key: part.to_midi_key(),
|
key: part.to_midi_key(),
|
||||||
vel: u7::from(120),
|
vel: 127.into(),
|
||||||
},
|
},
|
||||||
NoteOff(part) => MidiMessage::NoteOff {
|
NoteOff(part) => MidiMessage::NoteOff {
|
||||||
key: part.to_midi_key(),
|
key: part.to_midi_key(),
|
||||||
vel: u7::from(0),
|
vel: 127.into(),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
drums.push(TrackEvent {
|
drums.push(TrackEvent {
|
||||||
|
@ -892,6 +898,7 @@ fn create_tracks<'a>(
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
drums.push(TrackEvent { delta: drums.last().unwrap().delta, kind: TrackEventKind::Meta(MetaMessage::EndOfTrack) });
|
||||||
|
|
||||||
vec![drums]
|
vec![drums]
|
||||||
}
|
}
|
Loading…
Reference in a new issue