Commit graph

117 commits

Author SHA1 Message Date
Greg Wiley
edecb26ff3
Fix compile issues in wasm-beep example (#723)
Fixes #721

Changes to a dependency library broke compilation of the example. Changes needed to get the example working and warning-free include:
 
1. specifying additional type constraints in local implementations
2. using the `FromSample` trait to convert samples in the handler
3. adding a default matcher in response to the non-exhaustive attribute on `SampleFormat`

Also adds a github action to ensure the wasm-beep example compiles.
2022-11-06 04:34:08 +01:00
Dan Wilhelm
a9b34ea8bc
Update wasm-beep to webpack 5 (#684) 2022-11-04 22:18:31 +01:00
mbodmer
97fc4edb8b
Bump linux deps, simplify examples, remove nix dep (#712)
* bump linux dependencies, dev-dependencies, anyhow, hound, ringbuf

* update to clap v4 and simplify examples with clap_derive

* have libjack installed when running with --all-features

* don't force the patch version for libc

* allow room for version resolution with nix

* nix dependency not used anymore, remove it
2022-10-23 20:59:45 +02:00
mbodmer
0a3e8c2208
add timeout paramter to DeviceTrait stream builders (#696)
* add timeout paramter to DeviceTrait stream builders

This makes it possible for the library client to handle situations where the host
takes too long to respond or even blocks forever, eg. a retry can be applied.

if the timeout passed is "None" the current behaviour is applied, eg. blocking forever.
if the timeout passed is a Duration then it will be applied to the Device Streams.
This is only implemented for ALSA, the other hosts will ignore the parameter for now.

Signed-off-by: Marc Bodmer <marc.bodmer@securiton.ch>
2022-10-18 18:15:31 +02:00
pin
73a035617b
Fix CI failure (#705) 2022-10-08 14:55:50 +02:00
Kai Giebeler
85d773d59f Migrate Sample to dasp_sample (#689) 2022-10-07 14:08:54 +02:00
pin
0f8cd7a9c8 Add NetBSD support 2022-09-25 07:54:19 +02:00
S. A. Bjørn
a420316e30
Fix example typos (#655)
both feedback.rs and record_wav.rs have "bleep" as their application name when constructing clap::Command. This commit changes the constructor argument for each example to match their filenames.
2022-03-24 16:21:44 +01:00
Rémi Lauzier
6087b05604
Clap 3.1 2022-02-18 13:08:59 -05:00
Wandalen
33094e89f5
Add sample-based generation example: synth_tones (#612) 2022-01-14 13:38:08 +01:00
Luca Barbato
78c238e6cc Update to clap3 2022-01-12 16:55:46 +01:00
Sebastian Imlay
d36e39ee14 Maybe fix ci 2021-12-31 11:06:14 -05:00
Sebastian Imlay
77cdab0823 Added work around for big sur clang issue 2021-11-27 12:21:50 -05:00
Rémi Lauzier
ba462dad18
Fix some typo and warnings 2021-06-29 11:30:26 -04:00
Michael Hills
b9b36d6a9a iOS default sample rate pulled from audio unit 2021-01-02 02:04:13 +11:00
Michael Hills
2cccf99d50 Refactor coreaudio host and add iOS support + ios-feedback example 2021-01-02 02:04:13 +11:00
Alex Moon
e76e1de3a3 Switch from structopt to clap to reduce dependencies. 2020-12-22 09:25:36 -07:00
Alex Moon
269c60fde0 Add an Android example and enhance the other examples with CLI argument parsing. 2020-12-14 11:04:32 -07:00
est31
3ccbcb843c Update ringbuf dev-dependency 2020-11-08 15:02:55 +01:00
mitchmindtree
2220f58491
Merge pull request #491 from creator-rs/master
Add Android APK build CI and Release version 0.13.0
2020-11-03 13:03:47 +01:00
mitchmindtree
2ea54a7ec6
Merge pull request #463 from RustAudio/dependabot/npm_and_yarn/examples/wasm-beep/elliptic-6.5.3
Bump elliptic from 6.5.2 to 6.5.3 in /examples/wasm-beep
2020-10-27 23:34:44 +01:00
mitchmindtree
5720d0c99f
Merge pull request #475 from RustAudio/dependabot/npm_and_yarn/examples/wasm-beep/http-proxy-1.18.1
Bump http-proxy from 1.18.0 to 1.18.1 in /examples/wasm-beep
2020-10-27 23:34:30 +01:00
enfipy
0ff26d163d
Add apk build and alter CI 2020-10-27 21:14:42 +02:00
Erik Natanael Gustafsson
2b31fe41af
JACK Host (#389)
Co-authored-by: Federico Dolce <psykopear@gmail.com>
2020-10-01 18:04:43 +09:00
dependabot[bot]
db51737d42
Bump http-proxy from 1.18.0 to 1.18.1 in /examples/wasm-beep
Bumps [http-proxy](https://github.com/http-party/node-http-proxy) from 1.18.0 to 1.18.1.
- [Release notes](https://github.com/http-party/node-http-proxy/releases)
- [Changelog](https://github.com/http-party/node-http-proxy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/http-party/node-http-proxy/compare/1.18.0...1.18.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-12 00:23:17 +00:00
dependabot[bot]
833d5e3310
Bump elliptic from 6.5.2 to 6.5.3 in /examples/wasm-beep
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.2 to 6.5.3.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](https://github.com/indutny/elliptic/compare/v6.5.2...v6.5.3)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-02 01:48:47 +00:00
dependabot[bot]
518d2ea519
Bump lodash from 4.17.15 to 4.17.19 in /examples/wasm-beep
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-20 21:07:35 +00:00
mitchmindtree
b78ff83c03
Merge pull request #401 from JoshuaBatty/buffersize_range
Prototyping an API for getting the supported min and max buffersizes
2020-07-14 14:35:46 +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
JoshuaBatty
9c85eecb59 cargo fmt fix 2020-05-27 12:15:31 +02:00
JoshuaBatty
cf1a928b84 reset examples 2020-05-26 14:55:55 +02:00
JoshuaBatty
4cd9d0bcec finished implementing buffersizes for coreaudio 2020-05-26 14:55:55 +02:00
JoshuaBatty
9e660da433 implemented buffersizes for asio 2020-05-26 14:55:55 +02:00
JoshuaBatty
d72b546dca gets buffersize range and allows to set buffersize for alsa 2020-05-26 14:55:55 +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
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
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
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
476f6c4c2c Only allow for private construction of SupportedStreamConfig.
This should give the user a higher confidence that, if they have a
`SupportedStreamConfig` format type that it is actually supported.

Also updates the `raw` stream builder methods to take a `StreamConfig`
and `SampleFormat` as separate arguments for flexibility.

**Backends Updated**

- [x] null
- [x] alsa
- [ ] emscripten
- [ ] coreaudio
- [ ] wasapi
- [ ] asio
2020-02-02 18:43:30 +01:00
mitchmindtree
9c781bd381 Rename stream Format types to Config
This implements the changes described at #370.

This commit implements only the `null` and `alsa` backends - the rest
will be implemented in follow-up commits.

Closes #370.
2020-01-27 21:28:07 +01:00
Benjamin Saunders
8d471f3d0e Illustrate alternative structure in beep example 2020-01-21 22:49:31 -08:00
Benjamin Saunders
076b814a15 Introduce polymorphic stream constructors 2020-01-21 22:20:26 -08: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
58356f49b4 An alternative approach to removing UnknownBufferType.
This is a potential alternative to #359. This PR is based on #359.

This approach opts for a dynamically checked sample type approach with
the aim of minimising compile time and binary size.

You can read more discussion on this [here](https://github.com/RustAudio/cpal/pull/359#issuecomment-575931461)

Implemented backends:

- [x] null
- [x] ALSA
- [ ] CoreAudio
- [ ] WASAPI
- [ ] ASIO
- [ ] Emscripten
2020-01-19 15:06:19 +01:00
mitchmindtree
5a619877f9 Update docs for removal of UnknownTypeBuffer 2020-01-18 15:13:17 +01:00
mitchmindtree
05b62bb1c0 Remove UnknownTypeBuffer in favour of specifying sample type.
This is an implementation of the planned changes described in #119.

For a quick overview of how the API has changed, check out the updated
examples.

**TODO:**

- [x] Update API.
- [x] Update examples.
- [ ] Remove `data_type` field from `Format` (see [here](https://github.com/RustAudio/cpal/issues/119#issuecomment-573788380)).
- Update backends:
  - [x] null
  - [x] ALSA
  - [ ] ASIO
  - [ ] WASAPI
  - [ ] CoreAudio
  - [ ] Emscripten

Closes #119
Closes #260
2020-01-18 15:13:17 +01:00
Tatsuyuki Ishi
cede7b41db Remove EventLoop and port the ALSA backend 2019-12-31 15:46:10 +01:00
Tatsuyuki Ishi
3cce3e43d9 Change callback interface so that it takes a dedicated error callback 2019-12-31 15:42:35 +01:00