-
-
Save m-hilgendorf/3cb26792575a1a8a72893f922c15cd72 to your computer and use it in GitHub Desktop.
draft of audio HAL API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub struct DeviceInfo { | |
id : i32, | |
name : [u8; 64], | |
num_input_channels : usize, | |
num_output_channels : usize, | |
} | |
pub trait Stream { | |
fn start(self, sample_rate : usize, buffer_size : usize) -> Self; | |
fn stop(self) -> Self; | |
} | |
struct StreamParameters { | |
pub num_ins : usize, | |
pub num_outs : usize, | |
pub sample_rate : usize, | |
pub buffer_size : usize, | |
} | |
pub trait Device { | |
type SampleRateIter : Iterator<usize>; | |
type BufferSizeIter : Iterator<usize>; | |
type DeviceInfoIter : Iterator<DeviceInfo>; | |
type StreamHandle : Stream; | |
fn devices() -> Self::DeviceInfoIter; | |
fn sample_rates(d : &DeviceInfo) -> Self::SampleRateIter; | |
fn buffer_sizes(d : &DeviceInfo) -> Self::DeviceInfoIter; | |
fn default_input() -> &DeviceInfo; | |
fn default_output() ->&DeviceInfo; | |
fn open_input_stream ( | |
params : StreamParameters, | |
input : Option<DeviceInfo>, | |
output : Option<DeviceInfo>, | |
callback : CbkFn) -> (Self::StreamHandle, StreamParameters); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment