91 Commits
Author SHA1 Message Date
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
Tatsuyuki Ishi c97d1dd3fa Remove EventLoop and port the ALSA backend 2019-12-31 15:42:35 +01:00