477 Commits

Author SHA1 Message Date
Tom Gowan
72c5e9a8c1 asio sys lib comments and rust fmt 2019-07-05 05:51:25 +10:00
Tom Gowan
f6d1a74be2 asio sys lib comments and rust fmt 2019-07-05 05:51:25 +10:00
Tom Gowan
ffcbc02e52 multi channels 2019-07-05 05:51:25 +10:00
Tom Gowan
6e0eb073d1 sample rate support 2019-07-05 05:51:25 +10:00
Tom Gowan
b0b0484d4b endian conversion 2019-07-05 05:51:25 +10:00
Tom Gowan
5ec6da3aad Fixed driver bug 2019-07-05 05:51:24 +10:00
Tom Gowan
6a71f0a801 choose backend 2019-07-05 05:51:24 +10:00
Tom Gowan
91f2edb277 utils as mod 2019-07-05 05:51:24 +10:00
Tom Gowan
ed50bb9923 adding outputs 2019-07-05 05:51:24 +10:00
Tom Gowan
ff7fd62a2d clean up 2019-07-05 05:51:24 +10:00
Tom Gowan
93f75940d6 fixed offset bug 2019-07-05 05:51:24 +10:00
Tom Gowan
8193bc9f79 sharing asio streams 2019-07-05 05:51:24 +10:00
Tom Gowan
76eb07a274 Multiple streams 2019-07-05 05:51:23 +10:00
Tom Gowan
c24fa62028 error handling 2019-07-05 05:51:23 +10:00
Tom Gowan
ec172bbc47 error wrappers 2019-07-05 05:51:23 +10:00
Tom Gowan
4ba291e8be multi channel support 2019-07-05 05:51:23 +10:00
Tom Gowan
2ef7008615 Keep driver alive 2019-07-05 05:51:23 +10:00
Tom Gowan
ae7a03d788 Device rewrite Fixes #1 Fixes #12 2019-07-05 05:51:23 +10:00
Tom Gowan
056630cca3 removed allocation from output 2019-07-05 05:51:23 +10:00
Tom Gowan
910e0ba351 working record wav 2019-07-05 05:51:22 +10:00
Tom Gowan
d430000d2c beep working 2019-07-05 05:51:22 +10:00
Tom Gowan
8d5cb951d8 asio_utils 2019-07-05 05:51:22 +10:00
Tom Gowan
9c355f5579 fixed buffer 2019-07-05 05:51:22 +10:00
DMSDeveloper
c8c00793c0 attemp at removing buffer 2 2019-07-05 05:51:22 +10:00
DMSDeveloper
ab7e17558f attemp at removing buffer 2019-07-05 05:51:22 +10:00
DMSDeveloper
9a084347db removed itertools 2019-07-05 05:51:21 +10:00
DMSDeveloper
892024f5d8 minor fixes 2 2019-07-05 05:51:21 +10:00
DMSDeveloper
a1740a9282 record wav working v1 2019-07-05 05:51:21 +10:00
DMSDeveloper
fe4d108477 minor fixes 2019-07-05 05:51:21 +10:00
DMSDeveloper
c978583863 recording v1 2019-07-05 05:51:21 +10:00
DMSDeveloper
2cfd60757a working on windows 2019-07-05 05:51:21 +10:00
Tom Gowan
49968f4b82 change of branch 2019-07-05 05:51:21 +10:00
mitchmindtree
e0a0dc9ec7
Merge pull request #295 from mitchmindtree/traits_refactor
Refactor `Host` and related traits into a new `traits` module
2019-07-04 21:47:52 +02:00
mitchmindtree
5e4f384992 Refactor Host and related traits into a new traits module
This is a draft implementation of #294. I'll leave this open for
feedback and potentially better trait naming suggestions or better
solutions in general!

cc @ishitatsuyuki
2019-06-29 14:45:15 +02:00
mitchmindtree
36dee482bd
Merge pull request #290 from mitchmindtree/macos_condvar
Remove macOS sleep loop in favour of using `Condvar`
2019-06-26 02:28:16 +02:00
mitchmindtree
3603cbaee7 Remove macOS sleep loop in favour of using Condvar
This solution was originally posted by @HybridEidolon in #185. Sorry it
took so long! I thought it might be easier to open a new PR as half of
your implementation here has already been implemented in a following PR
(namely, the change from an unnecessary `Vec` of callbacks to a single
user callback).

