objc2_avf_audio/generated/
AVAudioSessionRoute.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
11/// The location of a data source on an iOS device.
12///
13/// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessionlocation?language=objc)
14// NS_TYPED_ENUM
15pub type AVAudioSessionLocation = NSString;
16
17extern "C" {
18    /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessionlocationupper?language=objc)
19    pub static AVAudioSessionLocationUpper: &'static AVAudioSessionLocation;
20}
21
22extern "C" {
23    /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessionlocationlower?language=objc)
24    pub static AVAudioSessionLocationLower: &'static AVAudioSessionLocation;
25}
26
27/// The orientation or directionality of a data source on an iOS device.
28///
29/// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessionorientation?language=objc)
30// NS_TYPED_ENUM
31pub type AVAudioSessionOrientation = NSString;
32
33extern "C" {
34    /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessionorientationtop?language=objc)
35    pub static AVAudioSessionOrientationTop: &'static AVAudioSessionOrientation;
36}
37
38extern "C" {
39    /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessionorientationbottom?language=objc)
40    pub static AVAudioSessionOrientationBottom: &'static AVAudioSessionOrientation;
41}
42
43extern "C" {
44    /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessionorientationfront?language=objc)
45    pub static AVAudioSessionOrientationFront: &'static AVAudioSessionOrientation;
46}
47
48extern "C" {
49    /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessionorientationback?language=objc)
50    pub static AVAudioSessionOrientationBack: &'static AVAudioSessionOrientation;
51}
52
53extern "C" {
54    /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessionorientationleft?language=objc)
55    pub static AVAudioSessionOrientationLeft: &'static AVAudioSessionOrientation;
56}
57
58extern "C" {
59    /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessionorientationright?language=objc)
60    pub static AVAudioSessionOrientationRight: &'static AVAudioSessionOrientation;
61}
62
63/// The possible polar patterns for a data source on an iOS device.
64///
65/// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessionpolarpattern?language=objc)
66// NS_TYPED_ENUM
67pub type AVAudioSessionPolarPattern = NSString;
68
69extern "C" {
70    /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessionpolarpatternomnidirectional?language=objc)
71    pub static AVAudioSessionPolarPatternOmnidirectional: &'static AVAudioSessionPolarPattern;
72}
73
74extern "C" {
75    /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessionpolarpatterncardioid?language=objc)
76    pub static AVAudioSessionPolarPatternCardioid: &'static AVAudioSessionPolarPattern;
77}
78
79extern "C" {
80    /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessionpolarpatternsubcardioid?language=objc)
81    pub static AVAudioSessionPolarPatternSubcardioid: &'static AVAudioSessionPolarPattern;
82}
83
84extern "C" {
85    /// If you select a data source with AVAudioSessionPolarPatternStereo, then you must call setPreferredInputOrientation:error: on your Audio Session so that left and right are presented from the correct directions.
86    ///
87    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessionpolarpatternstereo?language=objc)
88    pub static AVAudioSessionPolarPatternStereo: &'static AVAudioSessionPolarPattern;
89}
90
91extern_class!(
92    /// Information about a port's audio channels.
93    ///
94    /// AudioQueue, AURemoteIO and AUVoiceIO instances can be assigned to communicate with specific
95    /// hardware channels by setting an array of
96    /// <port
97    /// UID, channel index> pairs.
98    ///
99    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessionchanneldescription?language=objc)
100    #[unsafe(super(NSObject))]
101    #[derive(Debug, PartialEq, Eq, Hash)]
102    pub struct AVAudioSessionChannelDescription;
103);
104
105unsafe impl Send for AVAudioSessionChannelDescription {}
106
107unsafe impl Sync for AVAudioSessionChannelDescription {}
108
109extern_conformance!(
110    unsafe impl NSObjectProtocol for AVAudioSessionChannelDescription {}
111);
112
113impl AVAudioSessionChannelDescription {
114    extern_methods!(
115        /// A human-readable name for the channel.
116        #[unsafe(method(channelName))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn channelName(&self) -> Retained<NSString>;
119
120        /// The UID (unique identifier) of the port owning the channel.
121        #[unsafe(method(owningPortUID))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn owningPortUID(&self) -> Retained<NSString>;
124
125        /// The index of this channel in its owning port's array of channels.
126        #[unsafe(method(channelNumber))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn channelNumber(&self) -> NSUInteger;
129
130        #[cfg(feature = "objc2-core-audio-types")]
131        /// Description of the physical location of this channel.
132        #[unsafe(method(channelLabel))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn channelLabel(&self) -> AudioChannelLabel;
135    );
136}
137
138/// Methods declared on superclass `NSObject`.
139impl AVAudioSessionChannelDescription {
140    extern_methods!(
141        #[unsafe(method(init))]
142        #[unsafe(method_family = init)]
143        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
144
145        #[unsafe(method(new))]
146        #[unsafe(method_family = new)]
147        pub unsafe fn new() -> Retained<Self>;
148    );
149}
150
151extern_class!(
152    /// Information about one of potentially multiple data sources associated with a port.
153    ///
154    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessiondatasourcedescription?language=objc)
155    #[unsafe(super(NSObject))]
156    #[derive(Debug, PartialEq, Eq, Hash)]
157    pub struct AVAudioSessionDataSourceDescription;
158);
159
160unsafe impl Send for AVAudioSessionDataSourceDescription {}
161
162unsafe impl Sync for AVAudioSessionDataSourceDescription {}
163
164extern_conformance!(
165    unsafe impl NSObjectProtocol for AVAudioSessionDataSourceDescription {}
166);
167
168impl AVAudioSessionDataSourceDescription {
169    extern_methods!(
170        /// System-assigned ID for the data source.
171        #[unsafe(method(dataSourceID))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn dataSourceID(&self) -> Retained<NSNumber>;
174
175        /// Human-readable name for the data source.
176        #[unsafe(method(dataSourceName))]
177        #[unsafe(method_family = none)]
178        pub unsafe fn dataSourceName(&self) -> Retained<NSString>;
179
180        /// Describes the general location of a data source. Will be nil for data sources for which the
181        /// location is not known.
182        #[unsafe(method(location))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn location(&self) -> Option<Retained<AVAudioSessionLocation>>;
185
186        /// Describes the orientation of a data source.  Will be nil for data sources for which the
187        /// orientation is not known.
188        #[unsafe(method(orientation))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn orientation(&self) -> Option<Retained<AVAudioSessionOrientation>>;
191
192        /// Array of one or more AVAudioSessionPolarPatterns describing the supported polar patterns for a
193        /// data source.  Will be nil for data sources that have no selectable patterns.
194        #[unsafe(method(supportedPolarPatterns))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn supportedPolarPatterns(
197            &self,
198        ) -> Option<Retained<NSArray<AVAudioSessionPolarPattern>>>;
199
200        /// Describes the currently selected polar pattern.  Will be nil for data sources that have no
201        /// selectable patterns.
202        #[unsafe(method(selectedPolarPattern))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn selectedPolarPattern(&self) -> Option<Retained<AVAudioSessionPolarPattern>>;
205
206        /// Describes the preferred polar pattern.  Will be nil for data sources that have no selectable
207        /// patterns or if no preference has been set.
208        #[unsafe(method(preferredPolarPattern))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn preferredPolarPattern(&self) -> Option<Retained<AVAudioSessionPolarPattern>>;
211
212        /// Select the desired polar pattern from the set of available patterns. Setting a nil value
213        /// will clear the preference.
214        ///
215        ///
216        /// Note: If the owning port and data source are part of the active audio route, changing the polar
217        /// pattern will likely result in a route reconfiguration. If the owning port and data source are
218        /// not part of the active route, selecting a polar pattern will not result in an immediate route
219        /// reconfiguration.  Use AVAudioSession's setPreferredInput:error: method to activate the port. Use
220        /// setPreferredDataSource:error: to active the data source on the port.
221        /// You must call setPreferredInputOrientation:error: on the AVAudioSession if you chose the
222        /// AVAudioSessionPolarPatternStereo polar pattern.
223        #[unsafe(method(setPreferredPolarPattern:error:_))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn setPreferredPolarPattern_error(
226            &self,
227            pattern: Option<&AVAudioSessionPolarPattern>,
228        ) -> Result<(), Retained<NSError>>;
229    );
230}
231
232/// Methods declared on superclass `NSObject`.
233impl AVAudioSessionDataSourceDescription {
234    extern_methods!(
235        #[unsafe(method(init))]
236        #[unsafe(method_family = init)]
237        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
238
239        #[unsafe(method(new))]
240        #[unsafe(method_family = new)]
241        pub unsafe fn new() -> Retained<Self>;
242    );
243}
244
245extern_class!(
246    /// Information about a port, a physical connector or audio device.
247    ///
248    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessionportdescription?language=objc)
249    #[unsafe(super(NSObject))]
250    #[derive(Debug, PartialEq, Eq, Hash)]
251    pub struct AVAudioSessionPortDescription;
252);
253
254unsafe impl Send for AVAudioSessionPortDescription {}
255
256unsafe impl Sync for AVAudioSessionPortDescription {}
257
258extern_conformance!(
259    unsafe impl NSObjectProtocol for AVAudioSessionPortDescription {}
260);
261
262impl AVAudioSessionPortDescription {
263    extern_methods!(
264        #[cfg(feature = "AVAudioSessionTypes")]
265        #[unsafe(method(portType))]
266        #[unsafe(method_family = none)]
267        pub unsafe fn portType(&self) -> Retained<AVAudioSessionPort>;
268
269        /// A descriptive name for the associated hardware port
270        #[unsafe(method(portName))]
271        #[unsafe(method_family = none)]
272        pub unsafe fn portName(&self) -> Retained<NSString>;
273
274        /// A system-assigned unique identifier for the associated hardware port
275        #[unsafe(method(UID))]
276        #[unsafe(method_family = none)]
277        pub unsafe fn UID(&self) -> Retained<NSString>;
278
279        /// This property's value will be true if the associated hardware port has built-in
280        /// processing for two-way voice communication.
281        ///
282        /// Applications that use their own proprietary voice processing algorithms should use this property
283        /// to decide when to disable processing.  On the other hand, if using Apple's Voice Processing I/O
284        /// unit (subtype kAudioUnitSubType_VoiceProcessingIO), the system will automatically manage this
285        /// for the application. In particular, ports of type AVAudioSessionPortBluetoothHFP and
286        /// AVAudioSessionPortCarAudio often have hardware voice processing.
287        #[unsafe(method(hasHardwareVoiceCallProcessing))]
288        #[unsafe(method_family = none)]
289        pub unsafe fn hasHardwareVoiceCallProcessing(&self) -> bool;
290
291        /// This property's value will be true if the port supports spatial audio playback and the feature is
292        /// enabled.
293        ///
294        /// 'Now Playing' apps should also inform the system if they support multichannel audio content using
295        /// -setSupportsMultichannelContent:error: method. Apps may also register to receive the
296        /// AVAudioSessionSpatialPlaybackCapabilitiesChanged notification to detect changes in user preferences that
297        /// affect spatial audio playback.
298        ///
299        /// This property is only relevant in the context of ports that have a small number of hardware channels
300        /// (typically 2), but have enhanced capabilities for rendering multi-channel content. Note that some port
301        /// types such as USB and HDMI may support multi-channel playback because they have hardware formats supporting
302        /// more than 2 channels. For example, many HDMI receivers are connected to multiple speakers and are capable of
303        /// rendering 5.1, 7.1, or other popular surround sound formats. Applications interested in utilizing multi-channel
304        /// formats should also query AVAudioSession's maximumOutputNumberOfChannels property and make use of
305        /// -setPreferredOutputNumberOfChannels:error: to set the preferred number of hardware channels.
306        #[unsafe(method(isSpatialAudioEnabled))]
307        #[unsafe(method_family = none)]
308        pub unsafe fn isSpatialAudioEnabled(&self) -> bool;
309
310        #[unsafe(method(channels))]
311        #[unsafe(method_family = none)]
312        pub unsafe fn channels(
313            &self,
314        ) -> Option<Retained<NSArray<AVAudioSessionChannelDescription>>>;
315
316        /// Will be nil if there are no selectable data sources.
317        #[unsafe(method(dataSources))]
318        #[unsafe(method_family = none)]
319        pub unsafe fn dataSources(
320            &self,
321        ) -> Option<Retained<NSArray<AVAudioSessionDataSourceDescription>>>;
322
323        /// Will be nil if there are no selectable data sources. In all other cases, this property reflects
324        /// the currently selected data source.
325        #[unsafe(method(selectedDataSource))]
326        #[unsafe(method_family = none)]
327        pub unsafe fn selectedDataSource(
328            &self,
329        ) -> Option<Retained<AVAudioSessionDataSourceDescription>>;
330
331        /// This property reflects the application's preferred data source for the Port. Will be nil if
332        /// there are no selectable data sources or if no preference has been set.
333        #[unsafe(method(preferredDataSource))]
334        #[unsafe(method_family = none)]
335        pub unsafe fn preferredDataSource(
336            &self,
337        ) -> Option<Retained<AVAudioSessionDataSourceDescription>>;
338
339        /// Select the preferred data source for this port. The input dataSource parameter must be
340        /// one of the dataSources exposed by the dataSources property. Setting a nil value will clear the
341        /// preference. Note: if the port is part of the active audio route, changing the data source will
342        /// likely result in a route reconfiguration.  If the port is not part of the active route,
343        /// selecting a new data source will not result in an immediate route reconfiguration.  Use
344        /// AVAudioSession's -setPreferredInput:error: method to activate the port.
345        #[unsafe(method(setPreferredDataSource:error:_))]
346        #[unsafe(method_family = none)]
347        pub unsafe fn setPreferredDataSource_error(
348            &self,
349            data_source: Option<&AVAudioSessionDataSourceDescription>,
350        ) -> Result<(), Retained<NSError>>;
351    );
352}
353
354/// Methods declared on superclass `NSObject`.
355impl AVAudioSessionPortDescription {
356    extern_methods!(
357        #[unsafe(method(init))]
358        #[unsafe(method_family = init)]
359        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
360
361        #[unsafe(method(new))]
362        #[unsafe(method_family = new)]
363        pub unsafe fn new() -> Retained<Self>;
364    );
365}
366
367extern_class!(
368    /// A description of the input and output ports which comprise a route.
369    ///
370    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessionroutedescription?language=objc)
371    #[unsafe(super(NSObject))]
372    #[derive(Debug, PartialEq, Eq, Hash)]
373    pub struct AVAudioSessionRouteDescription;
374);
375
376unsafe impl Send for AVAudioSessionRouteDescription {}
377
378unsafe impl Sync for AVAudioSessionRouteDescription {}
379
380extern_conformance!(
381    unsafe impl NSObjectProtocol for AVAudioSessionRouteDescription {}
382);
383
384impl AVAudioSessionRouteDescription {
385    extern_methods!(
386        /// Flattened list of all input port descriptions associated with all the streams as part of the route.
387        #[unsafe(method(inputs))]
388        #[unsafe(method_family = none)]
389        pub unsafe fn inputs(&self) -> Retained<NSArray<AVAudioSessionPortDescription>>;
390
391        /// Flattened list of all output port descriptions associated with all the streams as part of the route.
392        #[unsafe(method(outputs))]
393        #[unsafe(method_family = none)]
394        pub unsafe fn outputs(&self) -> Retained<NSArray<AVAudioSessionPortDescription>>;
395    );
396}
397
398/// Methods declared on superclass `NSObject`.
399impl AVAudioSessionRouteDescription {
400    extern_methods!(
401        #[unsafe(method(init))]
402        #[unsafe(method_family = init)]
403        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
404
405        #[unsafe(method(new))]
406        #[unsafe(method_family = new)]
407        pub unsafe fn new() -> Retained<Self>;
408    );
409}