3fb3652f81 | ||
---|---|---|
src | ||
.editorconfig | ||
.gitignore | ||
Cargo.toml | ||
LICENSE | ||
README.md |
README.md
cubeb-coreaudio-rs
Implementation of MacOS Audio backend in CoreAudio framework for Cubeb written in Rust.
Current Goals
- Translate C code line by line into Rust
- Create tests for later refactoring
TODO
- Test aggregate devices
- Test for stream operations
- Clean up the tests. Merge the duplicated pieces in to a function.
- Find a way to catch memory leaks
- Try Instrument on OSX
Issues
- Mutex: Find a replacement for
owned_critical_section
- a dummy mutex like
Mutex<()>
should work (seetest_dummy_mutex_multithread
) as whatowned_critical_section
does in C version, but it doens't has similar API likeassert_current_thread_owns
. - We implement a
OwnedCriticalSection
aroundpthread_mutex_t
like what we do in C version for now.
- a dummy mutex like
- Unworkable API:
dispatch_async
- The second parameter of
dispatch_async
isdispatch_block_t
, which is defined bytypedef void (^dispatch_block_t)(void)
. - The caret symbol
^
defines a block. - The block is a lambda expression-like syntax to create closures. (See Apple's document: Working with Blocks)
- Not sure if Rust can work with it. Rust has its own closure.
- For now, we implement an API
async_dispatch
to replacedispatch_async
async_dispatch
is based ondispatch_async_f
.async_dispatch
takes a Rust closure (instead of Apple's block) as one of its parameter.- prototype on gist
- The closure (it's a struct) will be
box
ed, which means the closure will be moved into heap, so the closure cannot be optimized as inline code. - Since the closure will be run on an asynchronous thread, we need to move the closure to heap in case it's destroyed when the other thread want to use it.
- The closure (it's a struct) will be
- The second parameter of