mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
wip: phrase loop
This commit is contained in:
parent
9a6e7ab3b4
commit
4b909ffdc3
2 changed files with 31 additions and 1 deletions
|
|
@ -18,6 +18,30 @@ handle!(App |self, e| {
|
|||
});
|
||||
|
||||
const KEYMAP: &'static [KeyBinding<App>] = keymap!(App {
|
||||
[Char('x'), NONE, "extend", "double the current clip", |app: &mut App| {
|
||||
// TODO: This duplicates the current clip's contents and doubles the length.
|
||||
Ok(true)
|
||||
}],
|
||||
[Char('l'), NONE, "toggle_loop", "toggle looping", |app: &mut App| {
|
||||
// TODO: This toggles the loop flag for the clip under the cursor.
|
||||
Ok(true)
|
||||
}],
|
||||
[Char('['), NONE, "loop_start_dec", "move loop start back", |app: &mut App| {
|
||||
// TODO: This moves the loop start to the previous quant.
|
||||
Ok(true)
|
||||
}],
|
||||
[Char(']'), NONE, "loop_start_inc", "move loop start forward", |app: &mut App| {
|
||||
// TODO: This moves the loop start to the next quant.
|
||||
Ok(true)
|
||||
}],
|
||||
[Char('{'), NONE, "loop_end_dec", "move loop end back", |app: &mut App| {
|
||||
// TODOO: This moves the loop end to the previous quant.
|
||||
Ok(true)
|
||||
}],
|
||||
[Char('}'), NONE, "loop_end_inc", "move loop end forward", |app: &mut App| {
|
||||
// TODO: This moves the loop end to the next quant.
|
||||
Ok(true)
|
||||
}],
|
||||
[Char(' '), NONE, "toggle_play", "play or pause", |app: &mut App| {
|
||||
app.toggle_play()?;
|
||||
Ok(true)
|
||||
|
|
|
|||
|
|
@ -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