mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 04:36:45 +01:00
add align_s/n; position playhead
This commit is contained in:
parent
61992ab2a2
commit
9cd9131d5d
5 changed files with 79 additions and 104 deletions
|
|
@ -170,27 +170,22 @@ impl<E: Engine> PhrasePool<E> {
|
|||
}
|
||||
return None
|
||||
}
|
||||
fn new_phrase (name: Option<&str>, color: Option<Color>) -> Arc<RwLock<Phrase>> {
|
||||
Arc::new(RwLock::new(Phrase::new(
|
||||
String::from(name.unwrap_or("(new)")), true, 4 * PPQ, None, color
|
||||
)))
|
||||
}
|
||||
pub fn append_new (&mut self, name: Option<&str>, color: Option<Color>) {
|
||||
let mut phrase = Phrase::default();
|
||||
phrase.name = String::from(name.unwrap_or("(new)"));
|
||||
phrase.color = color.unwrap_or_else(random_color);
|
||||
phrase.length = 4 * PPQ;
|
||||
phrase.notes = vec![Vec::with_capacity(16);phrase.length];
|
||||
self.phrases.push(Arc::new(RwLock::new(phrase)));
|
||||
self.phrases.push(Self::new_phrase(name, color));
|
||||
self.phrase = self.phrases.len() - 1;
|
||||
}
|
||||
pub fn insert_new (&mut self, name: Option<&str>, color: Option<Color>) {
|
||||
let mut phrase = Phrase::default();
|
||||
phrase.name = String::from(name.unwrap_or("(new)"));
|
||||
phrase.color = color.unwrap_or_else(random_color);
|
||||
phrase.length = 4 * PPQ;
|
||||
phrase.notes = vec![Vec::with_capacity(16);phrase.length];
|
||||
self.phrases.insert(self.phrase + 1, Arc::new(RwLock::new(phrase)));
|
||||
self.phrases.insert(self.phrase + 1, Self::new_phrase(name, color));
|
||||
self.phrase += 1;
|
||||
}
|
||||
pub fn insert_dup (&mut self) {
|
||||
let mut phrase = self.phrases[self.phrase].read().unwrap().duplicate();
|
||||
phrase.color = random_color_near(phrase.color, 0.2);
|
||||
phrase.color = random_color_near(phrase.color, 0.25);
|
||||
self.phrases.insert(self.phrase + 1, Arc::new(RwLock::new(phrase)));
|
||||
self.phrase += 1;
|
||||
}
|
||||
|
|
@ -234,7 +229,7 @@ impl<E: Engine> PhraseEditor<E> {
|
|||
notes_out: Arc::new(RwLock::new([false;128])),
|
||||
keys: keys_vert(),
|
||||
buffer: Default::default(),
|
||||
note_axis: FixedAxis { start: 12, point: Some(36) },
|
||||
note_axis: FixedAxis { start: 12, point: Some(36) },
|
||||
time_axis: ScaledAxis { start: 0, scale: 24, point: Some(0) },
|
||||
focused: false,
|
||||
entered: false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue