mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
rename phrase -> clip mostly everywhere
This commit is contained in:
parent
709391ff0a
commit
08f7a62692
24 changed files with 426 additions and 423 deletions
|
|
@ -44,10 +44,10 @@ pub trait MidiRecordApi: HasClock + HasPlayPhrase + HasMidiIns {
|
|||
if !self.clock().is_rolling() {
|
||||
return
|
||||
}
|
||||
if let Some((started, ref clip)) = self.play_phrase().clone() {
|
||||
if let Some((started, ref clip)) = self.play_clip().clone() {
|
||||
self.record_clip(scope, started, clip, midi_buf);
|
||||
}
|
||||
if let Some((start_at, phrase)) = &self.next_phrase() {
|
||||
if let Some((start_at, clip)) = &self.next_clip() {
|
||||
self.record_next();
|
||||
}
|
||||
}
|
||||
|
|
@ -55,21 +55,21 @@ pub trait MidiRecordApi: HasClock + HasPlayPhrase + HasMidiIns {
|
|||
&mut self,
|
||||
scope: &ProcessScope,
|
||||
started: Moment,
|
||||
phrase: &Option<Arc<RwLock<MidiClip>>>,
|
||||
clip: &Option<Arc<RwLock<MidiClip>>>,
|
||||
midi_buf: &mut Vec<Vec<Vec<u8>>>
|
||||
) {
|
||||
if let Some(phrase) = phrase {
|
||||
if let Some(clip) = clip {
|
||||
let sample0 = scope.last_frame_time() as usize;
|
||||
let start = started.sample.get() as usize;
|
||||
let recording = self.recording();
|
||||
let timebase = self.clock().timebase().clone();
|
||||
let quant = self.clock().quant.get();
|
||||
let mut phrase = phrase.write().unwrap();
|
||||
let length = phrase.length;
|
||||
let mut clip = clip.write().unwrap();
|
||||
let length = clip.length;
|
||||
for input in self.midi_ins_mut().iter() {
|
||||
for (sample, event, bytes) in parse_midi_input(input.port.iter(scope)) {
|
||||
if let LiveEvent::Midi { message, .. } = event {
|
||||
phrase.record_event({
|
||||
clip.record_event({
|
||||
let sample = (sample0 + sample - start) as f64;
|
||||
let pulse = timebase.samples_to_pulse(sample);
|
||||
let quantized = (pulse / quant).round() * quant;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue