diff --git a/examples/audio_midi.rs b/examples/audio_midi.rs index 3fff087..aa1ac7e 100644 --- a/examples/audio_midi.rs +++ b/examples/audio_midi.rs @@ -57,7 +57,7 @@ fn main() -> ! { let mut midi_parser = instrument::midi::Parser::new(); let midi_note_clone = Arc::clone(&midi_note); - let midi_interface = midi_interface.start(move |byte| { + let midi_interface = midi_interface.spawn(move |byte| { midi_parser.rx(byte, |_channel, message| { if let instrument::midi::Message::NoteOn { note, velocity: _ } = message { loggit!("note_on: {:?}", note); @@ -69,7 +69,7 @@ fn main() -> ! { // - audio callback ------------------------------------------------------- - let audio_interface = audio_interface.start(move |fs, block| { + let audio_interface = audio_interface.spawn(move |fs, block| { let midi_note = midi_note.load(Ordering::Relaxed); let frequency = instrument::midi::to_hz(midi_note); osc.dx = (1. / fs) * frequency; diff --git a/examples/audio_passthrough.rs b/examples/audio_passthrough.rs index 4feb0e1..848c9cd 100644 --- a/examples/audio_passthrough.rs +++ b/examples/audio_passthrough.rs @@ -73,12 +73,12 @@ fn main() -> ! { } } - audio_interface.start(callback).unwrap() + audio_interface.spawn(callback).unwrap() }; // handle callback with closure (needs alloc) #[cfg(any(feature = "alloc"))] - let audio_interface = audio_interface.start(|_fs, block| { + let audio_interface = audio_interface.spawn(|_fs, block| { for frame in block { let (left, right) = *frame; *frame = (left, right); diff --git a/examples/audio_testsignal.rs b/examples/audio_testsignal.rs index e0c4cca..afa1043 100644 --- a/examples/audio_testsignal.rs +++ b/examples/audio_testsignal.rs @@ -94,7 +94,7 @@ fn main() -> ! { let mut osc_1: osc::Wavetable = osc::Wavetable::new(osc::Shape::Sin); let mut osc_2: osc::Wavetable = osc::Wavetable::new(osc::Shape::Saw); - audio_interface.start(move |fs, block| { + audio_interface.spawn(move |fs, block| { osc_1.dx = (1. / fs) * 110.00; osc_2.dx = (1. / fs) * 110.00; for frame in block { diff --git a/src/audio.rs b/src/audio.rs index 80f5c9d..229e10a 100644 --- a/src/audio.rs +++ b/src/audio.rs @@ -170,22 +170,22 @@ impl<'a> Interface<'a> { /// assign function pointer for interrupt callback and start audio #[cfg(not(feature = "alloc"))] - pub fn start(mut self, function_ptr:fn (f32, &mut Block)) -> Result { + pub fn spawn(mut self, function_ptr:fn (f32, &mut Block)) -> Result { self.function_ptr = Some(function_ptr); - self.start_audio()?; + self.start()?; Ok(self) // TODO type state for started audio interface } /// assign closure for interrupt callback and start audio #[cfg(any(feature = "alloc"))] - pub fn start(mut self, closure: F) -> Result { + pub fn spawn(mut self, closure: F) -> Result { self.closure = Some(Box::new(closure)); - self.start_audio()?; + self.start()?; Ok(self) // TODO type state for started audio interface } - fn start_audio(&mut self) -> Result<(), Error> { + fn start(&mut self) -> Result<(), Error> { // - AK4556 ----------------------------------------------------------- let ak4556_reset = self.ak4556_reset.as_mut().unwrap(); diff --git a/src/midi.rs b/src/midi.rs index 096432a..2884a43 100644 --- a/src/midi.rs +++ b/src/midi.rs @@ -61,7 +61,7 @@ impl<'a> Interface<'a> { /// assign function pointer for interrupt callback and start interface #[cfg(not(feature = "alloc"))] - pub fn start(mut self, function_ptr:fn (u8)) -> Result { + pub fn spawn(mut self, function_ptr:fn (u8)) -> Result { self.function_ptr = Some(function_ptr); unsafe { pac::NVIC::unmask(pac::Interrupt::USART1); } Ok(self) @@ -69,7 +69,7 @@ impl<'a> Interface<'a> { /// assign closure for interrupt callback and start interface #[cfg(any(feature = "alloc"))] - pub fn start(mut self, closure: F) -> Result { + pub fn spawn(mut self, closure: F) -> Result { self.closure = Some(Box::new(closure)); unsafe { pac::NVIC::unmask(pac::Interrupt::USART1); } Ok(self)