objc2_browser_engine_core/generated/
BEAudioSession.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4#[cfg(feature = "objc2")]
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-avf-audio")]
7use objc2_avf_audio::*;
8#[cfg(feature = "objc2-foundation")]
9use objc2_foundation::*;
10
11use crate::*;
12
13#[cfg(feature = "objc2")]
14extern_class!(
15    /// An object that represents an audio session
16    ///
17    /// See also [Apple's documentation](https://developer.apple.com/documentation/browserenginecore/beaudiosession?language=objc)
18    #[unsafe(super(NSObject))]
19    #[derive(Debug, PartialEq, Eq, Hash)]
20    #[cfg(feature = "objc2")]
21    pub struct BEAudioSession;
22);
23
24#[cfg(feature = "objc2")]
25extern_conformance!(
26    unsafe impl NSObjectProtocol for BEAudioSession {}
27);
28
29#[cfg(feature = "objc2")]
30impl BEAudioSession {
31    extern_methods!(
32        #[cfg(feature = "objc2-avf-audio")]
33        /// Creates a BE audio session from an  AV audio session
34        ///
35        /// - Parameters:
36        /// - session: The AV audio session
37        #[unsafe(method(initWithAudioSession:))]
38        #[unsafe(method_family = init)]
39        pub unsafe fn initWithAudioSession(
40            this: Allocated<Self>,
41            audio_session: &AVAudioSession,
42        ) -> Retained<Self>;
43
44        #[cfg(all(feature = "objc2-avf-audio", feature = "objc2-foundation"))]
45        /// Gets the set of output ports that are available for routing.
46        #[unsafe(method(availableOutputs))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn availableOutputs(
49            &self,
50        ) -> Option<Retained<NSArray<AVAudioSessionPortDescription>>>;
51
52        #[cfg(all(feature = "objc2-avf-audio", feature = "objc2-foundation"))]
53        /// Select a preferred output port for audio routing.
54        /// Setting a nil value will clear the preference.
55        #[unsafe(method(setPreferredOutput:error:_))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn setPreferredOutput_error(
58            &self,
59            out_port: Option<&AVAudioSessionPortDescription>,
60        ) -> Result<(), Retained<NSError>>;
61
62        #[cfg(feature = "objc2-avf-audio")]
63        /// Get the preferred output port.  Will be nil if no preference has been set.
64        #[unsafe(method(preferredOutput))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn preferredOutput(&self) -> Option<Retained<AVAudioSessionPortDescription>>;
67    );
68}
69
70/// Methods declared on superclass `NSObject`.
71#[cfg(feature = "objc2")]
72impl BEAudioSession {
73    extern_methods!(
74        #[unsafe(method(init))]
75        #[unsafe(method_family = init)]
76        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
77
78        #[unsafe(method(new))]
79        #[unsafe(method_family = new)]
80        pub unsafe fn new() -> Retained<Self>;
81    );
82}