pub struct JackCallbackContext { /* private fields */ }Expand description
Context for some callbacks.
Implementations§
Source§impl JackCallbackContext
impl JackCallbackContext
Sourcepub fn nframes(&self) -> u32
pub fn nframes(&self) -> u32
Returns the number of frames that must be processed in this callback.
Sourcepub fn get_port_buffer(&self, port: &JackPort) -> Option<&mut [f32]>
pub fn get_port_buffer(&self, port: &JackPort) -> Option<&mut [f32]>
Gets the buffer of a port, if the port is valid.
Examples found in repository?
More examples
examples/sawtooth.rs (line 13)
12 fn process(&mut self, ctx: &JackCallbackContext) -> JackControl {
13 let out1 = ctx.get_port_buffer(&self.out1).unwrap();
14 let out2 = ctx.get_port_buffer(&self.out2).unwrap();
15 for (out1, out2) in out1.iter_mut().zip(out2.iter_mut()) {
16 *out1 = self.left_saw * 0.2;
17 *out2 = self.right_saw * 0.2;
18 self.left_saw += 0.01;
19 if self.left_saw >= 1.0 { self.left_saw -= 2.0; }
20 self.right_saw += 0.03;
21 if self.right_saw >= 1.0 { self.right_saw -= 2.0; }
22 }
23 JackControl::Continue
24 }Auto Trait Implementations§
impl Freeze for JackCallbackContext
impl RefUnwindSafe for JackCallbackContext
impl Send for JackCallbackContext
impl Sync for JackCallbackContext
impl Unpin for JackCallbackContext
impl UnsafeUnpin for JackCallbackContext
impl UnwindSafe for JackCallbackContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more