objc2-av-foundation 0.3.2

Bindings to the AVFoundation 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-core-media")]
use objc2_core_media::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-media-toolbox")]
#[cfg(not(target_os = "watchos"))]
use objc2_media_toolbox::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avaudiomix?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AVAudioMix;
);

extern_conformance!(
    unsafe impl NSCopying for AVAudioMix {}
);

unsafe impl CopyingHelper for AVAudioMix {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSMutableCopying for AVAudioMix {}
);

unsafe impl MutableCopyingHelper for AVAudioMix {
    type Result = AVMutableAudioMix;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for AVAudioMix {}
);

impl AVAudioMix {
    extern_methods!(
        #[unsafe(method(inputParameters))]
        #[unsafe(method_family = none)]
        pub unsafe fn inputParameters(&self) -> Retained<NSArray<AVAudioMixInputParameters>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl AVAudioMix {
    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>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmutableaudiomix?language=objc)
    #[unsafe(super(AVAudioMix, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AVMutableAudioMix;
);

extern_conformance!(
    unsafe impl NSCopying for AVMutableAudioMix {}
);

unsafe impl CopyingHelper for AVMutableAudioMix {
    type Result = AVAudioMix;
}

extern_conformance!(
    unsafe impl NSMutableCopying for AVMutableAudioMix {}
);

unsafe impl MutableCopyingHelper for AVMutableAudioMix {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for AVMutableAudioMix {}
);

impl AVMutableAudioMix {
    extern_methods!(
        #[unsafe(method(audioMix))]
        #[unsafe(method_family = none)]
        pub unsafe fn audioMix() -> Retained<Self>;

        /// Indicates parameters for inputs to the mix; an NSArray of instances of AVAudioMixInputParameters.
        ///
        /// Note that an instance of AVAudioMixInputParameters is not required for each audio track that contributes to the mix; audio for those without associated AVAudioMixInputParameters will be included in the mix, processed according to default behavior.
        #[unsafe(method(inputParameters))]
        #[unsafe(method_family = none)]
        pub unsafe fn inputParameters(&self) -> Retained<NSArray<AVAudioMixInputParameters>>;

        /// Setter for [`inputParameters`][Self::inputParameters].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setInputParameters:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setInputParameters(
            &self,
            input_parameters: &NSArray<AVAudioMixInputParameters>,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl AVMutableAudioMix {
    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>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avaudiomixinputparameters?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AVAudioMixInputParameters;
);

extern_conformance!(
    unsafe impl NSCopying for AVAudioMixInputParameters {}
);

unsafe impl CopyingHelper for AVAudioMixInputParameters {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSMutableCopying for AVAudioMixInputParameters {}
);

unsafe impl MutableCopyingHelper for AVAudioMixInputParameters {
    type Result = AVMutableAudioMixInputParameters;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for AVAudioMixInputParameters {}
);

impl AVAudioMixInputParameters {
    extern_methods!(
        #[cfg(feature = "objc2-core-media")]
        /// Indicates the trackID of the audio track to which the parameters should be applied.
        #[unsafe(method(trackID))]
        #[unsafe(method_family = none)]
        pub unsafe fn trackID(&self) -> CMPersistentTrackID;

        #[cfg(feature = "AVAudioProcessingSettings")]
        /// Indicates the processing algorithm used to manage audio pitch at varying rates and for scaled audio edits.
        ///
        /// Constants for various time pitch algorithms, e.g. AVAudioTimePitchSpectral, are defined in AVAudioProcessingSettings.h.
        /// Can be nil, in which case the audioTimePitchAlgorithm set on the AVPlayerItem, AVAssetExportSession, or AVAssetReaderAudioMixOutput on which the AVAudioMix is set will be used for the associated track.
        #[unsafe(method(audioTimePitchAlgorithm))]
        #[unsafe(method_family = none)]
        pub unsafe fn audioTimePitchAlgorithm(&self)
            -> Option<Retained<AVAudioTimePitchAlgorithm>>;

        #[cfg(feature = "objc2-media-toolbox")]
        #[cfg(not(target_os = "watchos"))]
        /// Indicates the audio processing tap that will be used for the audio track.
        #[unsafe(method(audioTapProcessor))]
        #[unsafe(method_family = none)]
        pub unsafe fn audioTapProcessor(&self) -> Option<Retained<MTAudioProcessingTap>>;

        #[cfg(feature = "objc2-core-media")]
        /// # Safety
        ///
        /// - `start_volume` must be a valid pointer or null.
        /// - `end_volume` must be a valid pointer or null.
        /// - `time_range` must be a valid pointer or null.
        #[unsafe(method(getVolumeRampForTime:startVolume:endVolume:timeRange:))]
        #[unsafe(method_family = none)]
        pub unsafe fn getVolumeRampForTime_startVolume_endVolume_timeRange(
            &self,
            time: CMTime,
            start_volume: *mut c_float,
            end_volume: *mut c_float,
            time_range: *mut CMTimeRange,
        ) -> bool;
    );
}

/// Methods declared on superclass `NSObject`.
impl AVAudioMixInputParameters {
    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>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmutableaudiomixinputparameters?language=objc)
    #[unsafe(super(AVAudioMixInputParameters, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AVMutableAudioMixInputParameters;
);

extern_conformance!(
    unsafe impl NSCopying for AVMutableAudioMixInputParameters {}
);

unsafe impl CopyingHelper for AVMutableAudioMixInputParameters {
    type Result = AVAudioMixInputParameters;
}

extern_conformance!(
    unsafe impl NSMutableCopying for AVMutableAudioMixInputParameters {}
);

unsafe impl MutableCopyingHelper for AVMutableAudioMixInputParameters {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for AVMutableAudioMixInputParameters {}
);

impl AVMutableAudioMixInputParameters {
    extern_methods!(
        #[cfg(feature = "AVAssetTrack")]
        #[unsafe(method(audioMixInputParametersWithTrack:))]
        #[unsafe(method_family = none)]
        pub unsafe fn audioMixInputParametersWithTrack(
            track: Option<&AVAssetTrack>,
        ) -> Retained<Self>;

        #[unsafe(method(audioMixInputParameters))]
        #[unsafe(method_family = none)]
        pub unsafe fn audioMixInputParameters() -> Retained<Self>;

        #[cfg(feature = "objc2-core-media")]
        /// Indicates the trackID of the audio track to which the parameters should be applied.
        #[unsafe(method(trackID))]
        #[unsafe(method_family = none)]
        pub unsafe fn trackID(&self) -> CMPersistentTrackID;

        #[cfg(feature = "objc2-core-media")]
        /// Setter for [`trackID`][Self::trackID].
        #[unsafe(method(setTrackID:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTrackID(&self, track_id: CMPersistentTrackID);

        #[cfg(feature = "AVAudioProcessingSettings")]
        /// Indicates the processing algorithm used to manage audio pitch at varying rates and for scaled audio edits.
        ///
        /// Constants for various time pitch algorithms, e.g. AVAudioTimePitchSpectral, are defined in AVAudioProcessingSettings.h.
        /// Can be nil, in which case the audioTimePitchAlgorithm set on the AVPlayerItem, AVAssetExportSession, or AVAssetReaderAudioMixOutput on which the AVAudioMix is set will be used for the associated track.
        #[unsafe(method(audioTimePitchAlgorithm))]
        #[unsafe(method_family = none)]
        pub unsafe fn audioTimePitchAlgorithm(&self)
            -> Option<Retained<AVAudioTimePitchAlgorithm>>;

        #[cfg(feature = "AVAudioProcessingSettings")]
        /// Setter for [`audioTimePitchAlgorithm`][Self::audioTimePitchAlgorithm].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setAudioTimePitchAlgorithm:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAudioTimePitchAlgorithm(
            &self,
            audio_time_pitch_algorithm: Option<&AVAudioTimePitchAlgorithm>,
        );

        #[cfg(feature = "objc2-media-toolbox")]
        #[cfg(not(target_os = "watchos"))]
        /// Indicates the audio processing tap that will be used for the audio track.
        #[unsafe(method(audioTapProcessor))]
        #[unsafe(method_family = none)]
        pub unsafe fn audioTapProcessor(&self) -> Option<Retained<MTAudioProcessingTap>>;

        #[cfg(feature = "objc2-media-toolbox")]
        #[cfg(not(target_os = "watchos"))]
        /// Setter for [`audioTapProcessor`][Self::audioTapProcessor].
        #[unsafe(method(setAudioTapProcessor:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAudioTapProcessor(
            &self,
            audio_tap_processor: Option<&MTAudioProcessingTap>,
        );

        #[cfg(feature = "objc2-core-media")]
        #[unsafe(method(setVolumeRampFromStartVolume:toEndVolume:timeRange:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setVolumeRampFromStartVolume_toEndVolume_timeRange(
            &self,
            start_volume: c_float,
            end_volume: c_float,
            time_range: CMTimeRange,
        );

        #[cfg(feature = "objc2-core-media")]
        #[unsafe(method(setVolume:atTime:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setVolume_atTime(&self, volume: c_float, time: CMTime);
    );
}

/// Methods declared on superclass `NSObject`.
impl AVMutableAudioMixInputParameters {
    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>;
    );
}