Commit Graph

726 Commits

Author SHA1 Message Date
Damian Peckett 6f43fc2b60 Add a wasm-bindgen based generic Web Audio backend. 2020-05-06 13:44:00 +02:00
mitchmindtree fe22704d4a
Merge pull request #397 from mitchmindtree/timestamp
[WIP] Timestamp and `StreamInstant` APIs
2020-05-05 15:33:55 +02:00
mitchmindtree 46afc8f695 Fix code formatting of asio-sys timestamp changes 2020-05-01 15:34:01 +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 2a62fd1af3
Merge pull request #6 from JoshuaBatty/timestamp_asio_fixes
Timestamp asio fixes
2020-05-01 14:07:42 +02:00
JoshuaBatty 225f441d5b addressed some compilation errors on asio timestamp implementation 2020-05-01 14:05:16 +02:00
mitchmindtree 22eef32898 WIP Add timestamp implementation to ASIO backend
Currently unchecked and untested, though most of the groundwork should
be laid.
2020-05-01 13:10:50 +02:00
Thomas Havlik e4eb7169ef
macOS: fallback to CFStringGetCString if CFStringGetCStringPtr returns nil (#399)
* macOS: fallback to CFStringGetCString if CFStringGetCStringPtr returns nil; fixes #398

* rustfmt

Co-authored-by: Tom Havlik <thomashavlik@Adams-Mac-mini.local>
2020-05-01 09:38:25 +02:00
mitchmindtree 4579daad7b Merge branch 'timestamp_wasapi' into timestamp 2020-04-30 15:45:54 +02:00
mitchmindtree 981507391a Add a table describing the source of StreamTimestamp for each host 2020-04-30 14:08:00 +02:00
mitchmindtree cb95bfd88b alsa - Use status to retrieve avail, delay
This addresses @diwic's [tip][1] about using the pcm status to retrieve
avail and delay, as well as the timestamps, rather than using separate
pcm calls for each.

[1]: https://github.com/mitchmindtree/cpal/pull/5#issuecomment-621526946
2020-04-30 13:38:50 +02:00
mitchmindtree 5813e0f97a Merge branch 'timestamp_emscripten' into timestamp 2020-04-29 15:10:31 +02:00
mitchmindtree 9a0096142e
Merge pull request #5 from mitchmindtree/timestamp_alsa
WIP - Add ALSA timestamp implementation.
2020-04-29 15:06:41 +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
mitchmindtree 79a0020c88 Add timestamp implementation to emscripten backend 2020-04-29 14:58:08 +02:00
mitchmindtree 54e5e95705 WIP Add timestamp implementation to coreaudio backend
Currently a rough estimate of the required work, not yet tested.
2020-04-28 17:48:25 +02:00
mitchmindtree 163f0cc190 Move reference to timestamp validity bug to more suitable location 2020-04-28 17:43:40 +02:00
mitchmindtree 45977bf837 Add fallback instant source to ALSA backend
Here we use `std::time::Instant` as a fallback source for stream
instants in the case that the device produces invalid timestamps via
`get_htstamp`.
2020-04-28 17:40:40 +02:00
mitchmindtree a49297ec2c WIP - Add ALSA timestamp implementation.
I think this is mostly complete, however there are two major TODOs:

- There seems to be a bug where timestamps are not reported when the
  target device is `pulse`. This causes a `panic!` as the trigger
  timestamp should always precede the timestamp when retrieved while the
  stream is running.
- We need to specify the timestamp type as MONOTONIC_RAW, however the
  `alsa` and `alsa-sys` crates do not yet expose the necessary
  `set_tstamp_type` function.
2020-04-28 17:38:44 +02:00
mitchmindtree 777a6b2bd1 Change `StreamInstant` to use a signed representation
Using an unsigned representation was problematic as some platforms
provide no exact "capture" instant. As a result, we need to calculate
the instant of capture by subtracting the buffer duration from the
callback duration. In some cases this would occasionally cause the
unsigned representation to underflow unnecessarily.
2020-04-28 17:37:48 +02:00
mitchmindtree 4cb50663d8 WIP Begin work on the timestamp and `StreamInstant` APIs 2020-04-27 18:14:29 +02:00
mitchmindtree f032557fb4
Merge pull request #395 from mitchmindtree/callback_info
Add a `CallbackInfo` argument to the stream data callback
2020-04-27 14:32:37 +02:00
mitchmindtree 624ba659da
Merge pull request #393 from derekdreery/recover_if_set_buffer_time_failed
Recover if hw_params_set_buffer_time failed.
2020-04-17 16:39:15 +02:00
mitchmindtree 95f5f2e54a Update CHANGELOG for addition of CallbackInfo types 2020-04-16 15:39:05 +02:00
mitchmindtree aae44cf3d6 Fix process_callback function signatures in asio backend 2020-04-16 15:30:14 +02:00
mitchmindtree 3f69770471 Update checkout github action. Clean up workflow formatting. 2020-04-16 15:20:45 +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
Richard Dodd 3c3349f926 Add some comments. 2020-04-15 18:46:54 +01:00
Richard Dodd 290f464330 Cargo fmt 2020-04-15 18:42:43 +01:00
Richard Dodd 86079e6439 Rebase off new alsa-rs impl 2020-04-15 18:41:40 +01:00
mitchmindtree 608d23adc6
Merge pull request #390 from mitchmindtree/remove-alsa-sys-publish
Remove alsa-sys publish step from cpal publish github workflow
2020-04-15 18:23:01 +02:00
mitchmindtree 38e0408412 Remove alsa-sys publish from github workflow
The `alsa-sys` crate repository has lived [here][1] for quite a while.
This commit removes the unnecessary step from the CI workflow now that
alsa-sys has finally been removed as of #386.

[1]: https://github.com/diwic/alsa-sys
2020-04-15 18:07:51 +02:00
mitchmindtree 7df5b4e973
Merge pull request #386 from alexmoon/alsa
Switch from vendored alsa-sys to alsa crate
2020-04-15 17:56:18 +02:00
Alex Moon 5da315fbfe Merge remote-tracking branch 'upstream/master' into alsa 2020-04-13 16:25:30 -04:00
Alex Moon b386e63eec Ignore play/pause errors for ALSA Stream 2020-04-12 13:11:35 -04:00
est31 fc28a8033c
Merge pull request #388 from bschwind/master
Fix type for armv6 platforms
2020-04-12 13:38:22 +02:00
Brian Schwind c5e1ea5919 Fix type-casting error for armv6 platforms 2020-04-12 14:19:18 +09:00
Alex Moon 62d540d396 Switch from vendored alsa-sys to alsa crate 2020-04-03 16:56:51 -04:00
mitchmindtree f3e7c46205
Merge pull request #382 from dansgithubuser/master
fix sample rate range assertion
2020-03-18 09:02:34 +01:00
Dan bf276e7de6 fix sample rate range assertion 2020-03-17 23:16:04 -04:00
mitchmindtree aac04e7263
Merge pull request #379 from est31/master
Remove redundant 'static from &'static str
2020-02-24 09:10:08 +01:00
est31 d97983e218 Remove redundant 'static from &'static str
Specifying the static lifetime in constants and static variables
is redundant since Rust 1.17.0

https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1170-2017-04-27
2020-02-24 07:40:25 +01:00
mitchmindtree 946d646965
Merge pull request #374 from mitchmindtree/changelog
Update changelog for changes since 0.11
2020-02-04 17:18:44 +01:00
mitchmindtree 27b4c56858 Update changelog for changes since 0.11 2020-02-04 17:16:41 +01:00
mitchmindtree e4df8b277f
Merge pull request #371 from mitchmindtree/stream_config
Rename stream `Format` types to `StreamConfig` and other related renamings.
2020-02-04 17:07:15 +01:00
mitchmindtree a2e6232cd8
Merge pull request #4 from mitchmindtree/stream_config_pub
Restrict the ways in which `SupportedStreamConfig/Range`s can be constructed
2020-02-04 15:46:22 +01:00
mitchmindtree 7a6cb0bd6a Make SupportedStreamConfigRange fields private 2020-02-02 20:20:51 +01:00
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