objc2-avf-audio 0.3.2

Bindings to the AVFAudio framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
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::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounitreverbpreset?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVAudioUnitReverbPreset(pub NSInteger);
impl AVAudioUnitReverbPreset {
    #[doc(alias = "AVAudioUnitReverbPresetSmallRoom")]
    pub const SmallRoom: Self = Self(0);
    #[doc(alias = "AVAudioUnitReverbPresetMediumRoom")]
    pub const MediumRoom: Self = Self(1);
    #[doc(alias = "AVAudioUnitReverbPresetLargeRoom")]
    pub const LargeRoom: Self = Self(2);
    #[doc(alias = "AVAudioUnitReverbPresetMediumHall")]
    pub const MediumHall: Self = Self(3);
    #[doc(alias = "AVAudioUnitReverbPresetLargeHall")]
    pub const LargeHall: Self = Self(4);
    #[doc(alias = "AVAudioUnitReverbPresetPlate")]
    pub const Plate: Self = Self(5);
    #[doc(alias = "AVAudioUnitReverbPresetMediumChamber")]
    pub const MediumChamber: Self = Self(6);
    #[doc(alias = "AVAudioUnitReverbPresetLargeChamber")]
    pub const LargeChamber: Self = Self(7);
    #[doc(alias = "AVAudioUnitReverbPresetCathedral")]
    pub const Cathedral: Self = Self(8);
    #[doc(alias = "AVAudioUnitReverbPresetLargeRoom2")]
    pub const LargeRoom2: Self = Self(9);
    #[doc(alias = "AVAudioUnitReverbPresetMediumHall2")]
    pub const MediumHall2: Self = Self(10);
    #[doc(alias = "AVAudioUnitReverbPresetMediumHall3")]
    pub const MediumHall3: Self = Self(11);
    #[doc(alias = "AVAudioUnitReverbPresetLargeHall2")]
    pub const LargeHall2: Self = Self(12);
}

unsafe impl Encode for AVAudioUnitReverbPreset {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVAudioUnitReverbPreset {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// an AVAudioUnitEffect that implements a reverb
    ///
    /// A reverb simulates the acoustic characteristics of a particular environment.
    /// Use the different presets to simulate a particular space and blend it in with
    /// the original signal using the wetDryMix parameter.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounitreverb?language=objc)
    #[unsafe(super(AVAudioUnitEffect, AVAudioUnit, AVAudioNode, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(
        feature = "AVAudioNode",
        feature = "AVAudioUnit",
        feature = "AVAudioUnitEffect"
    ))]
    pub struct AVAudioUnitReverb;
);

#[cfg(all(
    feature = "AVAudioNode",
    feature = "AVAudioUnit",
    feature = "AVAudioUnitEffect"
))]
extern_conformance!(
    unsafe impl NSObjectProtocol for AVAudioUnitReverb {}
);

#[cfg(all(
    feature = "AVAudioNode",
    feature = "AVAudioUnit",
    feature = "AVAudioUnitEffect"
))]
impl AVAudioUnitReverb {
    extern_methods!(
        /// load a reverb preset
        /// Default:    AVAudioUnitReverbPresetMediumHall
        #[unsafe(method(loadFactoryPreset:))]
        #[unsafe(method_family = none)]
        pub unsafe fn loadFactoryPreset(&self, preset: AVAudioUnitReverbPreset);

        /// Blend of the wet and dry signals
        /// Range:      0 (all dry) -> 100 (all wet)
        /// Unit:       Percent
        #[unsafe(method(wetDryMix))]
        #[unsafe(method_family = none)]
        pub unsafe fn wetDryMix(&self) -> c_float;

        /// Setter for [`wetDryMix`][Self::wetDryMix].
        #[unsafe(method(setWetDryMix:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setWetDryMix(&self, wet_dry_mix: c_float);
    );
}

/// Methods declared on superclass `AVAudioUnitEffect`.
#[cfg(all(
    feature = "AVAudioNode",
    feature = "AVAudioUnit",
    feature = "AVAudioUnitEffect"
))]
impl AVAudioUnitReverb {
    extern_methods!(
        #[cfg(feature = "objc2-audio-toolbox")]
        #[cfg(not(target_os = "watchos"))]
        /// Create an AVAudioUnitEffect object.
        ///
        ///
        /// Parameter `audioComponentDescription`: AudioComponentDescription of the audio unit to be instantiated.
        ///
        /// The componentType must be one of these types
        /// kAudioUnitType_Effect
        /// kAudioUnitType_MusicEffect
        /// kAudioUnitType_Panner
        /// kAudioUnitType_RemoteEffect
        /// kAudioUnitType_RemoteMusicEffect
        #[unsafe(method(initWithAudioComponentDescription:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithAudioComponentDescription(
            this: Allocated<Self>,
            audio_component_description: AudioComponentDescription,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(all(
    feature = "AVAudioNode",
    feature = "AVAudioUnit",
    feature = "AVAudioUnitEffect"
))]
impl AVAudioUnitReverb {
    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>;
    );
}