Struct nannou_audio::Host
source · pub struct Host { /* private fields */ }
Expand description
The top-level audio API, for enumerating devices and spawning input/output streams.
Implementations§
source§impl Host
impl Host
sourcepub fn from_id(id: HostId) -> Result<Self, HostUnavailable>
pub fn from_id(id: HostId) -> Result<Self, HostUnavailable>
Instantiate the current host for the platform.
sourcepub fn new() -> Self
pub fn new() -> Self
Initialise the API.
The Default
implementation for Host
calls this constructor internally.
sourcepub fn devices(&self) -> Result<Devices, DevicesError>
pub fn devices(&self) -> Result<Devices, DevicesError>
Enumerate the available audio devices on the system.
Produces an iterator yielding Device
s.
sourcepub fn input_devices(&self) -> Result<Devices, DevicesError>
pub fn input_devices(&self) -> Result<Devices, DevicesError>
Enumerate the available audio devices on the system that support input streams.
Produces an iterator yielding Device
s.
sourcepub fn output_devices(&self) -> Result<Devices, DevicesError>
pub fn output_devices(&self) -> Result<Devices, DevicesError>
Enumerate the available audio devices on the system that support output streams.
Produces an iterator yielding Device
s.
sourcepub fn default_input_device(&self) -> Option<Device>
pub fn default_input_device(&self) -> Option<Device>
The current default audio input device.
sourcepub fn default_output_device(&self) -> Option<Device>
pub fn default_output_device(&self) -> Option<Device>
The current default audio output device.
sourcepub fn new_input_stream<M, S>(&self, model: M) -> BuilderInit<M, S>
pub fn new_input_stream<M, S>(&self, model: M) -> BuilderInit<M, S>
Begin building a new input audio stream.
If this is the first time a stream has been created, this method will spawn the
cpal::EventLoop::run
method on its own thread, ready to run built streams.
sourcepub fn new_output_stream<M, S>(&self, model: M) -> BuilderInit<M, S>
pub fn new_output_stream<M, S>(&self, model: M) -> BuilderInit<M, S>
Begin building a new output audio stream.
If this is the first time a stream has been created, this method will spawn the
cpal::EventLoop::run
method on its own thread, ready to run built streams.