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::*;
#[cfg(all(
feature = "AVAudioTypes",
feature = "block2",
feature = "objc2-core-audio-types"
))]
pub type AVAudioIONodeInputBlock =
*mut block2::DynBlock<dyn Fn(AVAudioFrameCount) -> *const AudioBufferList>;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVAudioVoiceProcessingSpeechActivityEvent(pub NSInteger);
impl AVAudioVoiceProcessingSpeechActivityEvent {
#[doc(alias = "AVAudioVoiceProcessingSpeechActivityStarted")]
pub const Started: Self = Self(0);
#[doc(alias = "AVAudioVoiceProcessingSpeechActivityEnded")]
pub const Ended: Self = Self(1);
}
unsafe impl Encode for AVAudioVoiceProcessingSpeechActivityEvent {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for AVAudioVoiceProcessingSpeechActivityEvent {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVAudioVoiceProcessingOtherAudioDuckingLevel(pub NSInteger);
impl AVAudioVoiceProcessingOtherAudioDuckingLevel {
#[doc(alias = "AVAudioVoiceProcessingOtherAudioDuckingLevelDefault")]
pub const Default: Self = Self(0);
#[doc(alias = "AVAudioVoiceProcessingOtherAudioDuckingLevelMin")]
pub const Min: Self = Self(10);
#[doc(alias = "AVAudioVoiceProcessingOtherAudioDuckingLevelMid")]
pub const Mid: Self = Self(20);
#[doc(alias = "AVAudioVoiceProcessingOtherAudioDuckingLevelMax")]
pub const Max: Self = Self(30);
}
unsafe impl Encode for AVAudioVoiceProcessingOtherAudioDuckingLevel {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for AVAudioVoiceProcessingOtherAudioDuckingLevel {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct AVAudioVoiceProcessingOtherAudioDuckingConfiguration {
pub enableAdvancedDucking: Bool,
pub duckingLevel: AVAudioVoiceProcessingOtherAudioDuckingLevel,
}
unsafe impl Encode for AVAudioVoiceProcessingOtherAudioDuckingConfiguration {
const ENCODING: Encoding = Encoding::Struct(
"AVAudioVoiceProcessingOtherAudioDuckingConfiguration",
&[
<Bool>::ENCODING,
<AVAudioVoiceProcessingOtherAudioDuckingLevel>::ENCODING,
],
);
}
unsafe impl RefEncode for AVAudioVoiceProcessingOtherAudioDuckingConfiguration {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(AVAudioNode, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "AVAudioNode")]
pub struct AVAudioIONode;
);
#[cfg(feature = "AVAudioNode")]
extern_conformance!(
unsafe impl NSObjectProtocol for AVAudioIONode {}
);
#[cfg(feature = "AVAudioNode")]
impl AVAudioIONode {
extern_methods!(
#[unsafe(method(presentationLatency))]
#[unsafe(method_family = none)]
pub unsafe fn presentationLatency(&self) -> NSTimeInterval;
#[cfg(feature = "objc2-audio-toolbox")]
#[cfg(not(target_os = "watchos"))]
#[unsafe(method(audioUnit))]
#[unsafe(method_family = none)]
pub unsafe fn audioUnit(&self) -> AudioUnit;
#[unsafe(method(isVoiceProcessingEnabled))]
#[unsafe(method_family = none)]
pub unsafe fn isVoiceProcessingEnabled(&self) -> bool;
#[unsafe(method(setVoiceProcessingEnabled:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn setVoiceProcessingEnabled_error(
&self,
enabled: bool,
) -> Result<(), Retained<NSError>>;
);
}
#[cfg(feature = "AVAudioNode")]
impl AVAudioIONode {
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(AVAudioIONode, AVAudioNode, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "AVAudioNode")]
pub struct AVAudioInputNode;
);
#[cfg(all(feature = "AVAudioMixing", feature = "AVAudioNode"))]
extern_conformance!(
unsafe impl AVAudio3DMixing for AVAudioInputNode {}
);
#[cfg(all(feature = "AVAudioMixing", feature = "AVAudioNode"))]
extern_conformance!(
unsafe impl AVAudioMixing for AVAudioInputNode {}
);
#[cfg(all(feature = "AVAudioMixing", feature = "AVAudioNode"))]
extern_conformance!(
unsafe impl AVAudioStereoMixing for AVAudioInputNode {}
);
#[cfg(feature = "AVAudioNode")]
extern_conformance!(
unsafe impl NSObjectProtocol for AVAudioInputNode {}
);
#[cfg(feature = "AVAudioNode")]
impl AVAudioInputNode {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(all(
feature = "AVAudioFormat",
feature = "AVAudioTypes",
feature = "block2",
feature = "objc2-core-audio-types"
))]
#[unsafe(method(setManualRenderingInputPCMFormat:inputBlock:))]
#[unsafe(method_family = none)]
pub unsafe fn setManualRenderingInputPCMFormat_inputBlock(
&self,
format: &AVAudioFormat,
block: AVAudioIONodeInputBlock,
) -> bool;
#[unsafe(method(isVoiceProcessingBypassed))]
#[unsafe(method_family = none)]
pub unsafe fn isVoiceProcessingBypassed(&self) -> bool;
#[unsafe(method(setVoiceProcessingBypassed:))]
#[unsafe(method_family = none)]
pub unsafe fn setVoiceProcessingBypassed(&self, voice_processing_bypassed: bool);
#[unsafe(method(isVoiceProcessingAGCEnabled))]
#[unsafe(method_family = none)]
pub unsafe fn isVoiceProcessingAGCEnabled(&self) -> bool;
#[unsafe(method(setVoiceProcessingAGCEnabled:))]
#[unsafe(method_family = none)]
pub unsafe fn setVoiceProcessingAGCEnabled(&self, voice_processing_agc_enabled: bool);
#[unsafe(method(isVoiceProcessingInputMuted))]
#[unsafe(method_family = none)]
pub unsafe fn isVoiceProcessingInputMuted(&self) -> bool;
#[unsafe(method(setVoiceProcessingInputMuted:))]
#[unsafe(method_family = none)]
pub unsafe fn setVoiceProcessingInputMuted(&self, voice_processing_input_muted: bool);
#[cfg(feature = "block2")]
#[unsafe(method(setMutedSpeechActivityEventListener:))]
#[unsafe(method_family = none)]
pub unsafe fn setMutedSpeechActivityEventListener(
&self,
listener_block: Option<
&block2::DynBlock<dyn Fn(AVAudioVoiceProcessingSpeechActivityEvent)>,
>,
) -> bool;
#[unsafe(method(voiceProcessingOtherAudioDuckingConfiguration))]
#[unsafe(method_family = none)]
pub unsafe fn voiceProcessingOtherAudioDuckingConfiguration(
&self,
) -> AVAudioVoiceProcessingOtherAudioDuckingConfiguration;
#[unsafe(method(setVoiceProcessingOtherAudioDuckingConfiguration:))]
#[unsafe(method_family = none)]
pub unsafe fn setVoiceProcessingOtherAudioDuckingConfiguration(
&self,
voice_processing_other_audio_ducking_configuration: AVAudioVoiceProcessingOtherAudioDuckingConfiguration,
);
);
}
#[cfg(feature = "AVAudioNode")]
impl AVAudioInputNode {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
#[unsafe(super(AVAudioIONode, AVAudioNode, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "AVAudioNode")]
pub struct AVAudioOutputNode;
);
#[cfg(feature = "AVAudioNode")]
extern_conformance!(
unsafe impl NSObjectProtocol for AVAudioOutputNode {}
);
#[cfg(feature = "AVAudioNode")]
impl AVAudioOutputNode {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
#[cfg(feature = "AVAudioNode")]
impl AVAudioOutputNode {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}