Move DeviceTrait implementation to wasapi::device

This commit is contained in:
Viktor Lazarev 2019-08-28 15:14:18 +02:00 • committed by mitchmindtree
parent f57e7c74e4
commit 37e7b5b63b
2 changed files with 28 additions and 26 deletions

View file

@ -68,6 +68,8 @@ use super::winapi::um::mmdeviceapi::{
IMMEndpoint,
};
use crate::traits::DeviceTrait;
pub type SupportedInputFormats = std::vec::IntoIter<SupportedFormat>;
pub type SupportedOutputFormats = std::vec::IntoIter<SupportedFormat>;
@ -87,6 +89,31 @@ pub struct Device {
future_audio_client: Arc<Mutex<Option<IAudioClientWrapper>>>, // TODO: add NonZero around the ptr
}
impl DeviceTrait for Device {
type SupportedInputFormats = SupportedInputFormats;
type SupportedOutputFormats = SupportedOutputFormats;
fn name(&self) -> Result<String, DeviceNameError> {
Device::name(self)
}
fn supported_input_formats(&self) -> Result<Self::SupportedInputFormats, SupportedFormatsError> {
Device::supported_input_formats(self)
}
fn supported_output_formats(&self) -> Result<Self::SupportedOutputFormats, SupportedFormatsError> {
Device::supported_output_formats(self)
}
fn default_input_format(&self) -> Result<Format, DefaultFormatError> {
Device::default_input_format(self)
}
fn default_output_format(&self) -> Result<Format, DefaultFormatError> {
Device::default_output_format(self)
}
}
struct Endpoint {
endpoint: *mut IMMEndpoint,
}