use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-audio-types")]
use objc2_core_audio_types::*;
#[cfg(feature = "objc2-core-midi")]
use objc2_core_midi::*;
use objc2_foundation::*;
use crate::*;
pub type AUAudioObjectID = u32;
pub type AUAudioUnitStatus = OSStatus;
#[cfg(feature = "AudioUnitProperties")]
pub const AUEventSampleTimeImmediate: AUEventSampleTime = -4294967296;
pub type AUAudioFrameCount = u32;
pub type AUAudioChannelCount = u32;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AUAudioUnitBusType(pub NSInteger);
impl AUAudioUnitBusType {
#[doc(alias = "AUAudioUnitBusTypeInput")]
pub const Input: Self = Self(1);
#[doc(alias = "AUAudioUnitBusTypeOutput")]
pub const Output: Self = Self(2);
}
unsafe impl Encode for AUAudioUnitBusType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for AUAudioUnitBusType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[cfg(all(
feature = "AUComponent",
feature = "block2",
feature = "objc2-core-audio-types"
))]
pub type AURenderPullInputBlock = *mut block2::DynBlock<
dyn Fn(
NonNull<AudioUnitRenderActionFlags>,
NonNull<AudioTimeStamp>,
AUAudioFrameCount,
NSInteger,
NonNull<AudioBufferList>,
) -> AUAudioUnitStatus,
>;
#[cfg(all(
feature = "AUComponent",
feature = "block2",
feature = "objc2-core-audio-types"
))]
pub type AURenderBlock = *mut block2::DynBlock<
dyn Fn(
NonNull<AudioUnitRenderActionFlags>,
NonNull<AudioTimeStamp>,
AUAudioFrameCount,
NSInteger,
NonNull<AudioBufferList>,
AURenderPullInputBlock,
) -> AUAudioUnitStatus,
>;
#[cfg(all(
feature = "AUComponent",
feature = "block2",
feature = "objc2-core-audio-types"
))]
pub type AURenderObserver = *mut block2::DynBlock<
dyn Fn(AudioUnitRenderActionFlags, NonNull<AudioTimeStamp>, AUAudioFrameCount, NSInteger),
>;
#[cfg(all(
feature = "AUParameters",
feature = "AudioUnitProperties",
feature = "block2"
))]
pub type AUScheduleParameterBlock = *mut block2::DynBlock<
dyn Fn(AUEventSampleTime, AUAudioFrameCount, AUParameterAddress, AUValue),
>;
#[cfg(all(feature = "AudioUnitProperties", feature = "block2"))]
pub type AUScheduleMIDIEventBlock =
*mut block2::DynBlock<dyn Fn(AUEventSampleTime, u8, NSInteger, NonNull<u8>)>;
#[cfg(all(feature = "AudioUnitProperties", feature = "block2"))]
pub type AUMIDIOutputEventBlock =
*mut block2::DynBlock<dyn Fn(AUEventSampleTime, u8, NSInteger, NonNull<u8>) -> OSStatus>;
#[cfg(feature = "block2")]
pub type AUHostMusicalContextBlock = *mut block2::DynBlock<
dyn Fn(
*mut c_double,
*mut c_double,
*mut NSInteger,
*mut c_double,
*mut NSInteger,
*mut c_double,
) -> Bool,
>;
#[cfg(all(feature = "block2", feature = "objc2-core-midi"))]
pub type AUMIDICIProfileChangedBlock =
*mut block2::DynBlock<dyn Fn(u8, MIDIChannelNumber, NonNull<MIDICIProfile>, Bool)>;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AUHostTransportStateFlags(pub NSUInteger);
bitflags::bitflags! {
impl AUHostTransportStateFlags: NSUInteger {
#[doc(alias = "AUHostTransportStateChanged")]
const Changed = 1;
#[doc(alias = "AUHostTransportStateMoving")]
const Moving = 2;
#[doc(alias = "AUHostTransportStateRecording")]
const Recording = 4;
#[doc(alias = "AUHostTransportStateCycling")]
const Cycling = 8;
}
}
unsafe impl Encode for AUHostTransportStateFlags {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for AUHostTransportStateFlags {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[cfg(feature = "block2")]
pub type AUHostTransportStateBlock = *mut block2::DynBlock<
dyn Fn(*mut AUHostTransportStateFlags, *mut c_double, *mut c_double, *mut c_double) -> Bool,
>;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct AUAudioUnit;
);
extern_conformance!(
unsafe impl NSObjectProtocol for AUAudioUnit {}
);
impl AUAudioUnit {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "AudioComponent")]
#[unsafe(method(initWithComponentDescription:options:error:_))]
#[unsafe(method_family = init)]
pub unsafe fn initWithComponentDescription_options_error(
this: Allocated<Self>,
component_description: AudioComponentDescription,
options: AudioComponentInstantiationOptions,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(feature = "AudioComponent")]
#[unsafe(method(initWithComponentDescription:error:_))]
#[unsafe(method_family = init)]
pub unsafe fn initWithComponentDescription_error(
this: Allocated<Self>,
component_description: AudioComponentDescription,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(all(feature = "AudioComponent", feature = "block2"))]
#[unsafe(method(instantiateWithComponentDescription:options:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn instantiateWithComponentDescription_options_completionHandler(
component_description: AudioComponentDescription,
options: AudioComponentInstantiationOptions,
completion_handler: &block2::DynBlock<dyn Fn(*mut AUAudioUnit, *mut NSError)>,
);
#[cfg(feature = "AudioComponent")]
#[unsafe(method(componentDescription))]
#[unsafe(method_family = none)]
pub unsafe fn componentDescription(&self) -> AudioComponentDescription;
#[cfg(feature = "AudioComponent")]
#[unsafe(method(component))]
#[unsafe(method_family = none)]
pub unsafe fn component(&self) -> AudioComponent;
#[unsafe(method(componentName))]
#[unsafe(method_family = none)]
pub unsafe fn componentName(&self) -> Option<Retained<NSString>>;
#[unsafe(method(audioUnitName))]
#[unsafe(method_family = none)]
pub unsafe fn audioUnitName(&self) -> Option<Retained<NSString>>;
#[unsafe(method(manufacturerName))]
#[unsafe(method_family = none)]
pub unsafe fn manufacturerName(&self) -> Option<Retained<NSString>>;
#[unsafe(method(audioUnitShortName))]
#[unsafe(method_family = none)]
pub unsafe fn audioUnitShortName(&self) -> Option<Retained<NSString>>;
#[unsafe(method(componentVersion))]
#[unsafe(method_family = none)]
pub unsafe fn componentVersion(&self) -> u32;
#[unsafe(method(allocateRenderResourcesAndReturnError:_))]
#[unsafe(method_family = none)]
pub unsafe fn allocateRenderResourcesAndReturnError(&self)
-> Result<(), Retained<NSError>>;
#[unsafe(method(deallocateRenderResources))]
#[unsafe(method_family = none)]
pub unsafe fn deallocateRenderResources(&self);
#[unsafe(method(renderResourcesAllocated))]
#[unsafe(method_family = none)]
pub unsafe fn renderResourcesAllocated(&self) -> bool;
#[unsafe(method(reset))]
#[unsafe(method_family = none)]
pub unsafe fn reset(&self);
#[unsafe(method(inputBusses))]
#[unsafe(method_family = none)]
pub unsafe fn inputBusses(&self) -> Retained<AUAudioUnitBusArray>;
#[unsafe(method(outputBusses))]
#[unsafe(method_family = none)]
pub unsafe fn outputBusses(&self) -> Retained<AUAudioUnitBusArray>;
#[cfg(all(
feature = "AUComponent",
feature = "block2",
feature = "objc2-core-audio-types"
))]
#[unsafe(method(renderBlock))]
#[unsafe(method_family = none)]
pub unsafe fn renderBlock(&self) -> AURenderBlock;
#[cfg(all(
feature = "AUParameters",
feature = "AudioUnitProperties",
feature = "block2"
))]
#[unsafe(method(scheduleParameterBlock))]
#[unsafe(method_family = none)]
pub unsafe fn scheduleParameterBlock(&self) -> AUScheduleParameterBlock;
#[cfg(all(
feature = "AUComponent",
feature = "block2",
feature = "objc2-core-audio-types"
))]
#[unsafe(method(tokenByAddingRenderObserver:))]
#[unsafe(method_family = none)]
pub unsafe fn tokenByAddingRenderObserver(&self, observer: AURenderObserver) -> NSInteger;
#[unsafe(method(removeRenderObserver:))]
#[unsafe(method_family = none)]
pub unsafe fn removeRenderObserver(&self, token: NSInteger);
#[unsafe(method(maximumFramesToRender))]
#[unsafe(method_family = none)]
pub unsafe fn maximumFramesToRender(&self) -> AUAudioFrameCount;
#[unsafe(method(setMaximumFramesToRender:))]
#[unsafe(method_family = none)]
pub unsafe fn setMaximumFramesToRender(&self, maximum_frames_to_render: AUAudioFrameCount);
#[cfg(feature = "AUParameters")]
#[unsafe(method(parameterTree))]
#[unsafe(method_family = none)]
pub unsafe fn parameterTree(&self) -> Option<Retained<AUParameterTree>>;
#[cfg(feature = "AUParameters")]
#[unsafe(method(setParameterTree:))]
#[unsafe(method_family = none)]
pub unsafe fn setParameterTree(&self, parameter_tree: Option<&AUParameterTree>);
#[unsafe(method(parametersForOverviewWithCount:))]
#[unsafe(method_family = none)]
pub unsafe fn parametersForOverviewWithCount(
&self,
count: NSInteger,
) -> Retained<NSArray<NSNumber>>;
#[unsafe(method(allParameterValues))]
#[unsafe(method_family = none)]
pub unsafe fn allParameterValues(&self) -> bool;
#[unsafe(method(isMusicDeviceOrEffect))]
#[unsafe(method_family = none)]
pub unsafe fn isMusicDeviceOrEffect(&self) -> bool;
#[unsafe(method(virtualMIDICableCount))]
#[unsafe(method_family = none)]
pub unsafe fn virtualMIDICableCount(&self) -> NSInteger;
#[cfg(all(feature = "AudioUnitProperties", feature = "block2"))]
#[unsafe(method(scheduleMIDIEventBlock))]
#[unsafe(method_family = none)]
pub unsafe fn scheduleMIDIEventBlock(&self) -> AUScheduleMIDIEventBlock;
#[unsafe(method(MIDIOutputNames))]
#[unsafe(method_family = none)]
pub unsafe fn MIDIOutputNames(&self) -> Retained<NSArray<NSString>>;
#[unsafe(method(providesUserInterface))]
#[unsafe(method_family = none)]
pub unsafe fn providesUserInterface(&self) -> bool;
#[cfg(all(feature = "AudioUnitProperties", feature = "block2"))]
#[unsafe(method(MIDIOutputEventBlock))]
#[unsafe(method_family = none)]
pub unsafe fn MIDIOutputEventBlock(&self) -> AUMIDIOutputEventBlock;
#[cfg(all(feature = "AudioUnitProperties", feature = "block2"))]
#[unsafe(method(setMIDIOutputEventBlock:))]
#[unsafe(method_family = none)]
pub unsafe fn setMIDIOutputEventBlock(
&self,
midi_output_event_block: AUMIDIOutputEventBlock,
);
#[cfg(feature = "objc2-core-midi")]
#[unsafe(method(AudioUnitMIDIProtocol))]
#[unsafe(method_family = none)]
pub unsafe fn AudioUnitMIDIProtocol(&self) -> MIDIProtocolID;
#[cfg(feature = "objc2-core-midi")]
#[unsafe(method(hostMIDIProtocol))]
#[unsafe(method_family = none)]
pub unsafe fn hostMIDIProtocol(&self) -> MIDIProtocolID;
#[cfg(feature = "objc2-core-midi")]
#[unsafe(method(setHostMIDIProtocol:))]
#[unsafe(method_family = none)]
pub unsafe fn setHostMIDIProtocol(&self, host_midi_protocol: MIDIProtocolID);
#[unsafe(method(fullState))]
#[unsafe(method_family = none)]
pub unsafe fn fullState(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
#[unsafe(method(setFullState:))]
#[unsafe(method_family = none)]
pub unsafe fn setFullState(&self, full_state: Option<&NSDictionary<NSString, AnyObject>>);
#[unsafe(method(fullStateForDocument))]
#[unsafe(method_family = none)]
pub unsafe fn fullStateForDocument(
&self,
) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
#[unsafe(method(setFullStateForDocument:))]
#[unsafe(method_family = none)]
pub unsafe fn setFullStateForDocument(
&self,
full_state_for_document: Option<&NSDictionary<NSString, AnyObject>>,
);
#[unsafe(method(factoryPresets))]
#[unsafe(method_family = none)]
pub unsafe fn factoryPresets(&self) -> Option<Retained<NSArray<AUAudioUnitPreset>>>;
#[unsafe(method(userPresets))]
#[unsafe(method_family = none)]
pub unsafe fn userPresets(&self) -> Retained<NSArray<AUAudioUnitPreset>>;
#[unsafe(method(saveUserPreset:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn saveUserPreset_error(
&self,
user_preset: &AUAudioUnitPreset,
) -> Result<(), Retained<NSError>>;
#[unsafe(method(deleteUserPreset:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn deleteUserPreset_error(
&self,
user_preset: &AUAudioUnitPreset,
) -> Result<(), Retained<NSError>>;
#[unsafe(method(presetStateFor:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn presetStateFor_error(
&self,
user_preset: &AUAudioUnitPreset,
) -> Result<Retained<NSDictionary<NSString, AnyObject>>, Retained<NSError>>;
#[unsafe(method(supportsUserPresets))]
#[unsafe(method_family = none)]
pub unsafe fn supportsUserPresets(&self) -> bool;
#[unsafe(method(isLoadedInProcess))]
#[unsafe(method_family = none)]
pub unsafe fn isLoadedInProcess(&self) -> bool;
#[unsafe(method(currentPreset))]
#[unsafe(method_family = none)]
pub unsafe fn currentPreset(&self) -> Option<Retained<AUAudioUnitPreset>>;
#[unsafe(method(setCurrentPreset:))]
#[unsafe(method_family = none)]
pub unsafe fn setCurrentPreset(&self, current_preset: Option<&AUAudioUnitPreset>);
#[unsafe(method(latency))]
#[unsafe(method_family = none)]
pub unsafe fn latency(&self) -> NSTimeInterval;
#[unsafe(method(tailTime))]
#[unsafe(method_family = none)]
pub unsafe fn tailTime(&self) -> NSTimeInterval;
#[unsafe(method(renderQuality))]
#[unsafe(method_family = none)]
pub unsafe fn renderQuality(&self) -> NSInteger;
#[unsafe(method(setRenderQuality:))]
#[unsafe(method_family = none)]
pub unsafe fn setRenderQuality(&self, render_quality: NSInteger);
#[unsafe(method(shouldBypassEffect))]
#[unsafe(method_family = none)]
pub unsafe fn shouldBypassEffect(&self) -> bool;
#[unsafe(method(setShouldBypassEffect:))]
#[unsafe(method_family = none)]
pub unsafe fn setShouldBypassEffect(&self, should_bypass_effect: bool);
#[unsafe(method(canProcessInPlace))]
#[unsafe(method_family = none)]
pub unsafe fn canProcessInPlace(&self) -> bool;
#[unsafe(method(isRenderingOffline))]
#[unsafe(method_family = none)]
pub unsafe fn isRenderingOffline(&self) -> bool;
#[unsafe(method(setRenderingOffline:))]
#[unsafe(method_family = none)]
pub unsafe fn setRenderingOffline(&self, rendering_offline: bool);
#[unsafe(method(channelCapabilities))]
#[unsafe(method_family = none)]
pub unsafe fn channelCapabilities(&self) -> Option<Retained<NSArray<NSNumber>>>;
#[cfg(feature = "block2")]
#[unsafe(method(musicalContextBlock))]
#[unsafe(method_family = none)]
pub unsafe fn musicalContextBlock(&self) -> AUHostMusicalContextBlock;
#[cfg(feature = "block2")]
#[unsafe(method(setMusicalContextBlock:))]
#[unsafe(method_family = none)]
pub unsafe fn setMusicalContextBlock(
&self,
musical_context_block: AUHostMusicalContextBlock,
);
#[cfg(feature = "block2")]
#[unsafe(method(transportStateBlock))]
#[unsafe(method_family = none)]
pub unsafe fn transportStateBlock(&self) -> AUHostTransportStateBlock;
#[cfg(feature = "block2")]
#[unsafe(method(setTransportStateBlock:))]
#[unsafe(method_family = none)]
pub unsafe fn setTransportStateBlock(
&self,
transport_state_block: AUHostTransportStateBlock,
);
#[unsafe(method(contextName))]
#[unsafe(method_family = none)]
pub unsafe fn contextName(&self) -> Option<Retained<NSString>>;
#[unsafe(method(setContextName:))]
#[unsafe(method_family = none)]
pub unsafe fn setContextName(&self, context_name: Option<&NSString>);
#[unsafe(method(migrateFromPlugin))]
#[unsafe(method_family = none)]
pub unsafe fn migrateFromPlugin(&self) -> Retained<NSArray>;
#[unsafe(method(supportsMPE))]
#[unsafe(method_family = none)]
pub unsafe fn supportsMPE(&self) -> bool;
#[unsafe(method(channelMap))]
#[unsafe(method_family = none)]
pub unsafe fn channelMap(&self) -> Option<Retained<NSArray<NSNumber>>>;
#[unsafe(method(setChannelMap:))]
#[unsafe(method_family = none)]
pub unsafe fn setChannelMap(&self, channel_map: Option<&NSArray<NSNumber>>);
#[cfg(feature = "objc2-core-midi")]
#[unsafe(method(profileStateForCable:channel:))]
#[unsafe(method_family = none)]
pub unsafe fn profileStateForCable_channel(
&self,
cable: u8,
channel: MIDIChannelNumber,
) -> Retained<MIDICIProfileState>;
#[cfg(feature = "objc2-core-midi")]
#[unsafe(method(enableProfile:cable:onChannel:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn enableProfile_cable_onChannel_error(
&self,
profile: &MIDICIProfile,
cable: u8,
channel: MIDIChannelNumber,
) -> Result<(), Retained<NSError>>;
#[cfg(feature = "objc2-core-midi")]
#[unsafe(method(disableProfile:cable:onChannel:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn disableProfile_cable_onChannel_error(
&self,
profile: &MIDICIProfile,
cable: u8,
channel: MIDIChannelNumber,
) -> Result<(), Retained<NSError>>;
#[cfg(all(feature = "block2", feature = "objc2-core-midi"))]
#[unsafe(method(profileChangedBlock))]
#[unsafe(method_family = none)]
pub unsafe fn profileChangedBlock(&self) -> AUMIDICIProfileChangedBlock;
#[cfg(all(feature = "block2", feature = "objc2-core-midi"))]
#[unsafe(method(setProfileChangedBlock:))]
#[unsafe(method_family = none)]
pub unsafe fn setProfileChangedBlock(
&self,
profile_changed_block: AUMIDICIProfileChangedBlock,
);
#[unsafe(method(messageChannelFor:))]
#[unsafe(method_family = none)]
pub unsafe fn messageChannelFor(
&self,
channel_name: &NSString,
) -> Retained<ProtocolObject<dyn AUMessageChannel>>;
);
}
impl AUAudioUnit {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
#[cfg(all(
feature = "AUComponent",
feature = "block2",
feature = "objc2-core-audio-types"
))]
pub type AUInputHandler = *mut block2::DynBlock<
dyn Fn(
NonNull<AudioUnitRenderActionFlags>,
NonNull<AudioTimeStamp>,
AUAudioFrameCount,
NSInteger,
),
>;
impl AUAudioUnit {
extern_methods!(
#[unsafe(method(canPerformInput))]
#[unsafe(method_family = none)]
pub unsafe fn canPerformInput(&self) -> bool;
#[unsafe(method(canPerformOutput))]
#[unsafe(method_family = none)]
pub unsafe fn canPerformOutput(&self) -> bool;
#[unsafe(method(isInputEnabled))]
#[unsafe(method_family = none)]
pub unsafe fn isInputEnabled(&self) -> bool;
#[unsafe(method(setInputEnabled:))]
#[unsafe(method_family = none)]
pub unsafe fn setInputEnabled(&self, input_enabled: bool);
#[unsafe(method(isOutputEnabled))]
#[unsafe(method_family = none)]
pub unsafe fn isOutputEnabled(&self) -> bool;
#[unsafe(method(setOutputEnabled:))]
#[unsafe(method_family = none)]
pub unsafe fn setOutputEnabled(&self, output_enabled: bool);
#[cfg(all(
feature = "AUComponent",
feature = "block2",
feature = "objc2-core-audio-types"
))]
#[unsafe(method(outputProvider))]
#[unsafe(method_family = none)]
pub unsafe fn outputProvider(&self) -> AURenderPullInputBlock;
#[cfg(all(
feature = "AUComponent",
feature = "block2",
feature = "objc2-core-audio-types"
))]
#[unsafe(method(setOutputProvider:))]
#[unsafe(method_family = none)]
pub unsafe fn setOutputProvider(&self, output_provider: AURenderPullInputBlock);
#[cfg(all(
feature = "AUComponent",
feature = "block2",
feature = "objc2-core-audio-types"
))]
#[unsafe(method(inputHandler))]
#[unsafe(method_family = none)]
pub unsafe fn inputHandler(&self) -> AUInputHandler;
#[cfg(all(
feature = "AUComponent",
feature = "block2",
feature = "objc2-core-audio-types"
))]
#[unsafe(method(setInputHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn setInputHandler(&self, input_handler: AUInputHandler);
#[unsafe(method(deviceID))]
#[unsafe(method_family = none)]
pub unsafe fn deviceID(&self) -> AUAudioObjectID;
#[unsafe(method(setDeviceID:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn setDeviceID_error(
&self,
device_id: AUAudioObjectID,
) -> Result<(), Retained<NSError>>;
#[unsafe(method(deviceInputLatency))]
#[unsafe(method_family = none)]
pub unsafe fn deviceInputLatency(&self) -> NSTimeInterval;
#[unsafe(method(deviceOutputLatency))]
#[unsafe(method_family = none)]
pub unsafe fn deviceOutputLatency(&self) -> NSTimeInterval;
#[unsafe(method(isRunning))]
#[unsafe(method_family = none)]
pub unsafe fn isRunning(&self) -> bool;
#[unsafe(method(startHardwareAndReturnError:_))]
#[unsafe(method_family = none)]
pub unsafe fn startHardwareAndReturnError(&self) -> Result<(), Retained<NSError>>;
#[unsafe(method(stopHardware))]
#[unsafe(method_family = none)]
pub unsafe fn stopHardware(&self);
);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct AUAudioUnitBusArray;
);
extern_conformance!(
unsafe impl NSFastEnumeration for AUAudioUnitBusArray {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for AUAudioUnitBusArray {}
);
impl AUAudioUnitBusArray {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(initWithAudioUnit:busType:busses:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithAudioUnit_busType_busses(
this: Allocated<Self>,
owner: &AUAudioUnit,
bus_type: AUAudioUnitBusType,
bus_array: &NSArray<AUAudioUnitBus>,
) -> Retained<Self>;
#[unsafe(method(initWithAudioUnit:busType:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithAudioUnit_busType(
this: Allocated<Self>,
owner: &AUAudioUnit,
bus_type: AUAudioUnitBusType,
) -> Retained<Self>;
#[unsafe(method(count))]
#[unsafe(method_family = none)]
pub unsafe fn count(&self) -> NSUInteger;
#[unsafe(method(objectAtIndexedSubscript:))]
#[unsafe(method_family = none)]
pub unsafe fn objectAtIndexedSubscript(
&self,
index: NSUInteger,
) -> Retained<AUAudioUnitBus>;
#[unsafe(method(isCountChangeable))]
#[unsafe(method_family = none)]
pub unsafe fn isCountChangeable(&self) -> bool;
#[unsafe(method(setBusCount:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn setBusCount_error(&self, count: NSUInteger) -> Result<(), Retained<NSError>>;
#[unsafe(method(addObserverToAllBusses:forKeyPath:options:context:))]
#[unsafe(method_family = none)]
pub unsafe fn addObserverToAllBusses_forKeyPath_options_context(
&self,
observer: &NSObject,
key_path: &NSString,
options: NSKeyValueObservingOptions,
context: *mut c_void,
);
#[unsafe(method(removeObserverFromAllBusses:forKeyPath:context:))]
#[unsafe(method_family = none)]
pub unsafe fn removeObserverFromAllBusses_forKeyPath_context(
&self,
observer: &NSObject,
key_path: &NSString,
context: *mut c_void,
);
#[unsafe(method(ownerAudioUnit))]
#[unsafe(method_family = none)]
pub unsafe fn ownerAudioUnit(&self) -> Retained<AUAudioUnit>;
#[unsafe(method(busType))]
#[unsafe(method_family = none)]
pub unsafe fn busType(&self) -> AUAudioUnitBusType;
);
}
impl AUAudioUnitBusArray {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct AUAudioUnitBus;
);
extern_conformance!(
unsafe impl NSObjectProtocol for AUAudioUnitBus {}
);
impl AUAudioUnitBus {
extern_methods!(
#[unsafe(method(shouldAllocateBuffer))]
#[unsafe(method_family = none)]
pub unsafe fn shouldAllocateBuffer(&self) -> bool;
#[unsafe(method(setShouldAllocateBuffer:))]
#[unsafe(method_family = none)]
pub unsafe fn setShouldAllocateBuffer(&self, should_allocate_buffer: bool);
#[unsafe(method(isEnabled))]
#[unsafe(method_family = none)]
pub unsafe fn isEnabled(&self) -> bool;
#[unsafe(method(setEnabled:))]
#[unsafe(method_family = none)]
pub unsafe fn setEnabled(&self, enabled: bool);
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub unsafe fn name(&self) -> Option<Retained<NSString>>;
#[unsafe(method(setName:))]
#[unsafe(method_family = none)]
pub unsafe fn setName(&self, name: Option<&NSString>);
#[unsafe(method(index))]
#[unsafe(method_family = none)]
pub unsafe fn index(&self) -> NSUInteger;
#[unsafe(method(busType))]
#[unsafe(method_family = none)]
pub unsafe fn busType(&self) -> AUAudioUnitBusType;
#[unsafe(method(ownerAudioUnit))]
#[unsafe(method_family = none)]
pub unsafe fn ownerAudioUnit(&self) -> Retained<AUAudioUnit>;
#[unsafe(method(supportedChannelLayoutTags))]
#[unsafe(method_family = none)]
pub unsafe fn supportedChannelLayoutTags(&self) -> Option<Retained<NSArray<NSNumber>>>;
#[unsafe(method(contextPresentationLatency))]
#[unsafe(method_family = none)]
pub unsafe fn contextPresentationLatency(&self) -> NSTimeInterval;
#[unsafe(method(setContextPresentationLatency:))]
#[unsafe(method_family = none)]
pub unsafe fn setContextPresentationLatency(
&self,
context_presentation_latency: NSTimeInterval,
);
);
}
impl AUAudioUnitBus {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct AUAudioUnitPreset;
);
extern_conformance!(
unsafe impl NSCoding for AUAudioUnitPreset {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for AUAudioUnitPreset {}
);
extern_conformance!(
unsafe impl NSSecureCoding for AUAudioUnitPreset {}
);
impl AUAudioUnitPreset {
extern_methods!(
#[unsafe(method(number))]
#[unsafe(method_family = none)]
pub unsafe fn number(&self) -> NSInteger;
#[unsafe(method(setNumber:))]
#[unsafe(method_family = none)]
pub unsafe fn setNumber(&self, number: NSInteger);
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub unsafe fn name(&self) -> Retained<NSString>;
#[unsafe(method(setName:))]
#[unsafe(method_family = none)]
pub unsafe fn setName(&self, name: &NSString);
);
}
impl AUAudioUnitPreset {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
#[cfg(feature = "block2")]
pub type CallHostBlock =
*mut block2::DynBlock<dyn Fn(NonNull<NSDictionary>) -> NonNull<NSDictionary>>;
extern_protocol!(
pub unsafe trait AUMessageChannel {
#[optional]
#[unsafe(method(callAudioUnit:))]
#[unsafe(method_family = none)]
unsafe fn callAudioUnit(&self, message: &NSDictionary) -> Retained<NSDictionary>;
#[cfg(feature = "block2")]
#[optional]
#[unsafe(method(callHostBlock))]
#[unsafe(method_family = none)]
unsafe fn callHostBlock(&self) -> CallHostBlock;
#[cfg(feature = "block2")]
#[optional]
#[unsafe(method(setCallHostBlock:))]
#[unsafe(method_family = none)]
unsafe fn setCallHostBlock(&self, call_host_block: CallHostBlock);
}
);
impl AUAudioUnit {
extern_methods!();
}