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
109unsafe impl NSObjectProtocol for AVAudioSessionChannelDescription {}
110
111impl AVAudioSessionChannelDescription {
112 extern_methods!(
113 /// A human-readable name for the channel.
114 #[unsafe(method(channelName))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn channelName(&self) -> Retained<NSString>;
117
118 /// The UID (unique identifier) of the port owning the channel.
119 #[unsafe(method(owningPortUID))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn owningPortUID(&self) -> Retained<NSString>;
122
123 /// The index of this channel in its owning port's array of channels.
124 #[unsafe(method(channelNumber))]
125 #[unsafe(method_family = none)]
126 pub unsafe fn channelNumber(&self) -> NSUInteger;
127
128 #[cfg(feature = "objc2-core-audio-types")]
129 /// Description of the physical location of this channel.
130 #[unsafe(method(channelLabel))]
131 #[unsafe(method_family = none)]
132 pub unsafe fn channelLabel(&self) -> AudioChannelLabel;
133 );
134}
135
136/// Methods declared on superclass `NSObject`.
137impl AVAudioSessionChannelDescription {
138 extern_methods!(
139 #[unsafe(method(init))]
140 #[unsafe(method_family = init)]
141 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
142
143 #[unsafe(method(new))]
144 #[unsafe(method_family = new)]
145 pub unsafe fn new() -> Retained<Self>;
146 );
147}
148
149extern_class!(
150 /// Information about one of potentially multiple data sources associated with a port.
151 ///
152 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessiondatasourcedescription?language=objc)
153 #[unsafe(super(NSObject))]
154 #[derive(Debug, PartialEq, Eq, Hash)]
155 pub struct AVAudioSessionDataSourceDescription;
156);
157
158unsafe impl Send for AVAudioSessionDataSourceDescription {}
159
160unsafe impl Sync for AVAudioSessionDataSourceDescription {}
161
162unsafe impl NSObjectProtocol for AVAudioSessionDataSourceDescription {}
163
164impl AVAudioSessionDataSourceDescription {
165 extern_methods!(
166 /// System-assigned ID for the data source.
167 #[unsafe(method(dataSourceID))]
168 #[unsafe(method_family = none)]
169 pub unsafe fn dataSourceID(&self) -> Retained<NSNumber>;
170
171 /// Human-readable name for the data source.
172 #[unsafe(method(dataSourceName))]
173 #[unsafe(method_family = none)]
174 pub unsafe fn dataSourceName(&self) -> Retained<NSString>;
175
176 /// Describes the general location of a data source. Will be nil for data sources for which the
177 /// location is not known.
178 #[unsafe(method(location))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn location(&self) -> Option<Retained<AVAudioSessionLocation>>;
181
182 /// Describes the orientation of a data source. Will be nil for data sources for which the
183 /// orientation is not known.
184 #[unsafe(method(orientation))]
185 #[unsafe(method_family = none)]
186 pub unsafe fn orientation(&self) -> Option<Retained<AVAudioSessionOrientation>>;
187
188 /// Array of one or more AVAudioSessionPolarPatterns describing the supported polar patterns for a
189 /// data source. Will be nil for data sources that have no selectable patterns.
190 #[unsafe(method(supportedPolarPatterns))]
191 #[unsafe(method_family = none)]
192 pub unsafe fn supportedPolarPatterns(
193 &self,
194 ) -> Option<Retained<NSArray<AVAudioSessionPolarPattern>>>;
195
196 /// Describes the currently selected polar pattern. Will be nil for data sources that have no
197 /// selectable patterns.
198 #[unsafe(method(selectedPolarPattern))]
199 #[unsafe(method_family = none)]
200 pub unsafe fn selectedPolarPattern(&self) -> Option<Retained<AVAudioSessionPolarPattern>>;
201
202 /// Describes the preferred polar pattern. Will be nil for data sources that have no selectable
203 /// patterns or if no preference has been set.
204 #[unsafe(method(preferredPolarPattern))]
205 #[unsafe(method_family = none)]
206 pub unsafe fn preferredPolarPattern(&self) -> Option<Retained<AVAudioSessionPolarPattern>>;
207
208 /// Select the desired polar pattern from the set of available patterns. Setting a nil value
209 /// will clear the preference.
210 ///
211 ///
212 /// Note: If the owning port and data source are part of the active audio route, changing the polar
213 /// pattern will likely result in a route reconfiguration. If the owning port and data source are
214 /// not part of the active route, selecting a polar pattern will not result in an immediate route
215 /// reconfiguration. Use AVAudioSession's setPreferredInput:error: method to activate the port. Use
216 /// setPreferredDataSource:error: to active the data source on the port.
217 /// You must call setPreferredInputOrientation:error: on the AVAudioSession if you chose the
218 /// AVAudioSessionPolarPatternStereo polar pattern.
219 #[unsafe(method(setPreferredPolarPattern:error:_))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn setPreferredPolarPattern_error(
222 &self,
223 pattern: Option<&AVAudioSessionPolarPattern>,
224 ) -> Result<(), Retained<NSError>>;
225 );
226}
227
228/// Methods declared on superclass `NSObject`.
229impl AVAudioSessionDataSourceDescription {
230 extern_methods!(
231 #[unsafe(method(init))]
232 #[unsafe(method_family = init)]
233 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
234
235 #[unsafe(method(new))]
236 #[unsafe(method_family = new)]
237 pub unsafe fn new() -> Retained<Self>;
238 );
239}
240
241extern_class!(
242 /// Information about a port, a physical connector or audio device.
243 ///
244 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessionportdescription?language=objc)
245 #[unsafe(super(NSObject))]
246 #[derive(Debug, PartialEq, Eq, Hash)]
247 pub struct AVAudioSessionPortDescription;
248);
249
250unsafe impl Send for AVAudioSessionPortDescription {}
251
252unsafe impl Sync for AVAudioSessionPortDescription {}
253
254unsafe impl NSObjectProtocol for AVAudioSessionPortDescription {}
255
256impl AVAudioSessionPortDescription {
257 extern_methods!(
258 #[cfg(feature = "AVAudioSessionTypes")]
259 #[unsafe(method(portType))]
260 #[unsafe(method_family = none)]
261 pub unsafe fn portType(&self) -> Retained<AVAudioSessionPort>;
262
263 /// A descriptive name for the associated hardware port
264 #[unsafe(method(portName))]
265 #[unsafe(method_family = none)]
266 pub unsafe fn portName(&self) -> Retained<NSString>;
267
268 /// A system-assigned unique identifier for the associated hardware port
269 #[unsafe(method(UID))]
270 #[unsafe(method_family = none)]
271 pub unsafe fn UID(&self) -> Retained<NSString>;
272
273 /// This property's value will be true if the associated hardware port has built-in
274 /// processing for two-way voice communication.
275 ///
276 /// Applications that use their own proprietary voice processing algorithms should use this property
277 /// to decide when to disable processing. On the other hand, if using Apple's Voice Processing I/O
278 /// unit (subtype kAudioUnitSubType_VoiceProcessingIO), the system will automatically manage this
279 /// for the application. In particular, ports of type AVAudioSessionPortBluetoothHFP and
280 /// AVAudioSessionPortCarAudio often have hardware voice processing.
281 #[unsafe(method(hasHardwareVoiceCallProcessing))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn hasHardwareVoiceCallProcessing(&self) -> bool;
284
285 /// This property's value will be true if the port supports spatial audio playback and the feature is
286 /// enabled.
287 ///
288 /// 'Now Playing' apps should also inform the system if they support multichannel audio content using
289 /// -setSupportsMultichannelContent:error: method. Apps may also register to receive the
290 /// AVAudioSessionSpatialPlaybackCapabilitiesChanged notification to detect changes in user preferences that
291 /// affect spatial audio playback.
292 ///
293 /// This property is only relevant in the context of ports that have a small number of hardware channels
294 /// (typically 2), but have enhanced capabilities for rendering multi-channel content. Note that some port
295 /// types such as USB and HDMI may support multi-channel playback because they have hardware formats supporting
296 /// more than 2 channels. For example, many HDMI receivers are connected to multiple speakers and are capable of
297 /// rendering 5.1, 7.1, or other popular surround sound formats. Applications interested in utilizing multi-channel
298 /// formats should also query AVAudioSession's maximumOutputNumberOfChannels property and make use of
299 /// -setPreferredOutputNumberOfChannels:error: to set the preferred number of hardware channels.
300 #[unsafe(method(isSpatialAudioEnabled))]
301 #[unsafe(method_family = none)]
302 pub unsafe fn isSpatialAudioEnabled(&self) -> bool;
303
304 #[unsafe(method(channels))]
305 #[unsafe(method_family = none)]
306 pub unsafe fn channels(
307 &self,
308 ) -> Option<Retained<NSArray<AVAudioSessionChannelDescription>>>;
309
310 /// Will be nil if there are no selectable data sources.
311 #[unsafe(method(dataSources))]
312 #[unsafe(method_family = none)]
313 pub unsafe fn dataSources(
314 &self,
315 ) -> Option<Retained<NSArray<AVAudioSessionDataSourceDescription>>>;
316
317 /// Will be nil if there are no selectable data sources. In all other cases, this property reflects
318 /// the currently selected data source.
319 #[unsafe(method(selectedDataSource))]
320 #[unsafe(method_family = none)]
321 pub unsafe fn selectedDataSource(
322 &self,
323 ) -> Option<Retained<AVAudioSessionDataSourceDescription>>;
324
325 /// This property reflects the application's preferred data source for the Port. Will be nil if
326 /// there are no selectable data sources or if no preference has been set.
327 #[unsafe(method(preferredDataSource))]
328 #[unsafe(method_family = none)]
329 pub unsafe fn preferredDataSource(
330 &self,
331 ) -> Option<Retained<AVAudioSessionDataSourceDescription>>;
332
333 /// Select the preferred data source for this port. The input dataSource parameter must be
334 /// one of the dataSources exposed by the dataSources property. Setting a nil value will clear the
335 /// preference. Note: if the port is part of the active audio route, changing the data source will
336 /// likely result in a route reconfiguration. If the port is not part of the active route,
337 /// selecting a new data source will not result in an immediate route reconfiguration. Use
338 /// AVAudioSession's -setPreferredInput:error: method to activate the port.
339 #[unsafe(method(setPreferredDataSource:error:_))]
340 #[unsafe(method_family = none)]
341 pub unsafe fn setPreferredDataSource_error(
342 &self,
343 data_source: Option<&AVAudioSessionDataSourceDescription>,
344 ) -> Result<(), Retained<NSError>>;
345 );
346}
347
348/// Methods declared on superclass `NSObject`.
349impl AVAudioSessionPortDescription {
350 extern_methods!(
351 #[unsafe(method(init))]
352 #[unsafe(method_family = init)]
353 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
354
355 #[unsafe(method(new))]
356 #[unsafe(method_family = new)]
357 pub unsafe fn new() -> Retained<Self>;
358 );
359}
360
361extern_class!(
362 /// A description of the input and output ports which comprise a route.
363 ///
364 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosessionroutedescription?language=objc)
365 #[unsafe(super(NSObject))]
366 #[derive(Debug, PartialEq, Eq, Hash)]
367 pub struct AVAudioSessionRouteDescription;
368);
369
370unsafe impl Send for AVAudioSessionRouteDescription {}
371
372unsafe impl Sync for AVAudioSessionRouteDescription {}
373
374unsafe impl NSObjectProtocol for AVAudioSessionRouteDescription {}
375
376impl AVAudioSessionRouteDescription {
377 extern_methods!(
378 /// Flattened list of all input port descriptions associated with all the streams as part of the route.
379 #[unsafe(method(inputs))]
380 #[unsafe(method_family = none)]
381 pub unsafe fn inputs(&self) -> Retained<NSArray<AVAudioSessionPortDescription>>;
382
383 /// Flattened list of all output port descriptions associated with all the streams as part of the route.
384 #[unsafe(method(outputs))]
385 #[unsafe(method_family = none)]
386 pub unsafe fn outputs(&self) -> Retained<NSArray<AVAudioSessionPortDescription>>;
387 );
388}
389
390/// Methods declared on superclass `NSObject`.
391impl AVAudioSessionRouteDescription {
392 extern_methods!(
393 #[unsafe(method(init))]
394 #[unsafe(method_family = init)]
395 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
396
397 #[unsafe(method(new))]
398 #[unsafe(method_family = new)]
399 pub unsafe fn new() -> Retained<Self>;
400 );
401}