mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
wip: optional dependency from mixer to sampler and plugin
This commit is contained in:
parent
a819e042c7
commit
6dd4caeb42
18 changed files with 330 additions and 316 deletions
|
|
@ -56,3 +56,60 @@ impl Phrase {
|
|||
Ok(phrase)
|
||||
}
|
||||
}
|
||||
|
||||
//impl Phrase {
|
||||
//fn from_edn <'e> (ppq: usize, args: &[Edn<'e>]) -> Usually<Self> {
|
||||
//let mut phrase = Self::default();
|
||||
//let mut name = String::new();
|
||||
//let mut beats = 0usize;
|
||||
//let mut steps = 0usize;
|
||||
//edn!(edn in args {
|
||||
//Edn::Map(map) => {
|
||||
//if let Some(Edn::Str(n)) = map.get(&Edn::Key(":name")) {
|
||||
//name = String::from(*n);
|
||||
//}
|
||||
//if let Some(Edn::Int(b)) = map.get(&Edn::Key(":beats")) {
|
||||
//beats = *b as usize;
|
||||
//phrase.length = ppq * beats;
|
||||
//for _ in phrase.notes.len()..phrase.length {
|
||||
//phrase.notes.push(Vec::with_capacity(16))
|
||||
//}
|
||||
//}
|
||||
//if let Some(Edn::Int(s)) = map.get(&Edn::Key(":steps")) {
|
||||
//steps = *s as usize;
|
||||
//}
|
||||
//},
|
||||
//Edn::List(args) => {
|
||||
//let time = (match args.get(0) {
|
||||
//Some(Edn::Key(text)) => text[1..].parse::<f64>()?,
|
||||
//Some(Edn::Int(i)) => *i as f64,
|
||||
//Some(Edn::Double(f)) => f64::from(*f),
|
||||
//_ => panic!("unexpected in phrase '{name}': {:?}", args.get(0)),
|
||||
//} * beats as f64 * ppq as f64 / steps as f64) as usize;
|
||||
//for edn in args[1..].iter() {
|
||||
//match edn {
|
||||
//Edn::List(args) => if let (
|
||||
//Some(Edn::Int(key)),
|
||||
//Some(Edn::Int(vel)),
|
||||
//) = (
|
||||
//args.get(0),
|
||||
//args.get(1),
|
||||
//) {
|
||||
//let (key, vel) = (
|
||||
//u7::from((*key as u8).min(127)),
|
||||
//u7::from((*vel as u8).min(127)),
|
||||
//);
|
||||
//phrase.notes[time].push(MidiMessage::NoteOn { key, vel })
|
||||
//} else {
|
||||
//panic!("unexpected list in phrase '{name}'")
|
||||
//},
|
||||
//_ => panic!("unexpected in phrase '{name}': {edn:?}")
|
||||
//}
|
||||
//}
|
||||
//},
|
||||
//_ => panic!("unexpected in phrase '{name}': {edn:?}"),
|
||||
//});
|
||||
//phrase.name = name;
|
||||
//Ok(phrase)
|
||||
//}
|
||||
//}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue