Commit graph

139 commits

Author SHA1 Message Date
Alex Moon
fb30d291ce Avoid calling alsa::PCM::new() multiple times.
Ensures that alsa::PCM::new() is called only once for a given Device so that we are
not rapidly opening and closing ALSA devices.
2020-11-18 10:22:41 -07:00
est31
a65e028412 Update alsa requirement to 0.4.3 and change io to io_bytes 2020-11-08 21:34:20 +01:00
est31
0e0cc39eb4 Release 0.13.1 2020-11-08 15:18:58 +01:00
est31
3ccbcb843c Update ringbuf dev-dependency 2020-11-08 15:02:55 +01:00
Marli Frost
d0696d4814 chore(deps): update parking_lot to 0.11 2020-11-08 10:08:33 +00:00
David Ackerman
d93d06f81e
Update oboe version 2020-11-01 14:09:51 +02:00
enfipy
bf766c1d5d
Update oboe to newest version. Fix support of input/output oboe streams 2020-10-29 19:32:11 +02:00
enfipy
0ff26d163d
Add apk build and alter CI 2020-10-27 21:14:42 +02:00
mitchmindtree
f8775b1e7b
Merge pull request #468 from endragor/android-support
Android support via Oboe
2020-10-27 12:26:33 +01:00
Ruslan Mustakov
4e9d27266c Android support via Oboe 2020-10-24 15:42:21 +07:00
Erik Natanael Gustafsson
2b31fe41af
JACK Host (#389)
Co-authored-by: Federico Dolce <psykopear@gmail.com>
2020-10-01 18:04:43 +09:00
est31
7a8f017b1d
Release 0.12.1 (#456) 2020-07-23 01:28:42 +02:00
est31
42ee11affc Depend on version 0.2 of asio-sys 2020-07-23 00:55:40 +02:00
est31
62ba9a96b0
Publish version 0.12.0 (#443) 2020-07-09 06:40:17 +02:00
est31
ae0fc33b17
lazy_static and num-traits are only used by windows (#442) 2020-07-09 06:08:22 +02:00
Damian Peckett
6f43fc2b60 Add a wasm-bindgen based generic Web Audio backend. 2020-05-06 13:44:00 +02:00
mitchmindtree
63db35ed97
Merge pull request #7 from JoshuaBatty/timestamp_coreaudio_fixes
Timestamp coreaudio fixes
2020-05-01 15:24:15 +02:00
JoshuaBatty
590d37b103 fixes compile errors for coreaudio timestamp work 2020-05-01 15:20:37 +02:00
mitchmindtree
cdf23c3c62 Add stream timestamp implementation to WASAPI backend
This was written on Linux and while the code type-checks, it has not yet
been tested.
2020-04-29 14:59:25 +02:00
Alex Moon
62d540d396 Switch from vendored alsa-sys to alsa crate 2020-04-03 16:56:51 -04:00
mitchmindtree
2bf905f3ec
Merge pull request #358 from jbeich/dragonfly
DragonFly support
2020-01-13 15:47:45 +01: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
msiglreith
972cce0f8c asio: Re-add possibility to create stream individually 2019-12-31 15:46:10 +01:00
mitchmindtree
fe9054f626 Publish version 0.11.0
Please see the CHANGELOG diff below for an overview of changes included
in this release.

You can find the full code diff [here](https://github.com/RustAudio/cpal/compare/391b32f5b2704141506eb4fcb827b8de76e77d54...master).

Thanks to all who have contributed! CPAL has come a long way thanks to
the combined effort of many different people!
2019-12-11 13:28:44 +01:00
mitchmindtree
7b08cb0dae Update examples for switch to thiserror
To compensate for the removal of `failure`'s application friendly
`failure::Error` trait, this `anyhow` crate has been added as a
dev-dependency for the examples, but is by no means a necessity for
other crates downstream of CPAL.
2019-10-13 12:36:49 +02:00
mitchmindtree
d9d4a906c9 Switch to dtolnay's thiserror for handling error boilerplate
Currently CPAL only really uses `failure` for its `derive` capabilities
and the ability to easily generate implementations for `Display`. That
said there are a few issues with using the `failure` crate:

- `failure` does not provie a `std::error::Error` implementation without
  first converting error types into `failure::Error`.
- It leaks significantly into the public API and expects downstream
  users to also depend on `failure` and the non-std `Fail` trait for
  their own error handling.
- Solved problems such as downcasting of causal errors which have since
  been addressed in `std`.
- Provides application-friendly `Fail` trait and `failure::Error` type,
  not particularly useful to libraries like CPAL.

The [`thiserror` crate](https://github.com/dtolnay/thiserror) is better
targeted towards libraries, does not leak into the public API while
providing easy generation of `Display`, `From` and `std::error::Error`
implementations including proper handling of the newish
`std::error::Error::source` method.
2019-10-13 12:29:21 +02:00
Hatchling
5169f53304 Added winapi feature "winbase" in windows dependencies
When using cpal as dependency in other project, it was found that cpal
won't build due to unresolved import of winapi::um::winbase. Added the
feature at line 24 in Cargo.toml.
2019-10-01 14:46:02 +09:00
Mitchell Hentges
624d1f8ce6
Uses ringbuffer in feedback example 2019-09-26 17:19:12 -07:00
mitchmindtree
391b32f5b2 Update CPAL to version 0.10.0.
This is quite a significant update for CPAL, including a number of
breaking changes. Here is a list of the breaking changes along with
links to where you can find more information:

- A `Host` API has been introduced in #289 along with a follow-up
  refactor in #295. Please see the examples for a demonstration of how
  to update your code. The necessary changes should hopefully be
  minimal. If this has caused you any major difficulty please let us
  know in an issue!
- An ASIO host has been introduced in #292. This adds support for
  Steinberg's ASIO audio driver API on Windows. Please see the ASIO
  section of the README for more information on how to setup CPAL with
  ASIO support for your project.
- The user callback API has been overhauled to emit `StreamEvent`s
  rather than buffers in order to support handling stream errors. #288.
- Error handling in general was overhauled in #286. This meant taking
  advantage of the `failure` crate and adding support for
  backend-specific errors with custom messages. Many unnecessary
  `panic!`s have been removed, but a few remain that would indicate bugs
  in CPAL.

In general, checking out the updated examples will be the easiest way to
get a quick overview on how you can update your own code for these
changes.

The CHANGELOG.md has been updated to include these changes.
2019-07-05 19:37:17 +02:00
mitchmindtree
4cbbcbe316
Merge pull request #293 from EmbarkStudios/master
Bump dependencies
2019-07-05 19:17:07 +02:00
mitchmindtree
8f95042b8d Add asio cargo feature for optional ASIO support
ASIO introduces quite a few extra crates and requires a fairly
complicated setup process (see the readme), so this feature is disabled
by default.
2019-07-05 05:51:30 +10:00
Tom Gowan
49bc3ee367 remove release symbols 2019-07-05 05:51:28 +10:00
Tom Gowan
616974353b opt in and bug fix 2019-07-05 05:51:26 +10:00
Tom Gowan
b0b0484d4b endian conversion 2019-07-05 05:51:25 +10:00
Tom Gowan
91f2edb277 utils as mod 2019-07-05 05:51:24 +10:00
Tom Gowan
d430000d2c beep working 2019-07-05 05:51:22 +10:00
Tom Gowan
8d5cb951d8 asio_utils 2019-07-05 05:51:22 +10:00
DMSDeveloper
9a084347db removed itertools 2019-07-05 05:51:21 +10:00
Tom Gowan
49968f4b82 change of branch 2019-07-05 05:51:21 +10:00
Jake Shadle
d59b4decf7 Return stdweb to old version 2019-07-01 17:44:23 +02:00
Jake Shadle
04b6d66eed Bump dependencies 2019-07-01 17:43:18 +02:00
mitchmindtree
1275db805b Remove std Error implementations in favour of using failure
This will make adding new errors in the following commits towards better
error handling a lot easier.
2019-06-20 21:12:17 +02:00
Austin Johnson
49b2c42443 add changelog entries for #248 #254 & #269; update version to 0.9.0 2019-06-06 10:29:52 -05:00
Austin Johnson
78adc983f6 update hound & lazy_static; release 0.8.2 2019-06-06 00:49:49 -05:00
Jacob Kiesel
568d4097e7 Upgrade lazy_static (#232) 2018-07-03 21:07:08 +02:00
mitchmindtree
a2fe9386af [coreaudio] Fix handling of non-default sample rates for input streams (#214)
* [coreaudio] Fix handling of non-default sample rates for input streams

Currently when building an input stream the coreaudio backend only
specifies the sample rate for the audio unit, however coreaudio requires
that the audio unit sample rate matches the device sample rate.

This changes the `build_input_stream` behaviour to:

1. Check if the device sample rate differs from the desired one.
2. If so, check that there are no existing audio units using the device
at the current sample rate. If there are, panic with a message
explaining why.
3. Otherwise, change the device sample rate.
4. Continue building the input stream audio unit as normal.

Closes #213.

* Update CHANGELOG for coreaudio input stream sample rate fix

* Publish 0.8.1 for coreaudio input stream sample rate fix
2018-04-01 13:25:46 +02:00
mitchmindtree
06a0f0a3ab Publish 0.8 for new Device and Stream API. Update CHANGELOG. (#209) 2018-02-15 08:47:43 +01:00
mitchmindtree
c38bbb26e4 Update to a more general Device and Stream API. Add support for input streams (E.g. microphone). Add default format methods. (#201)
* Update to a more general Device and Stream API

This update prepares for adding input stream support by removing the
`Endpoint` type (which only supports output streams) in favour of a more
general `Device` type which may support any number of input or output
streams. Previously discussed at #117.

The name `Voice` has been replaced with the more ubiquitous name
`Stream`. See #118 for justification.

Also introduces a new `StreamData` which is now passed to the
`EventLoop::run` callback rather than the `UnknownTypeBuffer`.
`StreamData` allows for passing either `Input` data to be read, or
`Output` data to be written.

The `beep.rs` example has been updated for the API changes.

None of the backends have been updated for this API change yet. Backends
will be updated in the following commits.

Closes #117.
Closes #118.

* Update ALSA backend for new `Device` and `Stream` API.

* Update wasapi backend for new `Device` and `Stream` API.

* Update enumerate.rs example for new `Device` and `Stream` API.

* Update coreaudio backend for new `Device` and `Stream` API.

* Fix lib doc tests for Device and Stream API update

* Update emscripten backend for new `Device` and `Stream` API.

* Update null backend for new `Device` and `Stream` API.

* Merge match exprs in beep.rs example

* Add Input variant along with UnknownTypeInputBuffer and InputBuffer

UnknownTypeBuffer and Buffer have been renamed to
UnknownTypeOutputBuffer and OutputBuffer respectively.

No backends have yet been updated for this name change or the addition
of the InputBuffer.

* Update null backend for introduction of InputBuffer

* Update emscripten backend for introduction of InputBuffer

* Make InputBuffer inner field an option to call finish in drop

* Update alsa backend for introduction of InputBuffer

* Update wasapi backend for introduction of InputBuffer

* Update coreaudio backend for introduction of InputBuffer

* Update enumerate.rs example to provide more detail about devices

The enumerate.rs example now also displays:

- Supported input stream formats.
- Default input stream format.
- Default output stream format.

This should also be useful for testing the progress of #201.

* Add `record_wav.rs` example for demonstrating input streams

Records a ~3 second WAV file to `$CARGO_MANIFEST_DIR/recorded.wav` using
the default input device and default input format.

Uses hound 3.0 to create and write to the WAV file.

This should also be useful for testing the input stream implementations
for each different cpal backend.

* Implement input stream support for coreaudio backend

This implements the following for the coreaudio backend:

- Device::supported_input_formats
- Device::default_input_format
- Device::default_output_format
- EventLoop::build_input_stream

The `enumerate.rs` and `record_wav.rs` examples now work successfully on
macos.

* Add `SupportedFormat::cmp_default_heuristics` method

This adds a comparison function which compares two `SupportedFormat`s in
terms of their priority of use as a default stream format.

Some backends (such as ALSA) do not provide a default stream format for
their audio devices. In these cases, CPAL attempts to decide on a
reasonable default format for the user. To do this we use the "greatest"
of all supported stream formats when compared with this method.

* Implement input stream support for ALSA backend

This implements the following for the ALSA backend:

- Device::supported_input_formats
- Device::default_input_format
- Device::default_output_format
- EventLoop::build_input_stream

Note that ALSA itself does not give default stream formats for its
devices. Thus the newly added `SupportedFormat::cmp_default_heuristics`
method is used to determine the most suitable, supported stream format
to use as the default.

The `enumerate.rs` and `record_wav.rs` examples now work successfully on
my linux machine.

* Implement input stream support for wasapi backend

This implements the following for the wasapi backend:

- Device::supported_input_formats
- Device::default_input_format
- Device::default_output_format
- EventLoop::build_input_stream

Note that wasapi does not enumerate supported input/output stream
formats for its devices. Instead, we query the `IsFormatSupported`
method for supported formats ourselves.

* Fix some warnings in the alsa backend

* Update CHANGELOG for introduction of input streams and related items

* Update README to show latest features supported by CPAL

* Simplify beep example using Device::default_output_format

* Remove old commented code from wasapi/stream.rs
2018-02-12 14:10:24 +01:00
mitchmindtree
b47e46a4ac Update winapi version from 0.2 to 0.3 (#202)
Adds only the necessary cargo features to reduce compile time and reduce
the chance of linking errors occurring for unused libraries (e.g.
d3d12.dll fails to link on my win10 VM).

I thought I'd try and land this before before working on the wasapi
backend implementation for #201.

Tested both beep.rs and enumerate.rs and they work fine with the update.
2018-02-07 17:36:59 +01:00
Pierre Krieger
3ff9e6fe65
Publish 0.7 (#200) 2018-02-04 13:03:03 +01:00