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::*;

extern_class!(
    /// an AVAudioUnit that generates audio output
    ///
    /// An AVAudioUnitGenerator represents an audio unit of type kAudioUnitType_Generator or
    /// kAudioUnitType_RemoteGenerator.
    /// A generator will have no audio input, but will just produce audio output.
    /// A tone generator is an example of this.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounitgenerator?language=objc)
    #[unsafe(super(AVAudioUnit, AVAudioNode, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "AVAudioNode", feature = "AVAudioUnit"))]
    pub struct AVAudioUnitGenerator;
);

#[cfg(all(
    feature = "AVAudioMixing",
    feature = "AVAudioNode",
    feature = "AVAudioUnit"
))]
extern_conformance!(
    unsafe impl AVAudio3DMixing for AVAudioUnitGenerator {}
);

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

#[cfg(all(
    feature = "AVAudioMixing",
    feature = "AVAudioNode",
    feature = "AVAudioUnit"
))]
extern_conformance!(
    unsafe impl AVAudioStereoMixing for AVAudioUnitGenerator {}
);

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

#[cfg(all(feature = "AVAudioNode", feature = "AVAudioUnit"))]
impl AVAudioUnitGenerator {
    extern_methods!(
        #[cfg(feature = "objc2-audio-toolbox")]
        #[cfg(not(target_os = "watchos"))]
        /// Create an AVAudioUnitGenerator object.
        ///
        ///
        /// Parameter `audioComponentDescription`: AudioComponentDescription of the audio unit to be instantiated.
        ///
        /// The componentType must be kAudioUnitType_Generator or kAudioUnitType_RemoteGenerator
        #[unsafe(method(initWithAudioComponentDescription:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithAudioComponentDescription(
            this: Allocated<Self>,
            audio_component_description: AudioComponentDescription,
        ) -> Retained<Self>;

        /// Bypass state of the audio unit.
        #[unsafe(method(bypass))]
        #[unsafe(method_family = none)]
        pub unsafe fn bypass(&self) -> bool;

        /// Setter for [`bypass`][Self::bypass].
        #[unsafe(method(setBypass:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setBypass(&self, bypass: bool);
    );
}

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