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/avaudiounitdistortionpreset?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVAudioUnitDistortionPreset(pub NSInteger);
impl AVAudioUnitDistortionPreset {
    #[doc(alias = "AVAudioUnitDistortionPresetDrumsBitBrush")]
    pub const DrumsBitBrush: Self = Self(0);
    #[doc(alias = "AVAudioUnitDistortionPresetDrumsBufferBeats")]
    pub const DrumsBufferBeats: Self = Self(1);
    #[doc(alias = "AVAudioUnitDistortionPresetDrumsLoFi")]
    pub const DrumsLoFi: Self = Self(2);
    #[doc(alias = "AVAudioUnitDistortionPresetMultiBrokenSpeaker")]
    pub const MultiBrokenSpeaker: Self = Self(3);
    #[doc(alias = "AVAudioUnitDistortionPresetMultiCellphoneConcert")]
    pub const MultiCellphoneConcert: Self = Self(4);
    #[doc(alias = "AVAudioUnitDistortionPresetMultiDecimated1")]
    pub const MultiDecimated1: Self = Self(5);
    #[doc(alias = "AVAudioUnitDistortionPresetMultiDecimated2")]
    pub const MultiDecimated2: Self = Self(6);
    #[doc(alias = "AVAudioUnitDistortionPresetMultiDecimated3")]
    pub const MultiDecimated3: Self = Self(7);
    #[doc(alias = "AVAudioUnitDistortionPresetMultiDecimated4")]
    pub const MultiDecimated4: Self = Self(8);
    #[doc(alias = "AVAudioUnitDistortionPresetMultiDistortedFunk")]
    pub const MultiDistortedFunk: Self = Self(9);
    #[doc(alias = "AVAudioUnitDistortionPresetMultiDistortedCubed")]
    pub const MultiDistortedCubed: Self = Self(10);
    #[doc(alias = "AVAudioUnitDistortionPresetMultiDistortedSquared")]
    pub const MultiDistortedSquared: Self = Self(11);
    #[doc(alias = "AVAudioUnitDistortionPresetMultiEcho1")]
    pub const MultiEcho1: Self = Self(12);
    #[doc(alias = "AVAudioUnitDistortionPresetMultiEcho2")]
    pub const MultiEcho2: Self = Self(13);
    #[doc(alias = "AVAudioUnitDistortionPresetMultiEchoTight1")]
    pub const MultiEchoTight1: Self = Self(14);
    #[doc(alias = "AVAudioUnitDistortionPresetMultiEchoTight2")]
    pub const MultiEchoTight2: Self = Self(15);
    #[doc(alias = "AVAudioUnitDistortionPresetMultiEverythingIsBroken")]
    pub const MultiEverythingIsBroken: Self = Self(16);
    #[doc(alias = "AVAudioUnitDistortionPresetSpeechAlienChatter")]
    pub const SpeechAlienChatter: Self = Self(17);
    #[doc(alias = "AVAudioUnitDistortionPresetSpeechCosmicInterference")]
    pub const SpeechCosmicInterference: Self = Self(18);
    #[doc(alias = "AVAudioUnitDistortionPresetSpeechGoldenPi")]
    pub const SpeechGoldenPi: Self = Self(19);
    #[doc(alias = "AVAudioUnitDistortionPresetSpeechRadioTower")]
    pub const SpeechRadioTower: Self = Self(20);
    #[doc(alias = "AVAudioUnitDistortionPresetSpeechWaves")]
    pub const SpeechWaves: Self = Self(21);
}

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

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

extern_class!(
    /// An AVAudioUnitEffect that implements a multi-stage distortion effect.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounitdistortion?language=objc)
    #[unsafe(super(AVAudioUnitEffect, AVAudioUnit, AVAudioNode, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(
        feature = "AVAudioNode",
        feature = "AVAudioUnit",
        feature = "AVAudioUnitEffect"
    ))]
    pub struct AVAudioUnitDistortion;
);

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

#[cfg(all(
    feature = "AVAudioNode",
    feature = "AVAudioUnit",
    feature = "AVAudioUnitEffect"
))]
impl AVAudioUnitDistortion {
    extern_methods!(
        /// Load a distortion preset.
        /// Default:    AVAudioUnitDistortionPresetDrumsBitBrush
        #[unsafe(method(loadFactoryPreset:))]
        #[unsafe(method_family = none)]
        pub unsafe fn loadFactoryPreset(&self, preset: AVAudioUnitDistortionPreset);

        /// Gain applied to the signal before being distorted
        /// Range:      -80 -> 20
        /// Default:    -6
        /// Unit:       dB
        #[unsafe(method(preGain))]
        #[unsafe(method_family = none)]
        pub unsafe fn preGain(&self) -> c_float;

        /// Setter for [`preGain`][Self::preGain].
        #[unsafe(method(setPreGain:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPreGain(&self, pre_gain: c_float);

        /// Blend of the distorted and dry signals
        /// Range:      0 (all dry) -> 100 (all distorted)
        /// Default:    50
        /// 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 AVAudioUnitDistortion {
    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 AVAudioUnitDistortion {
    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>;
    );
}