mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
wip: phrase loop
This commit is contained in:
parent
9a6e7ab3b4
commit
4b909ffdc3
2 changed files with 31 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ pub struct Phrase {
|
|||
pub name: String,
|
||||
pub length: usize,
|
||||
pub notes: PhraseData,
|
||||
pub looped: Option<(usize, usize)>
|
||||
}
|
||||
|
||||
impl Default for Phrase {
|
||||
|
|
@ -14,7 +15,12 @@ impl Default for Phrase {
|
|||
|
||||
impl Phrase {
|
||||
pub fn new (name: &str, length: usize, notes: Option<PhraseData>) -> Self {
|
||||
Self { name: name.to_string(), length, notes: notes.unwrap_or(BTreeMap::new()) }
|
||||
Self {
|
||||
name: name.to_string(),
|
||||
length,
|
||||
notes: notes.unwrap_or(BTreeMap::new()),
|
||||
looped: Some((0, length))
|
||||
}
|
||||
}
|
||||
/// Check if a range `start..end` contains MIDI Note On `k`
|
||||
pub fn contains_note_on (&self, k: u7, start: usize, end: usize) -> bool {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue