Refactor asio-sys to use less global state and more RAII
The asio-sys examples have been tested and still work nicely. The CPAL asio host has not yet been updated for these changes.
This commit is contained in:
parent
05f8b7dc43
commit
efe683133c
4 changed files with 486 additions and 706 deletions
|
|
@ -1,13 +1,11 @@
|
|||
extern crate asio_sys as sys;
|
||||
|
||||
fn main() {
|
||||
let driver_list = sys::get_driver_list();
|
||||
|
||||
for driver in &driver_list {
|
||||
let asio = sys::Asio::new();
|
||||
for driver in asio.driver_names() {
|
||||
println!("Driver: {}", driver);
|
||||
|
||||
let driver = sys::Drivers::load(driver).expect("failed to load drivers");
|
||||
println!(" Channels: {:?}", driver.get_channels());
|
||||
println!(" Sample rate: {:?}", driver.get_sample_rate());
|
||||
let driver = asio.load_driver(&driver).expect("failed to load drivers");
|
||||
println!(" Channels: {:?}", driver.channels().expect("failed to get channels"));
|
||||
println!(" Sample rate: {:?}", driver.sample_rate().expect("failed to get sample rate"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue