Commit Graph

365 Commits

Author SHA1 Message Date
mitchmindtree e7979d2dfe Fix some strangely formatted commented code 2020-01-21 00:15:52 +01:00
mitchmindtree aab0d90add Remove old `.rustfmt.toml` config. Run default `cargo fmt` on repo.
Seeing as a few large refactors have landed recently, I thought I'd take
this opportunity to do a `cargo fmt` run and standardise on the default
rustfmt settings.
2020-01-20 20:35:23 +01:00
mitchmindtree a7008b63a5 Address deprecated `mem::uninitialized` warnings in WASAPI host
This uses `ptr::null_mut()` and `MaybeUninit` to remove use of
deprecated `mem::uninitialized()` which could possibly result in UB.
2020-01-20 20:22:15 +01:00
mitchmindtree 64f8fd12cc Update CoreAudio host for the addition of the new stream `Data` type 2020-01-19 19:42:43 +01:00
mitchmindtree c0a28b5198 Update ASIO host for addition of new stream `Data` type. 2020-01-19 19:35:35 +01:00
mitchmindtree 1b5cf579cb Update WASAPI backend for addition of new stream `Data` type 2020-01-19 19:17:40 +01:00
mitchmindtree dbb1cc4140 Add some notes for devs about the safety requirements of `Data` 2020-01-19 19:05:17 +01:00
mitchmindtree 3fdf189848 Update docs for addition of the new stream Data type 2020-01-19 16:16:09 +01:00
mitchmindtree 7f27b897bb Update emscripten backend for new stream Data type 2020-01-19 16:04:06 +01:00
mitchmindtree 58356f49b4 An alternative approach to removing `UnknownBufferType`.
This is a potential alternative to #359. This PR is based on #359.

This approach opts for a dynamically checked sample type approach with
the aim of minimising compile time and binary size.

