mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
wip: refactor pt.19: 22 errors
This commit is contained in:
parent
2be2c8aca2
commit
914c2d6c09
12 changed files with 78 additions and 61 deletions
|
|
@ -61,18 +61,18 @@ impl MIDIPlayer {
|
|||
],
|
||||
})
|
||||
}
|
||||
fn is_rolling (&self) -> bool {
|
||||
pub fn is_rolling (&self) -> bool {
|
||||
*self.clock.playing.read().unwrap() == Some(TransportState::Rolling)
|
||||
}
|
||||
fn has_midi_inputs (&self) -> bool {
|
||||
pub fn has_midi_inputs (&self) -> bool {
|
||||
self.midi_inputs.len() > 0
|
||||
}
|
||||
fn has_midi_outputs (&self) -> bool {
|
||||
pub fn has_midi_outputs (&self) -> bool {
|
||||
self.midi_outputs.len() > 0
|
||||
}
|
||||
/// Clear the section of the output buffer that we will be using,
|
||||
/// emitting "all notes off" at start of buffer if requested.
|
||||
fn clear (&mut self, scope: &ProcessScope, force_reset: bool) {
|
||||
pub fn clear (&mut self, scope: &ProcessScope, force_reset: bool) {
|
||||
for frame in &mut self.midi_chunk[0..scope.n_frames() as usize] {
|
||||
frame.clear();
|
||||
}
|
||||
|
|
@ -80,7 +80,7 @@ impl MIDIPlayer {
|
|||
all_notes_off(&mut self.midi_chunk); self.reset = false;
|
||||
}
|
||||
}
|
||||
fn play (&mut self, scope: &ProcessScope) -> bool {
|
||||
pub fn play (&mut self, scope: &ProcessScope) -> bool {
|
||||
let mut next = false;
|
||||
// Write MIDI events from currently playing phrase (if any) to MIDI output buffer
|
||||
if self.is_rolling() {
|
||||
|
|
@ -138,7 +138,7 @@ impl MIDIPlayer {
|
|||
}
|
||||
next
|
||||
}
|
||||
fn switchover (&mut self, scope: &ProcessScope) {
|
||||
pub fn switchover (&mut self, scope: &ProcessScope) {
|
||||
if self.is_rolling() {
|
||||
let sample0 = scope.last_frame_time() as usize;
|
||||
//let samples = scope.n_frames() as usize;
|
||||
|
|
@ -163,7 +163,7 @@ impl MIDIPlayer {
|
|||
}
|
||||
}
|
||||
}
|
||||
fn record (&mut self, scope: &ProcessScope) {
|
||||
pub fn record (&mut self, scope: &ProcessScope) {
|
||||
let sample0 = scope.last_frame_time() as usize;
|
||||
if let (true, Some((started, phrase))) = (self.is_rolling(), &self.phrase) {
|
||||
let start = started.sample.get() as usize;
|
||||
|
|
@ -199,7 +199,7 @@ impl MIDIPlayer {
|
|||
// TODO switch to next phrase and record into it
|
||||
}
|
||||
}
|
||||
fn monitor (&mut self, scope: &ProcessScope) {
|
||||
pub fn monitor (&mut self, scope: &ProcessScope) {
|
||||
let mut notes_in = self.notes_in.write().unwrap();
|
||||
for input in self.midi_inputs.iter() {
|
||||
for (sample, event, bytes) in parse_midi_input(input.iter(scope)) {
|
||||
|
|
@ -210,7 +210,7 @@ impl MIDIPlayer {
|
|||
}
|
||||
}
|
||||
}
|
||||
fn write (&mut self, scope: &ProcessScope) {
|
||||
pub fn write (&mut self, scope: &ProcessScope) {
|
||||
let samples = scope.n_frames() as usize;
|
||||
for port in self.midi_outputs.iter_mut() {
|
||||
let writer = &mut port.writer(scope);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue