You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add StreamConfigBuilder with cross-platform configuration support
- Add ergonomic StreamConfigBuilder API for stream configuration
- Add platform-specific configuration types:
- AlsaStreamConfig: configure periods and access types (RW/MMap modes)
- JackStreamConfig: configure client names and port auto-connection
- WasapiStreamConfig: configure exclusive/shared mode
- Add device-tied stream building methods on SupportedStreamConfig
- Add convenience methods: Device::default_input/output_config()
- Add platform builder methods: .on_alsa(), .on_jack(), .on_wasapi()
- Add jack feature flag for JACK audio backend support
- Add audio_thread_priority feature flag for ALSA/WASAPI real-time scheduling
- Update documentation with Quick Start guide and cross-platform examples
- Maintain backward compatibility with existing Device::build_*_stream APIs
This introduces a major ergonomic improvement for cross-platform audio
configuration while preserving the existing low-level APIs.
- ALSA: Add `AlsaStreamConfig` for periods and access types.
10
+
- ALSA: Fix `BufferSize::Fixed` by selecting the nearest supported frame count.
11
+
- ALSA: Change `BufferSize::Default` to use the device defaults.
7
12
- ALSA: Change card enumeration to work like `aplay -L` does.
13
+
- ALSA(process_output): Pass `silent=true` to `PCM.try_recover`, so it doesn't write to stderr.
8
14
- ASIO: Fix linker flags for MinGW cross-compilation.
9
15
- CoreAudio: Change `Device::supported_configs` to return a single element containing the available sample rate range when all elements have the same `mMinimum` and `mMaximum` values.
10
16
- CoreAudio: Change default audio device detection to be lazy when building a stream, instead of during device enumeration.
11
17
- iOS: Fix example by properly activating audio session.
12
-
- WASAPI: Expose IMMDevice from WASAPI host Device.
18
+
- JACK: Add `jack` feature flag to enable JACK audio backend support.
19
+
- JACK: Add `JackStreamConfig` for client names and port connections.
20
+
- WASAPI: Add `WasapiStreamConfig` for exclusive mode support.
21
+
- WASAPI: Expose `IMMDevice` from WASAPI host Device.
Copy file name to clipboardExpand all lines: README.md
+56-24Lines changed: 56 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,8 +17,8 @@ This library currently supports the following:
17
17
Currently, supported hosts include:
18
18
19
19
- Linux (via ALSA or JACK)
20
-
- Windows (via WASAPI by default, see ASIO instructions below)
21
-
- macOS (via CoreAudio)
20
+
- Windows (via WASAPI by default, JACK or ASIO, see instructions below)
21
+
- macOS (via CoreAudio or JACK)
22
22
- iOS (via CoreAudio)
23
23
- Android (via AAudio)
24
24
- Emscripten
@@ -27,16 +27,30 @@ Note that on Linux, the ALSA development files are required. These are provided
27
27
as part of the `libasound2-dev` package on Debian and Ubuntu distributions and
28
28
`alsa-lib-devel` on Fedora.
29
29
30
+
For JACK support, install the JACK development libraries on Linux
31
+
(`libjack-jackd2-dev` on Debian/Ubuntu) or download JACK from
32
+
[jackaudio.org](https://jackaudio.org/downloads/) for macOS/Windows.
33
+
30
34
## Compiling for Web Assembly
31
35
32
-
If you are interested in using CPAL with WASM, please see [this guide](https://github.com/RustAudio/cpal/wiki/Setting-up-a-new-CPAL-WASM-project) in our Wiki which walks through setting up a new project from scratch.
36
+
If you are interested in using CPAL with WASM, please see
thread priority for ALSA/WASAPI audio threads (may require elevated privileges)
40
54
41
55
## ASIO on Windows
42
56
@@ -51,13 +65,20 @@ WASAPI.
51
65
52
66
### Locating the ASIO SDK
53
67
54
-
The location of ASIO SDK is exposed to CPAL by setting the `CPAL_ASIO_DIR` environment variable.
68
+
The location of ASIO SDK is exposed to CPAL by setting the `CPAL_ASIO_DIR`
69
+
environment variable.
55
70
56
-
The build script will try to find the ASIO SDK by following these steps in order:
71
+
The build script will try to find the ASIO SDK by following these steps in
72
+
order:
57
73
58
74
1. Check if `CPAL_ASIO_DIR` is set and if so use the path to point to the SDK.
59
-
2. Check if the ASIO SDK is already installed in the temporary directory, if so use that and set the path of `CPAL_ASIO_DIR` to the output of `std::env::temp_dir().join("asio_sdk")`.
60
-
3. If the ASIO SDK is not already installed, download it from <https://www.steinberg.net/asiosdk> and install it in the temporary directory. The path of `CPAL_ASIO_DIR` will be set to the output of `std::env::temp_dir().join("asio_sdk")`.
75
+
2. Check if the ASIO SDK is already installed in the temporary directory, if so
76
+
use that and set the path of `CPAL_ASIO_DIR` to the output of
77
+
`std::env::temp_dir().join("asio_sdk")`.
78
+
3. If the ASIO SDK is not already installed, download it from
79
+
<https://www.steinberg.net/asiosdk> and install it in the temporary directory.
80
+
The path of `CPAL_ASIO_DIR` will be set to the output of
81
+
`std::env::temp_dir().join("asio_sdk")`.
61
82
62
83
In an ideal situation you don't need to worry about this step.
63
84
@@ -70,22 +91,25 @@ In an ideal situation you don't need to worry about this step.
70
91
2. Add the LLVM `bin` directory to a `LIBCLANG_PATH` environment variable. If
71
92
you installed LLVM to the default directory, this should work in the command
72
93
prompt:
73
-
```
94
+
```cmd
74
95
setx LIBCLANG_PATH "C:\Program Files\LLVM\bin"
75
96
```
76
97
3. If you don't have any ASIO devices or drivers available, you can [**download
77
98
and install ASIO4ALL**](http://www.asio4all.org/). Be sure to enable the
78
99
"offline" feature during installation despite what the installer says about
79
100
it being useless.
80
-
4. Our build script assumes that Microsoft Visual Studio is installed if the host OS for compilation is Windows. The script will try to find `vcvarsall.bat`
81
-
and execute it with the right host and target machine architecture regardless of the Microsoft Visual Studio version.
101
+
4. Our build script assumes that Microsoft Visual Studio is installed if the
102
+
host OS for compilation is Windows. The script will try to find
103
+
`vcvarsall.bat` and execute it with the right host and target machine
104
+
architecture regardless of the Microsoft Visual Studio version.
82
105
If there are any errors encountered in this process which is unlikely,
83
-
you may find the `vcvarsall.bat` manually and execute it with your machine architecture as an argument.
106
+
you may find the `vcvarsall.bat` manually and execute it with your machine
107
+
architecture as an argument.
84
108
The script will detect this and skip the step.
85
109
86
110
A manually executed command example for 64 bit machines:
@@ -106,7 +130,7 @@ In an ideal situation you don't need to worry about this step.
106
130
107
131
6. Make sure to enable the `asio` feature when building CPAL:
108
132
109
-
```
133
+
```shell
110
134
cargo build --features "asio"
111
135
```
112
136
@@ -121,18 +145,26 @@ _Updated as of ASIO version 2.3.3._
121
145
122
146
### Cross compilation
123
147
124
-
When Windows is the host and the target OS, the build script of `asio-sys` supports all cross compilation targets
125
-
which are supported by the MSVC compiler. An exhaustive list of combinations could be found [here](https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-160#vcvarsall-syntax) with the addition of undocumented `arm64`, `arm64_x86`, `arm64_amd64` and `arm64_arm` targets. (5.11.2023)
148
+
When Windows is the host and the target OS, the build script of `asio-sys`
149
+
supports all cross compilation targets which are supported by the MSVC
150
+
compiler. An exhaustive list of combinations could be found [here](https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-160#vcvarsall-syntax)
151
+
with the addition of undocumented `arm64`, `arm64_x86`, `arm64_amd64` and
152
+
`arm64_arm` targets. (5.11.2023)
126
153
127
-
It is also possible to compile Windows applications with ASIO support on Linux and macOS.
154
+
It is also possible to compile Windows applications with ASIO support on Linux
155
+
and macOS.
128
156
129
-
For both platforms the common way to do this is to use the [MinGW-w64](https://www.mingw-w64.org/) toolchain.
157
+
For both platforms the common way to do this is to use the
0 commit comments