Commit Graph

24 Commits

Author SHA1 Message Date
Viktor Lazarev 10dc779943 Return back missed play/pause implementation 2019-12-31 15:42:35 +01:00
Viktor Lazarev a218dc90e6 Fixing compile errors 2019-12-31 15:42:35 +01:00
Viktor Lazarev a412b00336 Fix the "Stream::new' method 2019-12-31 15:42:35 +01:00
Viktor Lazarev e7f708701c Remove old code 2019-12-31 15:42:35 +01:00
Viktor Lazarev 1021141d16 Fix "build_input/output_stream_inner" methods 2019-12-31 15:42:35 +01:00
Viktor Lazarev f65d0e65bc Expose Stream instead of StreamId 2019-12-31 15:42:35 +01:00
Viktor Lazarev 125bebd733 Clean up wasdapi mod 2019-12-31 15:42:35 +01:00
Viktor Lazarev d12d9f479b Remove redundant field names 2019-12-31 15:42:35 +01:00
Viktor Lazarev 7765e941ed Implement Drop for Stream 2019-12-31 15:42:35 +01:00
Viktor Lazarev 0541bf8667 Add Stream struct 2019-12-31 15:42:35 +01:00
Viktor Lazarev e25c44a4a1 Move code from stream to device 2019-12-31 15:42:35 +01:00
Viktor Lazarev dd418c08ae Adjust "process_commands" and "Command" 2019-12-31 15:42:35 +01:00
Viktor Lazarev 28cf3fee43 Fix "run_inner" fn 2019-12-31 15:42:35 +01:00
Viktor Lazarev b00630bdcc Extract "run_inner" as a standalone function 2019-12-31 15:42:35 +01:00
Viktor Lazarev 463540f370 Keep a single stream only 2019-12-31 15:42:35 +01:00
Viktor Lazarev cffd2da582 Rename "StreamDataResult" to "StreamData" 2019-12-31 15:42:35 +01:00
Viktor Lazarev 37e7b5b63b Move DeviceTrait implementation to wasapi::device 2019-12-31 15:42:35 +01:00
lucy dcabad105b Implement WASAPI loopback support
This works by detecting output devices in build_input_stream() and
setting the AUDCLNT_STREAMFLAGS_LOOPBACK flag to enable loopback
recording.

closes #251
2019-10-27 14:52:12 +01:00
est31 447ad5d727
Merge pull request #321 from RustAudio/wasapi-capture
Fix WASAPI capture logic
2019-08-14 00:42:08 +02:00
ishitatsuyuki e9043c605a Fix WASAPI capture logic
The buffer size handling differs from what render streams uses. Logic is based on https://github.com/microsoft/Windows-universal-samples/blob/master/Samples/WindowsAudioSession/cpp/WASAPICapture.cpp.
2019-08-12 10:56:14 +09:00
Tom Gowan 6e0eb073d1 sample rate support 2019-07-05 05:51:25 +10: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 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