Commit Graph

24 Commits

Author SHA1 Message Date
mitchmindtree aae44cf3d6 Fix process_callback function signatures in asio backend 2020-04-16 15:30:14 +02:00
mitchmindtree bcf962c447 Add a `CallbackInfo` argument to the stream data callback
I began on an implementation of the timestamp API described in #363 but
quickly realised that it might be best to land the API for providing
extra information to the user's callback first.

This PR adds two new types: `InputCallbackInfo` and `OutputCallbackInfo`.
These types are delivered to the user's data callback as a new, second
argument.

While these types are currently empty, the intention is for these types
to provide information relevant to the current request for or delivery
of data. This includes:

- Timestamp information #363.
- Flags related to the state of the stream (e.g buffer
  underflow/overflow).

In order to maintain flexibility to avoid breaking things, I figure we
can keep the fields of these types private and provide methods for
retrieving this info.

@Ralith, @ishitatsuyuki does this seem OK to you?
2020-04-16 14:50:36 +02:00
mitchmindtree 9bf5664f7d Update wasapi and emscripten backends for SupportedStreamConfig private fields 2020-02-02 19:56: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
Benjamin Saunders 78df791377 Add _raw suffix to stream constructors 2020-01-21 21:52:18 -08: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 c0a28b5198 Update ASIO host for addition of new stream `Data` type. 2020-01-19 19:35:35 +01:00
mitchmindtree 9e832c6eb3 Update ASIO backend for removal of `UnknownBufferType` 2020-01-18 15:13:17 +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
mitchmindtree 64dc6accf9 Rebase for the trait refactor in #295. 2019-07-05 06:03:33 +10:00
mitchmindtree cc5b0555c2 Refactor of asio-sys while reviewing for code correctness
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.
2019-07-05 05:51:31 +10:00
mitchmindtree 9182f00e20 Check that sample format is supported by ASIO when building streams 2019-07-05 05:51:31 +10:00
mitchmindtree c432f2b18d Update asio-sys to allow for having multiple handles to the same driver
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.
2019-07-05 05:51:31 +10:00
mitchmindtree 191b90909a Make Driver type responsible for managing user callbacks 2019-07-05 05:51:30 +10:00
mitchmindtree 4dafb212fb Refactor build_input_stream callback to, like recent output refactor 2019-07-05 05:51:30 +10:00
mitchmindtree cc70a10c12 Remove unused supported_formats_err function 2019-07-05 05:51:29 +10:00
mitchmindtree dc6c5c5a7c Remove unnecessary asio_utils mod 2019-07-05 05:51:29 +10:00
mitchmindtree 50aa0585be Remove unwieldy macro from output stream callback
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.
2019-07-05 05:51:29 +10:00
mitchmindtree d739a5b79d Majority of ASIO host update following refactor
Currently not compiling - still need to address some global items within
asio-sys, including the `set_callback` function and the double buffer
globals.
2019-07-05 05:51:29 +10:00
mitchmindtree 05f8b7dc43 Fix remaining compile errors for ASIO host
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.
2019-07-05 05:51:28 +10:00
mitchmindtree 09fd5562be Update ASIO implementation for new error handling and Host API
This is currently untested and will almost certainly not build. I'm
about to move into a Windows VM to get everything running properly
again.
2019-07-05 05:51:28 +10:00