ohaudio-sys 0.1.0

Raw Bindings to the audio module of OpenHarmony
Documentation
// automatically generated by rust-bindgen 0.71.1

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::audio_common::{OH_AudioCommon_Result, OH_AudioScene};

/// Declare the audio manager.
/// The handle of audio manager is used for audio management related functions.
///
///
/// Available since API-level: 12
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
#[repr(C)]
pub struct OH_AudioManager {
    _unused: [u8; 0],
}
/// Prototype for the audio scene change function that is passed to
/// [`OH_AudioManager_RegisterAudioSceneChangeCallback`].
///
/// # Arguments
///
/// * `userData` - userdata which is passed by register.
///
/// * `scene` - the latest audio scene.
///
/// Available since API-level: 20
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
pub type OH_AudioManager_OnAudioSceneChangeCallback = ::core::option::Option<
    unsafe extern "C" fn(userData: *mut ::core::ffi::c_void, scene: OH_AudioScene),
>;
extern "C" {
    /// Get audio manager handle.
    ///
    /// # Arguments
    ///
    /// * `audioManager` - the [`OH_AudioManager`] handle received from this function.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOCOMMON_RESULT_SUCCESS`] If the execution is successful.
    /// [`AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM`]:
    /// 1.The param of audioManager is nullptr;
    ///
    /// Available since API-level: 12
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_GetAudioManager(audioManager: *mut *mut OH_AudioManager) -> OH_AudioCommon_Result;
    /// Get audio scene.
    ///
    /// # Arguments
    ///
    /// * `manager` - the [`OH_AudioManager`] handle received from [`OH_GetAudioManager`].
    ///
    /// * `scene` - the [`OH_AudioScene`] pointer to receive the result.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOCOMMON_RESULT_SUCCESS`] If the execution is successful.
    /// [`AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM`]:
    /// 1.The param of audioManager is nullptr;
    /// 2.The param of scene is nullptr.
    ///
    /// Available since API-level: 12
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_GetAudioScene(
        manager: *mut OH_AudioManager,
        scene: *mut OH_AudioScene,
    ) -> OH_AudioCommon_Result;
    /// Register callback to receive audio scene changed events.
    ///
    /// # Arguments
    ///
    /// * `manager` - [`OH_AudioManager`] handle received from [`OH_GetAudioManager`].
    ///
    /// * `callback` - callback function which will be called when audio scene changed.
    ///
    /// * `userData` - pointer to a data structure that will be passed to the callback functions.
    ///
    /// # Returns
    ///
    /// * [`AUDIOCOMMON_RESULT_SUCCESS`] if the execution is successful
    /// [`AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM`]
    /// 1.param of manager is nullptr
    /// 2.param of callback is nullptr
    /// [`#AUDIOCOMMON_RESULT_ERROR_SYSTEM`] system process error occurs
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_AudioManager_RegisterAudioSceneChangeCallback(
        manager: *mut OH_AudioManager,
        callback: OH_AudioManager_OnAudioSceneChangeCallback,
        userData: *mut ::core::ffi::c_void,
    ) -> OH_AudioCommon_Result;
    /// Unregister audio scene change callback.
    ///
    /// # Arguments
    ///
    /// * `manager` - [`OH_AudioManager`] handle received from [`OH_GetAudioManager`].
    ///
    /// * `callback` - callback function which registered in [`OH_AudioManager_RegisterAudioSceneChangeCallback`].
    ///
    /// # Returns
    ///
    /// * [`AUDIOCOMMON_RESULT_SUCCESS`] if the execution is successful
    /// [`AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM`]
    /// 1.param of manager is nullptr
    /// 2.param of callback is nullptr
    /// [`#AUDIOCOMMON_RESULT_ERROR_SYSTEM`] system process error occurs
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_AudioManager_UnregisterAudioSceneChangeCallback(
        manager: *mut OH_AudioManager,
        callback: OH_AudioManager_OnAudioSceneChangeCallback,
    ) -> OH_AudioCommon_Result;
}