mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
more weird formatting
This commit is contained in:
parent
d64f4b8af7
commit
076be5bcb3
1 changed files with 12 additions and 46 deletions
|
|
@ -217,15 +217,12 @@ 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) {
|
||||
|
|
@ -273,20 +270,12 @@ impl<E: Engine> PhraseEditor<E> {
|
|||
pub fn note_cursor_inc (&self) {
|
||||
let mut axis = self.note_axis.write().unwrap();
|
||||
axis.point_dec(1);
|
||||
if let Some(point) = axis.point {
|
||||
if point < axis.start {
|
||||
axis.start = (point / 2) * 2;
|
||||
}
|
||||
}
|
||||
if let Some(point) = axis.point { if point < axis.start { axis.start = (point / 2) * 2; } }
|
||||
}
|
||||
pub fn note_cursor_dec (&self) {
|
||||
let mut axis = self.note_axis.write().unwrap();
|
||||
axis.point_inc(1);
|
||||
if let Some(point) = axis.point {
|
||||
if point > 73 {
|
||||
axis.point = Some(73);
|
||||
}
|
||||
}
|
||||
if let Some(point) = axis.point { if point > 73 { axis.point = Some(73); } }
|
||||
}
|
||||
pub fn note_page_up (&self) {
|
||||
let mut axis = self.note_axis.write().unwrap();
|
||||
|
|
@ -298,18 +287,10 @@ impl<E: Engine> PhraseEditor<E> {
|
|||
axis.start_inc(3);
|
||||
axis.point_inc(3);
|
||||
}
|
||||
pub fn note_scroll_inc (&self) {
|
||||
self.note_axis.write().unwrap().start_dec(1);
|
||||
}
|
||||
pub fn note_scroll_dec (&self) {
|
||||
self.note_axis.write().unwrap().start_inc(1);
|
||||
}
|
||||
pub fn note_length_inc (&mut self) {
|
||||
self.note_len = next_note_length(self.note_len)
|
||||
}
|
||||
pub fn note_length_dec (&mut self) {
|
||||
self.note_len = prev_note_length(self.note_len)
|
||||
}
|
||||
pub fn note_scroll_inc (&self) { self.note_axis.write().unwrap().start_dec(1); }
|
||||
pub fn note_scroll_dec (&self) { self.note_axis.write().unwrap().start_inc(1); }
|
||||
pub fn note_length_inc (&mut self) { self.note_len = next_note_length(self.note_len) }
|
||||
pub fn note_length_dec (&mut self) { self.note_len = prev_note_length(self.note_len) }
|
||||
pub fn time_cursor_advance (&self) {
|
||||
let point = self.time_axis.read().unwrap().point;
|
||||
let length = self.phrase.as_ref().map(|p|p.read().unwrap().length).unwrap_or(1);
|
||||
|
|
@ -367,13 +348,9 @@ impl Phrase {
|
|||
clone.uuid = uuid::Uuid::new_v4();
|
||||
clone
|
||||
}
|
||||
pub fn toggle_loop (&mut self) {
|
||||
self.loop_on = !self.loop_on;
|
||||
}
|
||||
pub fn toggle_loop (&mut self) { self.loop_on = !self.loop_on; }
|
||||
pub fn record_event (&mut self, pulse: usize, message: MidiMessage) {
|
||||
if pulse >= self.length {
|
||||
panic!("extend phrase first")
|
||||
}
|
||||
if pulse >= self.length { panic!("extend phrase first") }
|
||||
self.notes[pulse].push(message);
|
||||
}
|
||||
/// Check if a range `start..end` contains MIDI Note On `k`
|
||||
|
|
@ -381,14 +358,7 @@ impl Phrase {
|
|||
//panic!("{:?} {start} {end}", &self);
|
||||
for events in self.notes[start.max(0)..end.min(self.notes.len())].iter() {
|
||||
for event in events.iter() {
|
||||
match event {
|
||||
MidiMessage::NoteOn {key,..} => {
|
||||
if *key == k {
|
||||
return true
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
if let MidiMessage::NoteOn {key,..} = event { if *key == k { return true } }
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
|
@ -438,11 +408,7 @@ impl<E: Engine> PhrasePlayer<E> {
|
|||
Some(TransportState::Rolling),
|
||||
Some((start_frame, _)),
|
||||
Some((_started, Some(ref phrase)))
|
||||
) = (
|
||||
*self.clock.playing.read().unwrap(),
|
||||
self.started,
|
||||
&self.phrase
|
||||
) {
|
||||
) = (*self.clock.playing.read().unwrap(), self.started, &self.phrase) {
|
||||
Some((start_frame, phrase.clone()))
|
||||
} else {
|
||||
None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue