objc2_avf_audio/generated/
AVAudioChannelLayout.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-core-audio-types")]
6use objc2_core_audio_types::*;
7use objc2_foundation::*;
8
9use crate::*;
10
11extern_class!(
12    /// A description of the roles of a set of audio channels.
13    ///
14    /// This object is a thin wrapper for the AudioChannelLayout structure, described
15    /// in
16    /// <CoreAudio
17    /// /CoreAudioTypes.h>.
18    ///
19    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiochannellayout?language=objc)
20    #[unsafe(super(NSObject))]
21    #[derive(Debug, PartialEq, Eq, Hash)]
22    pub struct AVAudioChannelLayout;
23);
24
25unsafe impl Send for AVAudioChannelLayout {}
26
27unsafe impl Sync for AVAudioChannelLayout {}
28
29extern_conformance!(
30    unsafe impl NSCoding for AVAudioChannelLayout {}
31);
32
33extern_conformance!(
34    unsafe impl NSObjectProtocol for AVAudioChannelLayout {}
35);
36
37extern_conformance!(
38    unsafe impl NSSecureCoding for AVAudioChannelLayout {}
39);
40
41impl AVAudioChannelLayout {
42    extern_methods!(
43        #[unsafe(method(init))]
44        #[unsafe(method_family = init)]
45        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
46
47        #[cfg(feature = "objc2-core-audio-types")]
48        /// Initialize from a layout tag.
49        ///
50        /// Parameter `layoutTag`: The tag.
51        ///
52        /// Returns nil if the tag is either kAudioChannelLayoutTag_UseChannelDescriptions or
53        /// kAudioChannelLayoutTag_UseChannelBitmap.
54        #[unsafe(method(initWithLayoutTag:))]
55        #[unsafe(method_family = init)]
56        pub unsafe fn initWithLayoutTag(
57            this: Allocated<Self>,
58            layout_tag: AudioChannelLayoutTag,
59        ) -> Option<Retained<Self>>;
60
61        #[cfg(feature = "objc2-core-audio-types")]
62        /// Initialize from an AudioChannelLayout.
63        ///
64        /// Parameter `layout`: The AudioChannelLayout.
65        ///
66        /// If the provided layout's tag is kAudioChannelLayoutTag_UseChannelDescriptions, this
67        /// initializer attempts to convert it to a more specific tag.
68        ///
69        /// # Safety
70        ///
71        /// `layout` must be a valid pointer.
72        #[unsafe(method(initWithLayout:))]
73        #[unsafe(method_family = init)]
74        pub unsafe fn initWithLayout(
75            this: Allocated<Self>,
76            layout: NonNull<AudioChannelLayout>,
77        ) -> Retained<Self>;
78
79        /// Determine whether another AVAudioChannelLayout is exactly equal to this layout.
80        ///
81        /// Parameter `object`: The AVAudioChannelLayout to compare against.
82        ///
83        /// The underlying AudioChannelLayoutTag and AudioChannelLayout are compared for equality.
84        ///
85        /// # Safety
86        ///
87        /// `object` should be of the correct type.
88        #[unsafe(method(isEqual:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn isEqual(&self, object: &AnyObject) -> bool;
91
92        #[cfg(feature = "objc2-core-audio-types")]
93        /// Create from a layout tag.
94        #[unsafe(method(layoutWithLayoutTag:))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn layoutWithLayoutTag(layout_tag: AudioChannelLayoutTag) -> Retained<Self>;
97
98        #[cfg(feature = "objc2-core-audio-types")]
99        /// Create from an AudioChannelLayout
100        ///
101        /// # Safety
102        ///
103        /// `layout` must be a valid pointer.
104        #[unsafe(method(layoutWithLayout:))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn layoutWithLayout(layout: NonNull<AudioChannelLayout>) -> Retained<Self>;
107
108        #[cfg(feature = "objc2-core-audio-types")]
109        /// The layout's tag.
110        ///
111        /// This property is not atomic.
112        ///
113        /// # Safety
114        ///
115        /// This might not be thread-safe.
116        #[unsafe(method(layoutTag))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn layoutTag(&self) -> AudioChannelLayoutTag;
119
120        #[cfg(feature = "objc2-core-audio-types")]
121        /// The underlying AudioChannelLayout.
122        ///
123        /// This property is not atomic.
124        ///
125        /// # Safety
126        ///
127        /// This might not be thread-safe.
128        #[unsafe(method(layout))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn layout(&self) -> NonNull<AudioChannelLayout>;
131
132        #[cfg(feature = "AVAudioTypes")]
133        /// The number of channels of audio data.
134        ///
135        /// This property is not atomic.
136        ///
137        /// # Safety
138        ///
139        /// This might not be thread-safe.
140        #[unsafe(method(channelCount))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn channelCount(&self) -> AVAudioChannelCount;
143    );
144}
145
146/// Methods declared on superclass `NSObject`.
147impl AVAudioChannelLayout {
148    extern_methods!(
149        #[unsafe(method(new))]
150        #[unsafe(method_family = new)]
151        pub unsafe fn new() -> Retained<Self>;
152    );
153}