Commit Graph

744 Commits

Author SHA1 Message Date
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
Konstantin Baltruschat b177bcdf22
Fix build error when cross compiling to 32bit targets (#430) 2020-06-17 16:21:31 +02:00
mitchmindtree d28f559072
Merge pull request #425 from RustAudio/dependabot/npm_and_yarn/examples/wasm-beep/websocket-extensions-0.1.4
Bump websocket-extensions from 0.1.3 to 0.1.4 in /examples/wasm-beep
2020-06-10 13:20:15 +02:00
dependabot[bot] 28653694a9
Bump websocket-extensions from 0.1.3 to 0.1.4 in /examples/wasm-beep
Bumps [websocket-extensions](https://github.com/faye/websocket-extensions-node) from 0.1.3 to 0.1.4.
- [Release notes](https://github.com/faye/websocket-extensions-node/releases)
- [Changelog](https://github.com/faye/websocket-extensions-node/blob/master/CHANGELOG.md)
- [Commits](https://github.com/faye/websocket-extensions-node/compare/0.1.3...0.1.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-06-08 08:31:36 +00:00
mitchmindtree 5fa5ce593d
Merge pull request #415 from mitchmindtree/webaudio_config
Add implementation of supported stream configs for webaudio
2020-05-26 14:53:37 +02:00
mitchmindtree 713eddd89a
Merge pull request #419 from ely-uf/chore/cleanup-coreaudio-warnings
Fix CoreAudio warnings.
2020-05-26 11:58:12 +02:00
ely-uf d9136708e4 Fix CoreAudio warnings.
1) warning: use of deprecated item 'std::error::Error::description': use the Display impl or to_string()
2) warning: unnecessary `unsafe` block
3) warning: field is never read: `device_id`
2020-05-26 02:29:49 +03:00
mitchmindtree f03fd69b65 [webaudio] Return Err instead of panicking on input device requests
Currently we are yet to implement input stream support for CPAL's
webaudio host. Instead of panicking, we should return an
error, None or empty iterator in order to let the user write well
behaved cross-platform apps and notify the user accordingly rather than
crashing.
2020-05-25 19:26:42 +02:00
mitchmindtree 4a52f29c2a
Merge pull request #418 from RustAudio/dependabot/npm_and_yarn/examples/wasm-beep/acorn-6.4.1
Bump acorn from 6.4.0 to 6.4.1 in /examples/wasm-beep
2020-05-25 19:01:42 +02:00
dependabot[bot] 24452e8cac
Bump acorn from 6.4.0 to 6.4.1 in /examples/wasm-beep
Bumps [acorn](https://github.com/acornjs/acorn) from 6.4.0 to 6.4.1.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/6.4.0...6.4.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-05-25 16:44:54 +00:00
mitchmindtree 157dff0546
Merge pull request #416 from mitchmindtree/wasm-beep
Add ishitatsuyuki's wasm-beep example
2020-05-25 18:44:21 +02:00
mitchmindtree 4ef48cb865 Add ishitatsuyuki's wasm-beep example
This adds the `wasm-beep` example @ishitatsuyuki put together for
testing webaudio support. The example helped me to better understand how
to use the webaudio host and provided an easy way to test it, I'm sure
other contributors/users might benefit in the same way.

I guess in the future it would be nice if we could have some way of
sharing the same code between wasm-target examples and native target
examples. Still, I think it's beneficial to include this wasm-beep
example in the meantime to have at least some kind of demonstration of
how to use cpal with wasm.

Are you happy for this to be added as is @ishitatsuyuki?
2020-05-25 15:44:06 +02:00
Tatsuyuki Ishi 9dc0c04c95 Add wasm-beep example 2020-05-25 15:32:51 +02:00
mitchmindtree 1dfdeace25 Add implementation of supported stream configs for webaudio
The `supported_stream_configs` method now returns the range of
configurations that are required to be supported for
`BaseAudioContext.createBuffer()` as mentioned here:

https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/createBuffer

That is, valid stream configurations are now considered to be any
configuration that has:

- 1 <= channel_count <= 32 and
- 8khz <= sample_rate <= 96khz
- sample_format == f32

Closes #410.
Closes #411.
2020-05-25 13:19:52 +02:00
mitchmindtree cf4e6ca5bf
Merge pull request #406 from mitchmindtree/webaudio-poc-rebased
Rebase/Update webaudio PR for recent breaking changes
2020-05-22 15:51:52 +02:00
mitchmindtree 78e1796ba8 Add callback and playback timestamp implementation for webaudio stream 2020-05-22 14:35:29 +02:00
mitchmindtree 640a1d39ed Rebase/Update webaudio PR for recent breaking changes
This rebases #372, addressing the recent changes introduced by #397, #395, and #371 in the process.

TODO:

- [ ] Complete implementation of `callback` and `playback` timestamps in the output stream callback.
2020-05-21 16:16:23 +02:00
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