pub mod analyzer;
pub mod backend;
pub mod buffer;
#[cfg(target_os = "macos")]
pub mod coreaudio_backend;
#[cfg(target_os = "linux")]
pub mod cpal_backend;
#[cfg(target_os = "macos")]
pub mod device;
pub mod dsp;
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))]
pub mod engine;
pub mod fade;
#[cfg(any(target_os = "ios", target_os = "tvos", all(test, target_os = "macos")))]
#[cfg_attr(not(any(target_os = "ios", target_os = "tvos")), allow(dead_code))]
pub mod ios_backend;
pub mod opus;
pub mod replaygain;
pub mod streaming;
#[cfg(target_os = "tvos")]
mod toolbox;
pub mod viz;
use backend::{AudioBackend, BackendError, DeviceInfo};
pub fn platform_backend() -> Box<dyn AudioBackend> {
#[cfg(target_os = "macos")]
{
Box::new(coreaudio_backend::CoreAudioBackend)
}
#[cfg(target_os = "linux")]
{
Box::new(cpal_backend::CpalBackend::new())
}
#[cfg(any(target_os = "ios", target_os = "tvos"))]
{
Box::new(ios_backend::IosAudioBackend)
}
}
pub(crate) fn session_held() -> bool {
#[cfg(any(target_os = "ios", target_os = "tvos"))]
{
ios_backend::session_held()
}
#[cfg(not(any(target_os = "ios", target_os = "tvos")))]
{
false
}
}
pub(crate) fn release_session() {
#[cfg(any(target_os = "ios", target_os = "tvos"))]
ios_backend::release_session();
}
pub(crate) fn follow_route() {
#[cfg(any(target_os = "ios", target_os = "tvos"))]
ios_backend::follow_route();
}
pub fn list_output_devices() -> Result<Vec<DeviceInfo>, BackendError> {
platform_backend().list_devices()
}
pub fn default_output_device() -> Result<DeviceInfo, BackendError> {
platform_backend().default_device()
}