mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 12:46:42 +01:00
sampler: wip: add play_sample and stop_sample
This commit is contained in:
parent
decbb177f0
commit
ea48dd6fa1
2 changed files with 12 additions and 0 deletions
|
|
@ -4,3 +4,5 @@
|
||||||
(@right sampler select :sample-to-right)
|
(@right sampler select :sample-to-right)
|
||||||
(@r sampler record-toggle :sample-selected)
|
(@r sampler record-toggle :sample-selected)
|
||||||
(@shift-R sampler record-cancel)
|
(@shift-R sampler record-cancel)
|
||||||
|
(@p sampler play-sample :sample-selected)
|
||||||
|
(@P sampler stop-sample :sample-selected)
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,16 @@ impl SamplerCommand {
|
||||||
sampler.recording = None;
|
sampler.recording = None;
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
|
fn play_sample (sampler: &mut Sampler, pitch: usize) -> Perhaps<Self> {
|
||||||
|
if let Some(ref sample) = sampler.mapped[pitch] {
|
||||||
|
sampler.voices.write().unwrap().push(Sample::play(sample, 0, &u7::from(128)));
|
||||||
|
}
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
fn stop_sample (sampler: &mut Sampler, pitch: usize) -> Perhaps<Self> {
|
||||||
|
todo!();
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
//fn select (&self, state: &mut Sampler, i: usize) -> Option<Self> {
|
//fn select (&self, state: &mut Sampler, i: usize) -> Option<Self> {
|
||||||
//Self::Select(state.set_note_pos(i))
|
//Self::Select(state.set_note_pos(i))
|
||||||
//}
|
//}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue