use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-audio-toolbox")]
#[cfg(not(target_os = "watchos"))]
use objc2_audio_toolbox::*;
#[cfg(feature = "objc2-core-audio-types")]
use objc2_core_audio_types::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVAudioEngineManualRenderingError(pub OSStatus);
impl AVAudioEngineManualRenderingError {
#[doc(alias = "AVAudioEngineManualRenderingErrorInvalidMode")]
pub const InvalidMode: Self = Self(-80800);
#[doc(alias = "AVAudioEngineManualRenderingErrorInitialized")]
pub const Initialized: Self = Self(-80801);
#[doc(alias = "AVAudioEngineManualRenderingErrorNotRunning")]
pub const NotRunning: Self = Self(-80802);
}
unsafe impl Encode for AVAudioEngineManualRenderingError {
const ENCODING: Encoding = OSStatus::ENCODING;
}
unsafe impl RefEncode for AVAudioEngineManualRenderingError {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVAudioEngineManualRenderingStatus(pub NSInteger);
impl AVAudioEngineManualRenderingStatus {
#[doc(alias = "AVAudioEngineManualRenderingStatusError")]
pub const Error: Self = Self(-1);
#[doc(alias = "AVAudioEngineManualRenderingStatusSuccess")]
pub const Success: Self = Self(0);
#[doc(alias = "AVAudioEngineManualRenderingStatusInsufficientDataFromInputNode")]
pub const InsufficientDataFromInputNode: Self = Self(1);
#[doc(alias = "AVAudioEngineManualRenderingStatusCannotDoInCurrentContext")]
pub const CannotDoInCurrentContext: Self = Self(2);
}
unsafe impl Encode for AVAudioEngineManualRenderingStatus {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for AVAudioEngineManualRenderingStatus {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVAudioEngineManualRenderingMode(pub NSInteger);
impl AVAudioEngineManualRenderingMode {
#[doc(alias = "AVAudioEngineManualRenderingModeOffline")]
pub const Offline: Self = Self(0);
#[doc(alias = "AVAudioEngineManualRenderingModeRealtime")]
pub const Realtime: Self = Self(1);
}
unsafe impl Encode for AVAudioEngineManualRenderingMode {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for AVAudioEngineManualRenderingMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[cfg(all(
feature = "AVAudioTypes",
feature = "block2",
feature = "objc2-core-audio-types"
))]
pub type AVAudioEngineManualRenderingBlock = *mut block2::DynBlock<
dyn Fn(
AVAudioFrameCount,
NonNull<AudioBufferList>,
*mut OSStatus,
) -> AVAudioEngineManualRenderingStatus,
>;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct AVAudioEngine;
);
extern_conformance!(
unsafe impl NSObjectProtocol for AVAudioEngine {}
);
impl AVAudioEngine {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "AVAudioNode")]
#[unsafe(method(attachNode:))]
#[unsafe(method_family = none)]
pub unsafe fn attachNode(&self, node: &AVAudioNode);
#[cfg(feature = "AVAudioNode")]
#[unsafe(method(detachNode:))]
#[unsafe(method_family = none)]
pub unsafe fn detachNode(&self, node: &AVAudioNode);
#[cfg(all(
feature = "AVAudioFormat",
feature = "AVAudioNode",
feature = "AVAudioTypes"
))]
#[unsafe(method(connect:to:fromBus:toBus:format:))]
#[unsafe(method_family = none)]
pub unsafe fn connect_to_fromBus_toBus_format(
&self,
node1: &AVAudioNode,
node2: &AVAudioNode,
bus1: AVAudioNodeBus,
bus2: AVAudioNodeBus,
format: Option<&AVAudioFormat>,
);
#[cfg(all(feature = "AVAudioFormat", feature = "AVAudioNode"))]
#[unsafe(method(connect:to:format:))]
#[unsafe(method_family = none)]
pub unsafe fn connect_to_format(
&self,
node1: &AVAudioNode,
node2: &AVAudioNode,
format: Option<&AVAudioFormat>,
);
#[cfg(all(
feature = "AVAudioConnectionPoint",
feature = "AVAudioFormat",
feature = "AVAudioNode",
feature = "AVAudioTypes"
))]
#[unsafe(method(connect:toConnectionPoints:fromBus:format:))]
#[unsafe(method_family = none)]
pub unsafe fn connect_toConnectionPoints_fromBus_format(
&self,
source_node: &AVAudioNode,
dest_nodes: &NSArray<AVAudioConnectionPoint>,
source_bus: AVAudioNodeBus,
format: Option<&AVAudioFormat>,
);
#[cfg(all(feature = "AVAudioNode", feature = "AVAudioTypes"))]
#[unsafe(method(disconnectNodeInput:bus:))]
#[unsafe(method_family = none)]
pub unsafe fn disconnectNodeInput_bus(&self, node: &AVAudioNode, bus: AVAudioNodeBus);
#[cfg(feature = "AVAudioNode")]
#[unsafe(method(disconnectNodeInput:))]
#[unsafe(method_family = none)]
pub unsafe fn disconnectNodeInput(&self, node: &AVAudioNode);
#[cfg(all(feature = "AVAudioNode", feature = "AVAudioTypes"))]
#[unsafe(method(disconnectNodeOutput:bus:))]
#[unsafe(method_family = none)]
pub unsafe fn disconnectNodeOutput_bus(&self, node: &AVAudioNode, bus: AVAudioNodeBus);
#[cfg(feature = "AVAudioNode")]
#[unsafe(method(disconnectNodeOutput:))]
#[unsafe(method_family = none)]
pub unsafe fn disconnectNodeOutput(&self, node: &AVAudioNode);
#[unsafe(method(prepare))]
#[unsafe(method_family = none)]
pub unsafe fn prepare(&self);
#[unsafe(method(startAndReturnError:_))]
#[unsafe(method_family = none)]
pub unsafe fn startAndReturnError(&self) -> Result<(), Retained<NSError>>;
#[unsafe(method(pause))]
#[unsafe(method_family = none)]
pub unsafe fn pause(&self);
#[unsafe(method(reset))]
#[unsafe(method_family = none)]
pub unsafe fn reset(&self);
#[unsafe(method(stop))]
#[unsafe(method_family = none)]
pub unsafe fn stop(&self);
#[cfg(all(
feature = "AVAudioConnectionPoint",
feature = "AVAudioNode",
feature = "AVAudioTypes"
))]
#[unsafe(method(inputConnectionPointForNode:inputBus:))]
#[unsafe(method_family = none)]
pub unsafe fn inputConnectionPointForNode_inputBus(
&self,
node: &AVAudioNode,
bus: AVAudioNodeBus,
) -> Option<Retained<AVAudioConnectionPoint>>;
#[cfg(all(
feature = "AVAudioConnectionPoint",
feature = "AVAudioNode",
feature = "AVAudioTypes"
))]
#[unsafe(method(outputConnectionPointsForNode:outputBus:))]
#[unsafe(method_family = none)]
pub unsafe fn outputConnectionPointsForNode_outputBus(
&self,
node: &AVAudioNode,
bus: AVAudioNodeBus,
) -> Retained<NSArray<AVAudioConnectionPoint>>;
#[cfg(feature = "objc2-audio-toolbox")]
#[cfg(not(target_os = "watchos"))]
#[unsafe(method(musicSequence))]
#[unsafe(method_family = none)]
pub unsafe fn musicSequence(&self) -> MusicSequence;
#[cfg(feature = "objc2-audio-toolbox")]
#[cfg(not(target_os = "watchos"))]
#[unsafe(method(setMusicSequence:))]
#[unsafe(method_family = none)]
pub unsafe fn setMusicSequence(&self, music_sequence: MusicSequence);
#[cfg(all(feature = "AVAudioIONode", feature = "AVAudioNode"))]
#[unsafe(method(outputNode))]
#[unsafe(method_family = none)]
pub unsafe fn outputNode(&self) -> Retained<AVAudioOutputNode>;
#[cfg(all(feature = "AVAudioIONode", feature = "AVAudioNode"))]
#[unsafe(method(inputNode))]
#[unsafe(method_family = none)]
pub unsafe fn inputNode(&self) -> Retained<AVAudioInputNode>;
#[cfg(all(feature = "AVAudioMixerNode", feature = "AVAudioNode"))]
#[unsafe(method(mainMixerNode))]
#[unsafe(method_family = none)]
pub unsafe fn mainMixerNode(&self) -> Retained<AVAudioMixerNode>;
#[unsafe(method(isRunning))]
#[unsafe(method_family = none)]
pub unsafe fn isRunning(&self) -> bool;
#[unsafe(method(isAutoShutdownEnabled))]
#[unsafe(method_family = none)]
pub unsafe fn isAutoShutdownEnabled(&self) -> bool;
#[unsafe(method(setAutoShutdownEnabled:))]
#[unsafe(method_family = none)]
pub unsafe fn setAutoShutdownEnabled(&self, auto_shutdown_enabled: bool);
#[cfg(feature = "AVAudioNode")]
#[unsafe(method(attachedNodes))]
#[unsafe(method_family = none)]
pub unsafe fn attachedNodes(&self) -> Retained<NSSet<AVAudioNode>>;
#[cfg(all(feature = "AVAudioFormat", feature = "AVAudioTypes"))]
#[unsafe(method(enableManualRenderingMode:format:maximumFrameCount:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn enableManualRenderingMode_format_maximumFrameCount_error(
&self,
mode: AVAudioEngineManualRenderingMode,
pcm_format: &AVAudioFormat,
maximum_frame_count: AVAudioFrameCount,
) -> Result<(), Retained<NSError>>;
#[unsafe(method(disableManualRenderingMode))]
#[unsafe(method_family = none)]
pub unsafe fn disableManualRenderingMode(&self);
#[cfg(all(
feature = "AVAudioTypes",
feature = "block2",
feature = "objc2-core-audio-types"
))]
#[unsafe(method(manualRenderingBlock))]
#[unsafe(method_family = none)]
pub unsafe fn manualRenderingBlock(&self) -> AVAudioEngineManualRenderingBlock;
#[unsafe(method(isInManualRenderingMode))]
#[unsafe(method_family = none)]
pub unsafe fn isInManualRenderingMode(&self) -> bool;
#[unsafe(method(manualRenderingMode))]
#[unsafe(method_family = none)]
pub unsafe fn manualRenderingMode(&self) -> AVAudioEngineManualRenderingMode;
#[cfg(feature = "AVAudioFormat")]
#[unsafe(method(manualRenderingFormat))]
#[unsafe(method_family = none)]
pub unsafe fn manualRenderingFormat(&self) -> Retained<AVAudioFormat>;
#[cfg(feature = "AVAudioTypes")]
#[unsafe(method(manualRenderingMaximumFrameCount))]
#[unsafe(method_family = none)]
pub unsafe fn manualRenderingMaximumFrameCount(&self) -> AVAudioFrameCount;
#[cfg(feature = "AVAudioTypes")]
#[unsafe(method(manualRenderingSampleTime))]
#[unsafe(method_family = none)]
pub unsafe fn manualRenderingSampleTime(&self) -> AVAudioFramePosition;
#[cfg(all(
feature = "AVAudioFormat",
feature = "AVAudioNode",
feature = "objc2-audio-toolbox"
))]
#[cfg(not(target_os = "watchos"))]
#[deprecated]
#[unsafe(method(connectMIDI:to:format:block:))]
#[unsafe(method_family = none)]
pub unsafe fn connectMIDI_to_format_block(
&self,
source_node: &AVAudioNode,
destination_node: &AVAudioNode,
format: Option<&AVAudioFormat>,
tap_block: AUMIDIOutputEventBlock,
);
#[cfg(all(
feature = "AVAudioFormat",
feature = "AVAudioNode",
feature = "objc2-audio-toolbox"
))]
#[cfg(not(target_os = "watchos"))]
#[deprecated]
#[unsafe(method(connectMIDI:toNodes:format:block:))]
#[unsafe(method_family = none)]
pub unsafe fn connectMIDI_toNodes_format_block(
&self,
source_node: &AVAudioNode,
destination_nodes: &NSArray<AVAudioNode>,
format: Option<&AVAudioFormat>,
tap_block: AUMIDIOutputEventBlock,
);
#[cfg(feature = "AVAudioNode")]
#[unsafe(method(disconnectMIDI:from:))]
#[unsafe(method_family = none)]
pub unsafe fn disconnectMIDI_from(
&self,
source_node: &AVAudioNode,
destination_node: &AVAudioNode,
);
#[cfg(feature = "AVAudioNode")]
#[unsafe(method(disconnectMIDI:fromNodes:))]
#[unsafe(method_family = none)]
pub unsafe fn disconnectMIDI_fromNodes(
&self,
source_node: &AVAudioNode,
destination_nodes: &NSArray<AVAudioNode>,
);
#[cfg(feature = "AVAudioNode")]
#[unsafe(method(disconnectMIDIInput:))]
#[unsafe(method_family = none)]
pub unsafe fn disconnectMIDIInput(&self, node: &AVAudioNode);
#[cfg(feature = "AVAudioNode")]
#[unsafe(method(disconnectMIDIOutput:))]
#[unsafe(method_family = none)]
pub unsafe fn disconnectMIDIOutput(&self, node: &AVAudioNode);
);
}
impl AVAudioEngine {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern "C" {
pub static AVAudioEngineConfigurationChangeNotification: &'static NSString;
}