The hardcoded errno was replaced by a constant, and `snd_pcm_prepare` was replaced by `snd_pcm_recover` per best practice (the underlying implementation seems same for now, though).
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.
This existed prior to the introduction of the `Host` API, but was lost
in translation. This re-adds the bounds so that downstream code does not
suddenly break due to a lacking `Hash` implementation in the next
CPAL version.
This adds an implementation of ASIO message handling in a manner that
matches that demonstrated in the SDK's `hostsample.cpp` file.
Also refactors the code to ensure that both `buffer_switch` and
`buffer_switch_time_info` callbacks are handled.
Most of this is an attempt at improving readability and modularity of
the asio-sys crate while attempting to review it for correctness. Still
unsure why glitching is occasionally occuring on output, but recorded
input sounds perfectly clean.
ASIO has a limitation where it only supports loading a single audio
driver at a time. This fixes a common error where CPAL users would
request both the default input device and output device in separate
`load_driver` calls. Now, `load_driver` will return another handle to
the existing driver if the existing driver has the same name.
Instead, we use some traits and generics in an attempt to retain a
little readability. See the remaining TODOs in this section for required
future work.
Currently not compiling - still need to address some global items within
asio-sys, including the `set_callback` function and the double buffer
globals.
Now runs the beep and enumerate examples nicely! Time to do a proper
code review of the ASIO stuff and see how to best take advantage of the
new `Host` API.
Also adds a note about the `CPAL_ASIO_SDK` environment variable
determining whether or not cpal will attempt to build ASIO and generate
bindings to it.