mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 20:56:43 +01:00
don't reallocate note buffer each callback
This commit is contained in:
parent
bc9be689a8
commit
bb8ab496c0
3 changed files with 29 additions and 22 deletions
|
|
@ -134,7 +134,9 @@ pub struct PhrasePlayer {
|
|||
/// Play from current sequence to MIDI ports
|
||||
pub midi_outputs: Vec<Port<MidiOut>>,
|
||||
/// MIDI output buffer
|
||||
pub midi_out_buf: Vec<Vec<Vec<u8>>>,
|
||||
pub midi_note: Vec<u8>,
|
||||
/// MIDI output buffer
|
||||
pub midi_chunk: Vec<Vec<Vec<u8>>>,
|
||||
/// Notes currently held at input
|
||||
pub notes_in: Arc<RwLock<[bool; 128]>>,
|
||||
/// Notes currently held at output
|
||||
|
|
@ -236,12 +238,15 @@ impl<E: Engine> PhrasePool<E> {
|
|||
}
|
||||
pub fn begin_rename (&mut self) {
|
||||
self.mode = Some(PhrasePoolMode::Rename(
|
||||
self.phrase, self.phrases[self.phrase].read().unwrap().name.clone()
|
||||
self.phrase,
|
||||
self.phrases[self.phrase].read().unwrap().name.clone()
|
||||
));
|
||||
}
|
||||
pub fn begin_length (&mut self) {
|
||||
self.mode = Some(PhrasePoolMode::Length(
|
||||
self.phrase, self.phrases[self.phrase].read().unwrap().length, PhraseLengthFocus::Bar
|
||||
self.phrase,
|
||||
self.phrases[self.phrase].read().unwrap().length,
|
||||
PhraseLengthFocus::Bar
|
||||
));
|
||||
}
|
||||
pub fn move_up (&mut self) {
|
||||
|
|
@ -406,14 +411,15 @@ impl PhrasePlayer {
|
|||
monitoring: false,
|
||||
recording: false,
|
||||
overdub: true,
|
||||
midi_inputs: vec![
|
||||
jack.client().register_port(format!("{name}_in0").as_str(), MidiIn::default())?
|
||||
],
|
||||
reset: true,
|
||||
midi_note: Vec::with_capacity(8),
|
||||
midi_chunk: vec![Vec::with_capacity(16);16384],
|
||||
midi_outputs: vec![
|
||||
jack.client().register_port(format!("{name}_out0").as_str(), MidiOut::default())?
|
||||
],
|
||||
midi_out_buf: vec![Vec::with_capacity(16);16384],
|
||||
reset: true,
|
||||
midi_inputs: vec![
|
||||
jack.client().register_port(format!("{name}_in0").as_str(), MidiIn::default())?
|
||||
],
|
||||
})
|
||||
}
|
||||
pub fn toggle_monitor (&mut self) { self.monitoring = !self.monitoring; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue