ohaudio_sys/audio_manager/audio_manager_ffi.rs
1// automatically generated by rust-bindgen 0.71.1
2
3#![allow(non_upper_case_globals)]
4#![allow(non_camel_case_types)]
5#![allow(non_snake_case)]
6use crate::audio_common::{OH_AudioCommon_Result, OH_AudioScene};
7
8/// Declare the audio manager.
9/// The handle of audio manager is used for audio management related functions.
10///
11///
12/// Available since API-level: 12
13#[cfg(feature = "api-12")]
14#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
15#[repr(C)]
16pub struct OH_AudioManager {
17 _unused: [u8; 0],
18}
19/// Prototype for the audio scene change function that is passed to
20/// [`OH_AudioManager_RegisterAudioSceneChangeCallback`].
21///
22/// # Arguments
23///
24/// * `userData` - userdata which is passed by register.
25///
26/// * `scene` - the latest audio scene.
27///
28/// Available since API-level: 20
29#[cfg(feature = "api-20")]
30#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
31pub type OH_AudioManager_OnAudioSceneChangeCallback = ::core::option::Option<
32 unsafe extern "C" fn(userData: *mut ::core::ffi::c_void, scene: OH_AudioScene),
33>;
34extern "C" {
35 /// Get audio manager handle.
36 ///
37 /// # Arguments
38 ///
39 /// * `audioManager` - the [`OH_AudioManager`] handle received from this function.
40 ///
41 /// # Returns
42 ///
43 /// * Function result code:
44 /// [`AUDIOCOMMON_RESULT_SUCCESS`] If the execution is successful.
45 /// [`AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM`]:
46 /// 1.The param of audioManager is nullptr;
47 ///
48 /// Available since API-level: 12
49 #[cfg(feature = "api-12")]
50 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
51 pub fn OH_GetAudioManager(audioManager: *mut *mut OH_AudioManager) -> OH_AudioCommon_Result;
52 /// Get audio scene.
53 ///
54 /// # Arguments
55 ///
56 /// * `manager` - the [`OH_AudioManager`] handle received from [`OH_GetAudioManager`].
57 ///
58 /// * `scene` - the [`OH_AudioScene`] pointer to receive the result.
59 ///
60 /// # Returns
61 ///
62 /// * Function result code:
63 /// [`AUDIOCOMMON_RESULT_SUCCESS`] If the execution is successful.
64 /// [`AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM`]:
65 /// 1.The param of audioManager is nullptr;
66 /// 2.The param of scene is nullptr.
67 ///
68 /// Available since API-level: 12
69 #[cfg(feature = "api-12")]
70 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
71 pub fn OH_GetAudioScene(
72 manager: *mut OH_AudioManager,
73 scene: *mut OH_AudioScene,
74 ) -> OH_AudioCommon_Result;
75 /// Register callback to receive audio scene changed events.
76 ///
77 /// # Arguments
78 ///
79 /// * `manager` - [`OH_AudioManager`] handle received from [`OH_GetAudioManager`].
80 ///
81 /// * `callback` - callback function which will be called when audio scene changed.
82 ///
83 /// * `userData` - pointer to a data structure that will be passed to the callback functions.
84 ///
85 /// # Returns
86 ///
87 /// * [`AUDIOCOMMON_RESULT_SUCCESS`] if the execution is successful
88 /// [`AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM`]
89 /// 1.param of manager is nullptr
90 /// 2.param of callback is nullptr
91 /// [`#AUDIOCOMMON_RESULT_ERROR_SYSTEM`] system process error occurs
92 ///
93 /// Available since API-level: 20
94 #[cfg(feature = "api-20")]
95 #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
96 pub fn OH_AudioManager_RegisterAudioSceneChangeCallback(
97 manager: *mut OH_AudioManager,
98 callback: OH_AudioManager_OnAudioSceneChangeCallback,
99 userData: *mut ::core::ffi::c_void,
100 ) -> OH_AudioCommon_Result;
101 /// Unregister audio scene change callback.
102 ///
103 /// # Arguments
104 ///
105 /// * `manager` - [`OH_AudioManager`] handle received from [`OH_GetAudioManager`].
106 ///
107 /// * `callback` - callback function which registered in [`OH_AudioManager_RegisterAudioSceneChangeCallback`].
108 ///
109 /// # Returns
110 ///
111 /// * [`AUDIOCOMMON_RESULT_SUCCESS`] if the execution is successful
112 /// [`AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM`]
113 /// 1.param of manager is nullptr
114 /// 2.param of callback is nullptr
115 /// [`#AUDIOCOMMON_RESULT_ERROR_SYSTEM`] system process error occurs
116 ///
117 /// Available since API-level: 20
118 #[cfg(feature = "api-20")]
119 #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
120 pub fn OH_AudioManager_UnregisterAudioSceneChangeCallback(
121 manager: *mut OH_AudioManager,
122 callback: OH_AudioManager_OnAudioSceneChangeCallback,
123 ) -> OH_AudioCommon_Result;
124}