Commit graph

71 commits

Author SHA1 Message Date
Jesper Nordenberg
d7dee9af10
Fixed memory leak (#919)
Fixed memory leak for parameter ppClosestMatch in call to IAudioClient::IsFormatSupported
2024-10-11 10:37:04 +02:00
coolkiid
ef95a03070
chore: fix a clippy warning (#871) 2024-03-28 21:53:01 +01:00
Ame
4502781298
windows 0.52 -> 0.54 (#855) 2024-03-03 00:33:25 +01:00
Jesper Nordenberg
b87ec4b5a7
Improved detection of WASAPI device formats (#839) 2024-02-21 01:44:45 +01:00
Jesper Nordenberg
bc6bfa2532
Boost WASAPI IO thread priority (#838) 2024-02-21 01:43:01 +01:00
James Liu
310160fbbf
Remove once_cell dependency (#800)
* Remove once_cell dependency.

* Add rust-version and set it to 1.70
2023-12-17 02:05:24 +01:00
Alphyr
76b04065cf
Update windows and alsa dependencies (#812) 2023-12-04 18:02:15 +01:00
Ryan McGrath
f51589c552
Replace assert in WASAPI check with bubble'd error (#797)
Replace assert in WASAPI WAVEFORMTEX supported format check with bubbled error message.

For our use case, this stops a crash that pops up for some users who encounter this path and allows us to gracefully just not play audio and log a message elsewhere.
2023-09-01 01:57:39 +02:00
Paul Hansen
17d2cc2084
Update windows-rs dependency (#791)
* Update `windows-rs` dependency

* Fix clippy warnings

* Update CHANGELOG.md
2023-07-25 11:35:54 +02:00
eladyn
17e7ab61fd
bump windows dependency to 0.46 (#765) 2023-03-26 17:40:47 +02:00
Dickless
6ed426614a
Fixed wasapi thread panics involving the main(or other) thread(when Stream drops). (#756)
when main(or other) thread(s) try to drop the Stream object, they would panic at host/wasapi/stream.rs Stream::drop() if the wasapi thread is dead. this occurs when the user wants to do something after all the cpal objects have been dropped.
2023-03-15 15:10:38 +01:00
Csányi István
72ad936b58 Fix CoTaskMemFree always getting called with null 2023-01-22 14:13:35 +01:00
Paul Hansen
7776c6634a
Update windows-rs dependency (#726) 2022-11-13 05:03:23 +01: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
Kai Giebeler
85d773d59f Migrate Sample to dasp_sample (#689) 2022-10-07 14:08:54 +02:00
Osspial
417b7fff6f
Implement BufferSize::Fixed in wasapi, and migrate wasapi to officially-supported Windows crate (#669)
I migrated to `windows-rs` in this PR since exposing the buffer size range for hardware-offloaded audio processing requires `IAudioClient2`, which isn't exposed in the `winapi` crate, and `winapi` seems to be more or less unmaintained at this point.

* Basic type conversion

* Make everything compile!

* Fix warnings

* Implement buffer sizing for wasapi

* Convert tabs to spaces

* Run cargo fmt

* Remove winapi from Cargo.toml

* Remove unused commented code from wasapi, and fix lingering TODOs

* Fix compile error

* Update to windows 0.37.0

* Run rustfmt

* Work around rustfmt nested tuple issues

* Improve readability of guid comparison code
2022-07-15 14:59:45 +02:00
James Liu
223f28262a
Update dependencies, switch to once_cell (#673) 2022-06-06 02:18:23 +02:00
Dimitris Apostolou
1cd0caf8b6
Fix typos 2022-02-19 18:14:34 +02:00
Rémi Lauzier
8b99fce094
Rust 2021 and clap 3.0 2022-02-18 03:24:43 -05:00
Tatsuyuki Ishi
03947afefb wasapi: Allow both threading models and switch the default to STA
COM can prevent undefined behavior in either concurrency model by
performing marshaling when necessary. As a result, CoInitializeEx can be
called with either concurrency model, and in this case STA provides better
compatibility with other code requiring STA, e.g. ASIO backend or winit
drag-and-drop.

To dive into the detail, the entry point of WASAPI, MMDeviceEnumerator, is
registered with "both" threading model, which means that COM objects are
created with whatever the thread's concurrency model is set to. This raises
the concern that when STA is used, marshaling might make audio buffer
operations block on the main thread, breaking continuous audio processing.
However, the implementation actually uses free-threaded marshaller for
interfaces dealing with buffer operations, which effectively bypasses COM's
compatibility marshaling behavior and perform any API calls on the caller's
thread instead. Therefore, the interfaces would operate just fine on either
concurrency model.

For more details on COM's threading model, see [1].

[1] https://thrysoee.dk/InsideCOM+/ch04d.htm

Co-Authored-By: Henrik Rydgård <hrydgard@gmail.com>

Close #59
Close #348
Close #504
Close #530
Close #538
Close #572
2021-08-08 12:03:18 +09:00
Rémi Lauzier
ba462dad18
Fix some typo and warnings 2021-06-29 11:30:26 -04:00
Marcel Märtens
a945d83ac7 give each thread a unique name 2021-03-22 11:06:15 +01:00
Sergej Jurečko
3d163c3468 fix panic on windows if device gets unplugged 2020-11-05 09:24:00 +01:00
dheijl
1e9689ef48 rust format --all 2020-09-20 17:00:51 +02:00
dheijl
0d37421b45 rust format 2020-09-20 16:01:59 +02:00
dheijl
78e8452150 Reenable WasApi loopback 2020-09-10 15:32:18 +02:00
JoshuaBatty
7c1adce330 adds support for buffersizes in webaudio and emscripten 2020-05-27 12:05:55 +02:00
JoshuaBatty
935fa280d3 buffersizes api for wasapi 2020-05-26 14:55:55 +02:00
JoshuaBatty
9e660da433 implemented buffersizes for asio 2020-05-26 14:55:55 +02:00
mitchmindtree
cdf23c3c62 Add stream timestamp implementation to WASAPI backend
This was written on Linux and while the code type-checks, it has not yet
been tested.
2020-04-29 14:59:25 +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
mitchmindtree
009b796b7c Update wasapi backend for SupportedStreamConfig private fields 2020-02-02 19:06:16 +01:00
mitchmindtree
07b66f52f3 Rename FormatNotSupported to StreamConfigNotSupported 2020-01-28 22:55:43 +01:00
mitchmindtree
e0da586f77 Update wasapi backend for stream format renaming 2020-01-28 00:26:15 +01: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
a7008b63a5 Address deprecated mem::uninitialized warnings in WASAPI host
This uses `ptr::null_mut()` and `MaybeUninit` to remove use of
deprecated `mem::uninitialized()` which could possibly result in UB.
2020-01-20 20:22:15 +01:00
mitchmindtree
1b5cf579cb Update WASAPI backend for addition of new stream Data type 2020-01-19 19:17:40 +01:00
mitchmindtree
b5bfb8d422 Update WASAPI backend for removal of UnknownTypeBuffer 2020-01-18 15:13:17 +01:00
mitchmindtree
2afebb2806 Clarify the current state of stream behaviour in docs and comments 2019-12-31 16:02:08 +01:00
Viktor Lazarev
64ba84de81 Move code from stream to device 2019-12-31 15:46:10 +01:00
ishitatsuyuki
c09a58ac02 Fix the remainder of WASAPI backend 2019-12-31 15:42:35 +01:00
Tatsuyuki Ishi
7f7914434c Additional clippy fixes 2019-12-31 15:42:35 +01:00
Viktor Lazarev
d46415a6e7 cargo clippy 2019-12-31 15:42:35 +01:00
Tatsuyuki Ishi
49a38c2641 Fix up WASAPI host 2019-12-31 15:42:35 +01:00
Viktor Lazarev
d4965d3673 cargo fmt 2019-12-31 15:42:35 +01:00
Viktor Lazarev
c62cb48e19 Apply suggestions proposed by Clippy 2019-12-31 15:42:35 +01:00
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