AUMessageChannel

Trait AUMessageChannel 

Source
pub unsafe trait AUMessageChannel {
    // Provided methods
    unsafe fn callAudioUnit(
        &self,
        message: &NSDictionary,
    ) -> Retained<NSDictionary>
       where Self: Sized + Message { ... }
    unsafe fn callHostBlock(&self) -> CallHostBlock
       where Self: Sized + Message { ... }
    unsafe fn setCallHostBlock(&self, call_host_block: CallHostBlock)
       where Self: Sized + Message { ... }
}
Available on crate feature AUAudioUnit only.
Expand description

The protocol which objects returned from [AUAudioUnit messageChannelFor:] have to conform to.

Audio Units and hosts that have special needs of communication, e.g. to exchange musical context required for better audio processing, can implement a communication object to exchange messages in form of NSDictionaries. An Audio Unit would need to implement a class conforming to the AUMessageChannel protocol and return an instance via [AUAudioUnit messageChannelFor:]. A host can query the instance via the channel name. The protocol offers a method to send messages to the AU and a block to send messages to the host.

See also Apple’s documentation

Provided Methods§

Source

unsafe fn callAudioUnit(&self, message: &NSDictionary) -> Retained<NSDictionary>
where Self: Sized + Message,

Calls the Audio Unit with custom data message.

Parameter message: An NSDictionary with custom data. The allowed classes for key and value types are NSArray, NSDictionary, NSOrderedSet, NSSet, NSString, NSData, NSNull, NSNumber, NSDate

Returns: An NSDictionary with custom data. The allowed classes for key and value types are NSArray, NSDictionary, NSOrderedSet, NSSet, NSString, NSData, NSNull, NSNumber, NSDate

§Safety

message generic should be of the correct type.

Source

unsafe fn callHostBlock(&self) -> CallHostBlock
where Self: Sized + Message,

Available on crate feature block2 only.

A callback for the AU to send a message to the host.

The host has to set a block on this property.

§Safety

The returned block’s argument must be a valid pointer.

Source

unsafe fn setCallHostBlock(&self, call_host_block: CallHostBlock)
where Self: Sized + Message,

Available on crate feature block2 only.

Setter for callHostBlock.

This is copied when set.

§Safety

call_host_block must be a valid pointer or null.

Trait Implementations§

Source§

impl ProtocolType for dyn AUMessageChannel

Source§

const NAME: &'static str = "AUMessageChannel"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn AUMessageChannel

Implementations on Foreign Types§

Source§

impl<T> AUMessageChannel for ProtocolObject<T>
where T: ?Sized + AUMessageChannel,

Implementors§