//! 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 objc2_foundation::*;

use crate::*;

extern_class!(
    /// an AVAudioUnitEffect that implements a delay effect
    ///
    /// A delay unit delays the input signal by the specified time interval
    /// and then blends it with the input signal. The amount of high frequency
    /// roll-off can also be controlled in order to simulate the effect of
    /// a tape delay.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounitdelay?language=objc)
    #[unsafe(super(AVAudioUnitEffect, AVAudioUnit, AVAudioNode, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(
        feature = "AVAudioNode",
        feature = "AVAudioUnit",
        feature = "AVAudioUnitEffect"
    ))]
    pub struct AVAudioUnitDelay;
);

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

#[cfg(all(
    feature = "AVAudioNode",
    feature = "AVAudioUnit",
    feature = "AVAudioUnitEffect"
))]
impl AVAudioUnitDelay {
    extern_methods!(
        /// Time taken by the delayed input signal to reach the output
        ///
        /// Range:      0 -> 2
        /// Default:    1
        /// Unit:       Seconds
        #[unsafe(method(delayTime))]
        #[unsafe(method_family = none)]
        pub unsafe fn delayTime(&self) -> NSTimeInterval;

        /// Setter for [`delayTime`][Self::delayTime].
        #[unsafe(method(setDelayTime:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDelayTime(&self, delay_time: NSTimeInterval);

        /// Amount of the output signal fed back into the delay line
        /// Range:      -100 -> 100
        /// Default:    50
        /// Unit:       Percent
        #[unsafe(method(feedback))]
        #[unsafe(method_family = none)]
        pub unsafe fn feedback(&self) -> c_float;

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

        /// Cutoff frequency above which high frequency content is rolled off
        /// Range:      10 -> (samplerate/2)
        /// Default:    15000
        /// Unit:       Hertz
        #[unsafe(method(lowPassCutoff))]
        #[unsafe(method_family = none)]
        pub unsafe fn lowPassCutoff(&self) -> c_float;

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

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