Struct coreaudio::audio_unit::AudioUnit [] [src]

pub struct AudioUnit {
    // some fields omitted
}

A rust representation of the au::AudioUnit, including a pointer to the current rendering callback.

Find the original Audio Unit Programming Guide here.

Methods

impl AudioUnit
[src]

fn set_render_callback<F, D>(&mut self, f: F) -> Result<()Error> where F: FnMut(Args<D>) -> Result<()()> + 'static, D: Data

Pass a render callback (aka "Input Procedure") to the AudioUnit.

fn free_render_callback(&mut self)

Retrieves ownership over the render callback and drops it.

impl AudioUnit
[src]

fn new<T>(ty: T) -> Result<AudioUnitError> where T: Into<Type>

Construct a new AudioUnit with any type that may be automatically converted into Type.

Here is a list of compatible types:

To construct the AudioUnit with some component flags, see AudioUnit::new_with_flags.

Note: the AudioUnit is constructed with the kAudioUnitManufacturer_Apple Manufacturer Identifier, as this is the only Audio Unit Manufacturer Identifier documented by Apple in the AudioUnit reference (see here).

fn new_with_flags<T>(ty: T, flags: u32, mask: u32) -> Result<AudioUnitError> where T: Into<Type>

The same as AudioUnit::new but with the given component flags and mask.

fn set_property<T>(&mut self, id: u32, scope: Scope, elem: Element, maybe_data: Option<&T>) -> Result<()Error>

Sets the value for some property of the AudioUnit.

To clear an audio unit property value, set the data paramater with None::<()>.

Clearing properties only works for those properties that do not have a default value.

For more on "properties" see the reference.

Available in iOS 2.0 and later.

Parameters

  • id: The identifier of the property.
  • scope: The audio unit scope for the property.
  • elem: The audio unit element for the property.
  • maybe_data: The value that you want to apply to the property.

fn get_property<T>(&self, id: u32, scope: Scope, elem: Element) -> Result<T, Error>

Gets the value of an AudioUnit property.

Available in iOS 2.0 and later.

Parameters

  • id: The identifier of the property.
  • scope: The audio unit scope for the property.
  • elem: The audio unit element for the property.

fn start(&mut self) -> Result<()Error>

Starts an I/O AudioUnit, which in turn starts the audio unit processing graph that it is connected to.

Available in OS X v10.0 and later.

fn stop(&mut self) -> Result<()Error>

Stops an I/O AudioUnit, which in turn stops the audio unit processing graph that it is connected to.

Available in OS X v10.0 and later.

fn set_sample_rate(&mut self, sample_rate: f64) -> Result<()Error>

Set the AudioUnit's sample rate.

Available in iOS 2.0 and later.

fn sample_rate(&self) -> Result<f64Error>

Get the AudioUnit's sample rate.

fn set_stream_format(&mut self, stream_format: StreamFormat) -> Result<()Error>

Sets the current StreamFormat for the AudioUnit.

Core Audio uses slightly different defaults depending on the platform.

From the Core Audio Overview:

The canonical formats in Core Audio are as follows:

  • iOS input and output: Linear PCM with 16-bit integer samples.
  • iOS audio units and other audio processing: Noninterleaved linear PCM with 8.24-bit fixed-point samples
  • Mac input and output: Linear PCM with 32-bit floating point samples.
  • Mac audio units and other audio processing: Noninterleaved linear PCM with 32-bit floating-point

fn stream_format(&self) -> Result<StreamFormatError>

Return the current Stream Format for the AudioUnit.

Trait Implementations

impl Send for AudioUnit
[src]

impl Drop for AudioUnit
[src]

fn drop(&mut self)

A method called when the value goes out of scope. Read more