You can read more discussion on this [here](https://github.com/RustAudio/cpal/pull/359#issuecomment-575931461)

Implemented backends:

- [x] null
- [x] ALSA
- [ ] CoreAudio
- [ ] WASAPI
- [ ] ASIO
- [ ] Emscripten
2020-01-19 15:06:19 +01:00
mitchmindtree 6fbb701826 Update CoreAudio backend for removal of `UnknownBufferType` 2020-01-18 15:15:41 +01:00
mitchmindtree 9e832c6eb3 Update ASIO backend for removal of `UnknownBufferType` 2020-01-18 15:13:17 +01:00
mitchmindtree b5bfb8d422 Update WASAPI backend for removal of `UnknownTypeBuffer` 2020-01-18 15:13:17 +01:00
mitchmindtree 5a619877f9 Update docs for removal of UnknownTypeBuffer 2020-01-18 15:13:17 +01:00
mitchmindtree 6fc2185c99 Update emscripten backend for removal of `UnknownTypeBuffer` 2020-01-18 15:13:17 +01:00
mitchmindtree 05b62bb1c0 Remove `UnknownTypeBuffer` in favour of specifying sample type.
This is an implementation of the planned changes described in #119.

For a quick overview of how the API has changed, check out the updated
examples.

**TODO:**

- [x] Update API.
- [x] Update examples.
- [ ] Remove `data_type` field from `Format` (see [here](https://github.com/RustAudio/cpal/issues/119#issuecomment-573788380)).
- Update backends:
  - [x] null
  - [x] ALSA
  - [ ] ASIO
  - [ ] WASAPI
  - [ ] CoreAudio
  - [ ] Emscripten

Closes #119
Closes #260
2020-01-18 15:13:17 +01:00
Alex Moon 1b10f92f9d Fix undeclared module errors on Mac. 2020-01-16 12:24:33 -08:00
mitchmindtree 2bf905f3ec
Merge pull request #358 from jbeich/dragonfly
DragonFly support
2020-01-13 15:47:45 +01:00
mitchmindtree 32d39bcfd3 Relax `Sync` restriction on `Device` and `Host`
Originally this restriction was placed due to uncertainty around the
thread safety of the ASIO API. While the ASIO API itself makes no
thread-safety guarantees that we are aware of, the `asio-sys` high-level
bindings enforce synchronised access to the API and state transitions
via a mutex.
2020-01-12 22:43:05 +01:00
Jan Beich 3ac6f6a689 Enable ALSA on DragonFly
DragonFly like FreeBSD uses OSS under the hood but OSS backend isn't
available, so use ALSA.
2020-01-07 16:18:52 +00:00
mitchmindtree 33ddf74954 Explicitly make dynamically dispatched API !Send + !Sync
This is in order to ensure consistent restrictions across platforms in a
manner that ensures thread safety across each of the supported
platforms.

Please see added comments in the diff for details on which platforms
impose these restrictions.
2020-01-05 17:43:14 +01:00
mitchmindtree 2afebb2806 Clarify the current state of stream behaviour in docs and comments 2019-12-31 16:02:08 +01:00
mitchmindtree 39ade49347 RAII cleanup wthin the ASIO backend
- Shares the `Device`'s `driver` and `asio_streams` `Arc`s with the
`Stream`s to ensure they remain valid if the `Host` or `Device` are
dropped early.
- Ensures that a stream's callback is removed upon `Drop`.
2019-12-31 15:46:10 +01:00
msiglreith 972cce0f8c asio: Re-add possibility to create stream individually 2019-12-31 15:46:10 +01:00
msiglreith bfda575218 Port ASIO host to new stream-based API 2019-12-31 15:46:10 +01:00
Viktor Lazarev 64ba84de81 Move code from stream to device 2019-12-31 15:46:10 +01:00
mitchmindtree f34a062fac Update docs for removal of the `EventLoop` 2019-12-31 15:46:10 +01:00
mitchmindtree 27245444a7 Remove redundant from backend 2019-12-31 15:45:15 +01:00
mitchmindtree 37d80b98cf Update the `emscripten` backend for the removal of the `EventLoop`
For the most part, behaviour should be largely unchanged, however each
individual stream now has its own `set_timeout` callback loop, rather
than using one for processing all streams at once.

Many TODOs remain within the `emscripten` backend. These were left
untouched for the most part in favour of addressing this in a more
web-focused, future PR.
2019-12-31 15:45:15 +01:00
Tatsuyuki Ishi 70dcf2390a Port CoreAudio backend 2019-12-31 15:45:15 +01:00
ishitatsuyuki c09a58ac02 Fix the remainder of WASAPI backend 2019-12-31 15:42:35 +01:00
Tatsuyuki Ishi 7f7914434c Additional clippy fixes 2019-12-31 15:42:35 +01:00
Viktor Lazarev d46415a6e7 `cargo clippy` 2019-12-31 15:42:35 +01:00
Tatsuyuki Ishi 49a38c2641 Fix up WASAPI host 2019-12-31 15:42:35 +01:00
Viktor Lazarev d4965d3673 `cargo fmt` 2019-12-31 15:42:35 +01:00
Viktor Lazarev c62cb48e19 Apply suggestions proposed by Clippy 2019-12-31 15:42:35 +01:00
Viktor Lazarev 10dc779943 Return back missed play/pause implementation 2019-12-31 15:42:35 +01:00
Viktor Lazarev a218dc90e6 Fixing compile errors 2019-12-31 15:42:35 +01:00
Viktor Lazarev a412b00336 Fix the "Stream::new' method 2019-12-31 15:42:35 +01:00
Viktor Lazarev e7f708701c Remove old code 2019-12-31 15:42:35 +01:00
Viktor Lazarev 1021141d16 Fix "build_input/output_stream_inner" methods 2019-12-31 15:42:35 +01:00
Viktor Lazarev f65d0e65bc Expose Stream instead of StreamId 2019-12-31 15:42:35 +01:00
Viktor Lazarev 125bebd733 Clean up wasdapi mod 2019-12-31 15:42:35 +01:00
Viktor Lazarev d12d9f479b Remove redundant field names 2019-12-31 15:42:35 +01:00
Viktor Lazarev 7765e941ed Implement Drop for Stream 2019-12-31 15:42:35 +01:00
Viktor Lazarev 0541bf8667 Add Stream struct 2019-12-31 15:42:35 +01:00
Viktor Lazarev e25c44a4a1 Move code from stream to device 2019-12-31 15:42:35 +01:00
Viktor Lazarev dd418c08ae Adjust "process_commands" and "Command" 2019-12-31 15:42:35 +01:00
Viktor Lazarev 28cf3fee43 Fix "run_inner" fn 2019-12-31 15:42:35 +01:00
Viktor Lazarev b00630bdcc Extract "run_inner" as a standalone function 2019-12-31 15:42:35 +01:00