Closes #185.
2019-06-25 17:38:54 +02:00
mitchmindtree
7e413cb660
Merge pull request #289 from mitchmindtree/host
Introduce a `Host` API
2019-06-25 17:31:35 +02:00
mitchmindtree
51eba20c44 Remove DefaultHost type in favour of determining at runtime
Re-exports host-specific types so that they are available within the
platform module if necessary (e.g. host::asla::Host as AlsaHost).

Allows for converting platform-specific host types (e.g. AlsaHost) into
the dynamically dispatched type generated for the target platform
(`Host`).
2019-06-25 16:54:50 +02:00
mitchmindtree
283a73054e Address some nits highlighted by ishitatsuyuki 2019-06-25 16:26:27 +02:00
mitchmindtree
e131979d22 Update README for addition of host enumeration API 2019-06-25 00:39:51 +02:00
mitchmindtree
6e9b40e225 Minimize compiler flags by using nested platform_impl mods
Also addresses some other CI errors:

- Add Host::new constructor for null backend
- Add missing DevicesError import to coreaudio backend
2019-06-24 23:22:37 +02:00
mitchmindtree
f7cf0c65b8 Implement Host API for coreaudio backend 2019-06-24 22:44:57 +02:00
mitchmindtree
6b6830ab57 Implement Host API for emscripten backend 2019-06-24 22:38:48 +02:00
mitchmindtree
69cd058d28 Implement new Host API for WASAPI backend 2019-06-24 22:21:19 +02:00
mitchmindtree
e8a05379c2 [WIP] Introduce a Host API
This is an implementation of the API described at #204. Please see that
issue for more details on the motivation.

-----

A **Host** provides access to the available audio devices on the system.
Some platforms have more than one host available, e.g.
wasapi/asio/dsound on windows, alsa/pulse/jack on linux and so on. As a
result, some audio devices are only available on certain hosts, while
others are only available on other hosts. Every platform supported by
CPAL has at least one **DefaultHost** that is guaranteed to be available
(alsa, wasapi and coreaudio). Currently, the default hosts are the only
hosts supported by CPAL, however this will change as of landing #221 (cc
@freesig). These changes should also accommodate support for other hosts
such as jack #250 (cc @derekdreery) and pulseaudio (cc @knappador) #259.

This introduces a suite of traits allowing for both compile time and
runtime dispatch of different hosts and their uniquely associated device
and event loop types.

A new private **host** module has been added containing the individual
host implementations, each in their own submodule gated to the platforms
on which they are available.

A new **platform** module has been added containing platform-specific
items, including a dynamically dispatched host type that allows for
easily switching between hosts at runtime.

The **ALL_HOSTS** slice contains a **HostId** for each host supported on
the current platform. The **available_hosts** function produces a
**HostId** for each host that is currently *available* on the platform.
The **host_from_id** function allows for initialising a host from its
associated ID, failing with a **HostUnavailable** error. The
**default_host** function returns the default host and should never
fail.

Please see the examples for a demonstration of the change in usage. For
the most part, things look the same at the surface level, however the
role of device enumeration and creating the event loop have been moved
from global functions to host methods. The enumerate.rs example has been
updated to enumerate all devices for each host, not just the default.

**TODO**

- [x] Add the new **Host** API
- [x] Update examples for the new API.
- [x] ALSA host
- [ ] WASAPI host
- [ ] CoreAudio host
- [ ] Emscripten host **Follow-up PR**
- [ ] ASIO host #221

cc @ishitatsuyuki more to review for you if you're interested, but it
might be easier after #288 lands and this gets rebased.
2019-06-24 21:45:04 +02:00
mitchmindtree
2b9e2e0b2c
Merge pull request #288 from mitchmindtree/callback_event
User Callback API `StreamEvent` Overhaul
2019-06-24 21:33:32 +02:00
mitchmindtree
c72bafd8ab Update examples eprintln to more accurately reflect error 2019-06-24 21:13:07 +02:00
mitchmindtree
c05d2916b1 Remove StreamEvent in favour of StreamDataResult 2019-06-24 20:43:27 +02:00
mitchmindtree
26f7e99e9b Remove all Pause, Play and Close events
A follow up to [this comment](https://github.com/tomaka/cpal/pull/288#issuecomment-504712574).
2019-06-23 19:04:24 +02:00
mitchmindtree
b1539c534f Add handling of Play, Pause and Close stream events to emscripten 2019-06-22 17:47:31 +02:00