Commit Graph

678 Commits

Author SHA1 Message Date
mitchmindtree 9bf5664f7d Update wasapi and emscripten backends for SupportedStreamConfig private fields 2020-02-02 19:56:30 +01:00
mitchmindtree 009b796b7c Update wasapi backend for SupportedStreamConfig private fields 2020-02-02 19:06:16 +01:00
mitchmindtree f05ba58207 Update emscripten backend for SupportedStreamConfig private fields 2020-02-02 18:50:12 +01:00
mitchmindtree 476f6c4c2c Only allow for private construction of `SupportedStreamConfig`.
This should give the user a higher confidence that, if they have a
`SupportedStreamConfig` format type that it is actually supported.

Also updates the `raw` stream builder methods to take a `StreamConfig`
and `SampleFormat` as separate arguments for flexibility.

**Backends Updated**

- [x] null
- [x] alsa
- [ ] emscripten
- [ ] coreaudio
- [ ] wasapi
- [ ] asio
2020-02-02 18:43:30 +01:00
mitchmindtree 07b66f52f3 Rename FormatNotSupported to StreamConfigNotSupported 2020-01-28 22:55:43 +01:00
mitchmindtree f292391190 Update asio backend for stream format renaming 2020-01-28 16:17:14 +01:00
mitchmindtree 3a692f8bca Update coreaudio backend for stream format renaming 2020-01-28 15:03:27 +01:00
mitchmindtree e0da586f77 Update wasapi backend for stream format renaming 2020-01-28 00:26:15 +01:00
mitchmindtree 669aada98a Update emscripten backend for stream format renaming 2020-01-27 21:44:52 +01:00
mitchmindtree 9c781bd381 Rename stream `Format` types to `Config`
This implements the changes described at #370.

This commit implements only the `null` and `alsa` backends - the rest
will be implemented in follow-up commits.

Closes #370.
2020-01-27 21:28:07 +01:00
mitchmindtree ae910e3fe5
Merge pull request #366 from Ralith/polymorphic-streams
Polymorphic streams
2020-01-27 18:17:09 +01:00
Benjamin Saunders 8d471f3d0e Illustrate alternative structure in beep example 2020-01-21 22:49:31 -08:00
Benjamin Saunders 076b814a15 Introduce polymorphic stream constructors 2020-01-21 22:20:26 -08:00
Benjamin Saunders 78df791377 Add _raw suffix to stream constructors 2020-01-21 21:52:18 -08:00
mitchmindtree 5390c01641
Merge pull request #365 from mitchmindtree/rustfmt
Remove old `.rustfmt.toml` config. Run default `cargo fmt` on repo. Add formatting check github action.
2020-01-21 20:02:17 +01:00
mitchmindtree 7e846b47ad Ensure all crates are formatted correctly, not just `cpal` itself. 2020-01-21 14:18:16 +01:00
mitchmindtree ca255772fd Fix typo in rustfmt github action 2020-01-21 00:25:03 +01:00
mitchmindtree e7979d2dfe Fix some strangely formatted commented code 2020-01-21 00:15:52 +01:00
mitchmindtree cdd49ada2b Add a GitHub action for rustfmt
Checks formatting against the default `cargo fmt` run.
2020-01-20 23:56:04 +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 95cda0dbe8
Merge pull request #364 from mitchmindtree/wasapi-warnings
Address deprecated `mem::uninitialized` warnings in WASAPI host
2020-01-20 20:31:43 +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 10e2458048
Merge pull request #359 from mitchmindtree/remove-unknown-buffer-type
Remove `UnknownTypeBuffer` in favour of specifying sample type.
2020-01-20 20:18:26 +01:00
mitchmindtree d7d82ac863
Merge pull request #3 from mitchmindtree/remove-unknown-buffer-type-alt
An alternative approach to removing `UnknownBufferType`
2020-01-20 18:21:25 +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 01425b4b80 Patch for bindgen update in ASIO backend 2020-01-19 03:39:15 +11: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
mitchmindtree c4ef3ac14c
Merge pull request #362 from simlay/fix-macos-ci
macOS CI
2020-01-16 21:54:54 +01:00
Alex Moon 1b10f92f9d Fix undeclared module errors on Mac. 2020-01-16 12:24:33 -08:00
Sebastian Imlay 9e4ebd86d9 Second attempt at github workflow.
* Added actions/checkout
* cargo build --example beep
2020-01-16 12:01:03 -08:00
Sebastian Imlay ce1d96ea57 Fist attempt at github fix 2020-01-16 11:55:49 -08:00
mitchmindtree 2bf905f3ec
Merge pull request #358 from jbeich/dragonfly
DragonFly support
2020-01-13 15:47:45 +01:00
mitchmindtree 59ac088167
Merge pull request #354 from mitchmindtree/no-eventloop-rebased
Removing the `EventLoop` - rebased
2020-01-13 12:50:05 +01:00
mitchmindtree 4fb1c3f081
Merge pull request #2 from mitchmindtree/no-eventloop-send-sync
Explicitly make dynamically dispatched API !Send + !Sync
2020-01-12 22:53:50 +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
mitchmindtree ca2aceb536 Fix state transition synchronisation in ASIO
This makes some tweaks to the ASIO backend in order to fix some cases
where races may have occured. This should allow us to remove the `Sync`
bound on the `Device` and `Host` types.
2020-01-12 22:40: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
Jan Beich e77634941d Drop alsa-sys dependency on OpenBSD
Unlike other BSDs it never packaged ALSA and prefers everything to use sndio.
2020-01-07 16:15:48 +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