use crate::Error;
use crate::audio_codecs::AudioCodec;
use crate::cpal_abstraction::{Device, SampleType, SamplesTrait};
use crate::samples_player::SamplesPlayerTrait;
use crate::errors::PlayError;
pub trait AudioFileTrait {
fn get_samples(&self) -> Error<Box<dyn SamplesTrait>>;
fn make_player(&self, is_exact: bool) -> Error<Box<dyn SamplesPlayerTrait>>;
fn play(&self, device: Device, is_exact: bool) -> Error<Box<dyn SamplesPlayerTrait>>;
fn play_on_default_output(&self, is_exact: bool) -> Error<Box<dyn SamplesPlayerTrait>> {
let device = match Device::default_output() {
Some(d) => d,
None => return Err(PlayError::DeviceDoesNotExist { name: "default".to_string() })
};
self.play(device, is_exact)
}
fn metadata(&self) -> Box<dyn AudioMetadataTrait>;
}
pub trait AudioMetadataTrait {
fn file_path(&self) -> Option<String>;
fn audio_codec(&self) -> AudioCodec;
fn channels(&self) -> u32;
fn sample_rate(&self) -> u32;
fn sample_type(&self) -> Option<SampleType>;
}