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;
use crate::audiostream_base::{
    OH_AudioStreamInfo, OH_AudioStream_DirectPlaybackMode, OH_AudioStream_SourceType,
    OH_AudioStream_Usage,
};

/// Declare the audio stream manager.
/// Audio stream manager provides many functions about audio streams, like monitoring audio streams status,
/// getting different stream types supported information and so on.
///
///
/// Available since API-level: 19
#[cfg(feature = "api-19")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
#[repr(C)]
pub struct OH_AudioStreamManager {
    _unused: [u8; 0],
}
extern "C" {
    /// Fetch the audio streammanager handle, which is a singleton.
    ///
    /// # Arguments
    ///
    /// * `streamManager` - output parameter to get the [`#OH_AudioStreamManager`].
    ///
    /// # Returns
    ///
    /// * [`#AUDIOCOMMON_RESULT_SUCCESS`] if execution succeeds
    /// [`#AUDIOCOMMON_RESULT_ERROR_SYSTEM`] if system state error
    ///
    /// Available since API-level: 19
    #[cfg(feature = "api-19")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
    pub fn OH_AudioManager_GetAudioStreamManager(
        streamManager: *mut *mut OH_AudioStreamManager,
    ) -> OH_AudioCommon_Result;
    /// Gets the mode of direct playback available for a given audio format with current active device.
    ///
    /// # Arguments
    ///
    /// * `audioStreamManager` - the [`OH_AudioStreamManager`] handle provided by
    /// [`OH_AudioManager_GetAudioStreamManager`].
    ///
    /// * `streamInfo` - the [`OH_AudioStreamInfo`].
    ///
    /// * `usage` - the [`OH_AudioStream_Usage`].
    ///
    /// * `directPlaybackMode` - the [`OH_AudioStream_DirectPlaybackMode`] pointer to a variable which receives the
    /// result.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOCOMMON_RESULT_SUCCESS`] If the execution is successful.
    /// [`AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM`]:
    /// 1.The param of audioStreamManager is nullptr;
    /// 2.The param of streamInfo is nullptr;
    /// 3.The param of usage invalid;
    /// 4.The param of directPlaybackMode is nullptr.
    ///
    /// Available since API-level: 19
    #[cfg(feature = "api-19")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
    pub fn OH_AudioStreamManager_GetDirectPlaybackSupport(
        audioStreamManager: *mut OH_AudioStreamManager,
        streamInfo: *mut OH_AudioStreamInfo,
        usage: OH_AudioStream_Usage,
        directPlaybackMode: *mut OH_AudioStream_DirectPlaybackMode,
    ) -> OH_AudioCommon_Result;
    /// Query whether acoustic echo canceler is supported by input source.
    ///
    /// # Arguments
    ///
    /// * `streamManager` - The [`OH_AudioStreamManager`] handle provided
    /// by [`OH_AudioManager_GetAudioStreamManager`].
    ///
    /// * `sourceType` - Related source type.
    ///
    /// * `supported` - Pointer to get the result.
    ///
    /// # Returns
    ///
    /// * Function result code:
    /// [`AUDIOCOMMON_RESULT_SUCCESS`] If the execution is successful.
    /// [`AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM`]:
    /// 1.The input param streamManager is nullptr;
    /// 2.Source type is invalid.
    /// 3.The input param supported is nullptr.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_AudioStreamManager_IsAcousticEchoCancelerSupported(
        streamManager: *mut OH_AudioStreamManager,
        sourceType: OH_AudioStream_SourceType,
        supported: *mut bool,
    ) -> OH_AudioCommon_Result;
    /// Return if fast playback is supported for the specific audio stream info and usage type
    /// in current device situation.
    ///
    /// # Arguments
    ///
    /// * `streamManager` - [`OH_AudioStreamManager`] handle
    /// provided by [`OH_AudioManager_GetAudioStreamManager`].
    ///
    /// * `streamInfo` - reference of stream info structure to describe basic audio format.
    ///
    /// * `usage` - stream usage type used to decide the audio device and pipe type selection result.
    ///
    /// # Returns
    ///
    /// * `true` if fast playback is supported in this situation.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_AudioStreamManager_IsFastPlaybackSupported(
        streamManager: *mut OH_AudioStreamManager,
        streamInfo: *mut OH_AudioStreamInfo,
        usage: OH_AudioStream_Usage,
    ) -> bool;
    /// Return if fast recording is supported for the specific audio stream info and source type
    /// in current device situation.
    ///
    /// # Arguments
    ///
    /// * `streamManager` - [`OH_AudioStreamManager`] handle
    /// provided by [`OH_AudioManager_GetAudioStreamManager`].
    ///
    /// * `streamInfo` - reference of stream info structure to describe basic audio format.
    ///
    /// * `source` - stream source type used to decide the audio device and pipe type selection result.
    ///
    /// # Returns
    ///
    /// * `true` if fast recording is supported in this situation.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_AudioStreamManager_IsFastRecordingSupported(
        streamManager: *mut OH_AudioStreamManager,
        streamInfo: *mut OH_AudioStreamInfo,
        source: OH_AudioStream_SourceType,
    ) -> bool;
    /// Return if the system recording enables intelligent noise reduction for current device.
    ///
    /// # Arguments
    ///
    /// * `streamManager` - [`OH_AudioStreamManager`] handle
    /// provided by [`OH_AudioManager_GetAudioStreamManager`].
    ///
    /// * `source` - stream source type used to decide the audio device and pipe type selection result.
    ///
    /// # Returns
    ///
    /// * `true` if the system recording enables intelligent noise reduction for current device.
    ///
    /// Available since API-level: 21
    #[cfg(feature = "api-21")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
    pub fn OH_AudioStreamManager_IsIntelligentNoiseReductionEnabledForCurrentDevice(
        streamManager: *mut OH_AudioStreamManager,
        source: OH_AudioStream_SourceType,
    ) -> bool;
}