use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use crate::*;
extern_protocol!(
pub unsafe trait AVAudioMixing: AVAudioStereoMixing + AVAudio3DMixing {
#[cfg(all(feature = "AVAudioNode", feature = "AVAudioTypes"))]
#[unsafe(method(destinationForMixer:bus:))]
#[unsafe(method_family = none)]
unsafe fn destinationForMixer_bus(
&self,
mixer: &AVAudioNode,
bus: AVAudioNodeBus,
) -> Option<Retained<AVAudioMixingDestination>>;
#[unsafe(method(volume))]
#[unsafe(method_family = none)]
unsafe fn volume(&self) -> c_float;
#[unsafe(method(setVolume:))]
#[unsafe(method_family = none)]
unsafe fn setVolume(&self, volume: c_float);
}
);
extern_protocol!(
pub unsafe trait AVAudioStereoMixing: NSObjectProtocol {
#[unsafe(method(pan))]
#[unsafe(method_family = none)]
unsafe fn pan(&self) -> c_float;
#[unsafe(method(setPan:))]
#[unsafe(method_family = none)]
unsafe fn setPan(&self, pan: c_float);
}
);
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVAudio3DMixingRenderingAlgorithm(pub NSInteger);
impl AVAudio3DMixingRenderingAlgorithm {
#[doc(alias = "AVAudio3DMixingRenderingAlgorithmEqualPowerPanning")]
pub const EqualPowerPanning: Self = Self(0);
#[doc(alias = "AVAudio3DMixingRenderingAlgorithmSphericalHead")]
pub const SphericalHead: Self = Self(1);
#[doc(alias = "AVAudio3DMixingRenderingAlgorithmHRTF")]
pub const HRTF: Self = Self(2);
#[doc(alias = "AVAudio3DMixingRenderingAlgorithmSoundField")]
pub const SoundField: Self = Self(3);
#[doc(alias = "AVAudio3DMixingRenderingAlgorithmStereoPassThrough")]
pub const StereoPassThrough: Self = Self(5);
#[doc(alias = "AVAudio3DMixingRenderingAlgorithmHRTFHQ")]
pub const HRTFHQ: Self = Self(6);
#[doc(alias = "AVAudio3DMixingRenderingAlgorithmAuto")]
pub const Auto: Self = Self(7);
}
unsafe impl Encode for AVAudio3DMixingRenderingAlgorithm {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for AVAudio3DMixingRenderingAlgorithm {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVAudio3DMixingSourceMode(pub NSInteger);
impl AVAudio3DMixingSourceMode {
#[doc(alias = "AVAudio3DMixingSourceModeSpatializeIfMono")]
pub const SpatializeIfMono: Self = Self(0);
#[doc(alias = "AVAudio3DMixingSourceModeBypass")]
pub const Bypass: Self = Self(1);
#[doc(alias = "AVAudio3DMixingSourceModePointSource")]
pub const PointSource: Self = Self(2);
#[doc(alias = "AVAudio3DMixingSourceModeAmbienceBed")]
pub const AmbienceBed: Self = Self(3);
}
unsafe impl Encode for AVAudio3DMixingSourceMode {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for AVAudio3DMixingSourceMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVAudio3DMixingPointSourceInHeadMode(pub NSInteger);
impl AVAudio3DMixingPointSourceInHeadMode {
#[doc(alias = "AVAudio3DMixingPointSourceInHeadModeMono")]
pub const Mono: Self = Self(0);
#[doc(alias = "AVAudio3DMixingPointSourceInHeadModeBypass")]
pub const Bypass: Self = Self(1);
}
unsafe impl Encode for AVAudio3DMixingPointSourceInHeadMode {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for AVAudio3DMixingPointSourceInHeadMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
pub unsafe trait AVAudio3DMixing: NSObjectProtocol {
#[unsafe(method(renderingAlgorithm))]
#[unsafe(method_family = none)]
unsafe fn renderingAlgorithm(&self) -> AVAudio3DMixingRenderingAlgorithm;
#[unsafe(method(setRenderingAlgorithm:))]
#[unsafe(method_family = none)]
unsafe fn setRenderingAlgorithm(
&self,
rendering_algorithm: AVAudio3DMixingRenderingAlgorithm,
);
#[unsafe(method(sourceMode))]
#[unsafe(method_family = none)]
unsafe fn sourceMode(&self) -> AVAudio3DMixingSourceMode;
#[unsafe(method(setSourceMode:))]
#[unsafe(method_family = none)]
unsafe fn setSourceMode(&self, source_mode: AVAudio3DMixingSourceMode);
#[unsafe(method(pointSourceInHeadMode))]
#[unsafe(method_family = none)]
unsafe fn pointSourceInHeadMode(&self) -> AVAudio3DMixingPointSourceInHeadMode;
#[unsafe(method(setPointSourceInHeadMode:))]
#[unsafe(method_family = none)]
unsafe fn setPointSourceInHeadMode(
&self,
point_source_in_head_mode: AVAudio3DMixingPointSourceInHeadMode,
);
#[unsafe(method(rate))]
#[unsafe(method_family = none)]
unsafe fn rate(&self) -> c_float;
#[unsafe(method(setRate:))]
#[unsafe(method_family = none)]
unsafe fn setRate(&self, rate: c_float);
#[unsafe(method(reverbBlend))]
#[unsafe(method_family = none)]
unsafe fn reverbBlend(&self) -> c_float;
#[unsafe(method(setReverbBlend:))]
#[unsafe(method_family = none)]
unsafe fn setReverbBlend(&self, reverb_blend: c_float);
#[unsafe(method(obstruction))]
#[unsafe(method_family = none)]
unsafe fn obstruction(&self) -> c_float;
#[unsafe(method(setObstruction:))]
#[unsafe(method_family = none)]
unsafe fn setObstruction(&self, obstruction: c_float);
#[unsafe(method(occlusion))]
#[unsafe(method_family = none)]
unsafe fn occlusion(&self) -> c_float;
#[unsafe(method(setOcclusion:))]
#[unsafe(method_family = none)]
unsafe fn setOcclusion(&self, occlusion: c_float);
#[cfg(feature = "AVAudioTypes")]
#[unsafe(method(position))]
#[unsafe(method_family = none)]
unsafe fn position(&self) -> AVAudio3DPoint;
#[cfg(feature = "AVAudioTypes")]
#[unsafe(method(setPosition:))]
#[unsafe(method_family = none)]
unsafe fn setPosition(&self, position: AVAudio3DPoint);
}
);
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct AVAudioMixingDestination;
);
extern_conformance!(
unsafe impl AVAudio3DMixing for AVAudioMixingDestination {}
);
extern_conformance!(
unsafe impl AVAudioMixing for AVAudioMixingDestination {}
);
extern_conformance!(
unsafe impl AVAudioStereoMixing for AVAudioMixingDestination {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for AVAudioMixingDestination {}
);
impl AVAudioMixingDestination {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "AVAudioConnectionPoint")]
#[unsafe(method(connectionPoint))]
#[unsafe(method_family = none)]
pub unsafe fn connectionPoint(&self) -> Retained<AVAudioConnectionPoint>;
);
}
impl AVAudioMixingDestination {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}