From 125bebd733bcfd989f28072bc2b618b0d0b28163 Mon Sep 17 00:00:00 2001 From: Viktor Lazarev Date: Thu, 29 Aug 2019 08:17:46 +0200 Subject: [PATCH] Clean up wasdapi mod --- src/host/wasapi/mod.rs | 59 ++---------------------------------------- 1 file changed, 2 insertions(+), 57 deletions(-) diff --git a/src/host/wasapi/mod.rs b/src/host/wasapi/mod.rs index d833ac4..cf1e997 100644 --- a/src/host/wasapi/mod.rs +++ b/src/host/wasapi/mod.rs @@ -1,20 +1,12 @@ extern crate winapi; use BackendSpecificError; -use BuildStreamError; -use DefaultFormatError; -use DeviceNameError; use DevicesError; -use Format; -use PlayStreamError; -use PauseStreamError; -use StreamDataResult; -use SupportedFormatsError; use self::winapi::um::winnt::HRESULT; use std::io::Error as IoError; -use traits::{EventLoopTrait, HostTrait, StreamIdTrait}; +use traits::{HostTrait}; pub use self::device::{Device, Devices, SupportedInputFormats, SupportedOutputFormats, default_input_device, default_output_device}; -pub use self::stream::{EventLoop, StreamId}; +pub use self::stream::{StreamId}; mod com; mod device; @@ -37,7 +29,6 @@ impl Host { impl HostTrait for Host { type Devices = Devices; type Device = Device; - type EventLoop = EventLoop; fn is_available() -> bool { // Assume WASAPI is always available on windows. @@ -55,54 +46,8 @@ impl HostTrait for Host { fn default_output_device(&self) -> Option { default_output_device() } - - fn event_loop(&self) -> Self::EventLoop { - EventLoop::new() - } } -impl EventLoopTrait for EventLoop { - type Device = Device; - type StreamId = StreamId; - - fn build_input_stream( - &self, - device: &Self::Device, - format: &Format, - ) -> Result { - EventLoop::build_input_stream(self, device, format) - } - - fn build_output_stream( - &self, - device: &Self::Device, - format: &Format, - ) -> Result { - EventLoop::build_output_stream(self, device, format) - } - - fn play_stream(&self, stream: Self::StreamId) -> Result<(), PlayStreamError> { - EventLoop::play_stream(self, stream) - } - - fn pause_stream(&self, stream: Self::StreamId) -> Result<(), PauseStreamError> { - EventLoop::pause_stream(self, stream) - } - - fn destroy_stream(&self, stream: Self::StreamId) { - EventLoop::destroy_stream(self, stream) - } - - fn run(&self, callback: F) -> ! - where - F: FnMut(Self::StreamId, StreamDataResult) + Send, - { - EventLoop::run(self, callback) - } -} - -impl StreamIdTrait for StreamId {} - #[inline] fn check_result(result: HRESULT) -> Result<(), IoError> { if result < 0 {