AudioMidiShell

Struct AudioMidiShell 

Source
pub struct AudioMidiShell {
    pub midi_connections: Vec<MidiInputConnection<Sender<(u64, Vec<u8>)>>>,
    pub output_device: OutputDevice,
}
Expand description

Shell running the audio and MIDI processing.

Fields§

§midi_connections: Vec<MidiInputConnection<Sender<(u64, Vec<u8>)>>>

MIDI connections.

§output_device: OutputDevice

Output device:

Implementations§

Source§

impl AudioMidiShell

Source

pub fn spawn( sample_rate: u32, buffer_size: usize, process_chunk_size: usize, generator: impl AudioGenerator + Send + 'static, ) -> Self

Initializes the MIDI inputs, the output device and runs the generator in a callback. It returns a shell object that must be kept alive.

  • sample_rate is the sampling frequency in Hz.
  • buffer_size is the number of frames used by the system buffer. This setting determines the latency.
  • process_chunk_size is the number of frames passed to the process function.
Source

pub fn run_forever( sample_rate: u32, buffer_size: usize, process_chunk_size: usize, generator: impl AudioGenerator + Send + 'static, ) -> !

Spawns the shell and keeps it alive forever.

  • sample_rate is the sampling frequency in Hz.
  • buffer_size is the number of samples used by the system buffer. This setting determines the latency.
  • process_chunk_size is the number of samples passed to the process function.
Examples found in repository?
examples/sine_synth.rs (lines 10-15)
9fn main() -> ! {
10    AudioMidiShell::run_forever(
11        SAMPLE_RATE,
12        BUFFER_SIZE,
13        PROCESS_CHUNK_SIZE,
14        SineSynth::default(),
15    );
16}

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.