Commit graph

528 commits

Author SHA1 Message Date
François
d1837745ac
directly return Option instead of WasmOption (#823) 2024-01-30 02:14:55 +01:00
Brandon Elam Barker
7d8ee38f31
add Copy for SupportedStreamConfigRange (#821) 2024-01-21 18:45:38 +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
Dickless
d0ff4fe91f
Fix warnings in asio_sys (#779)
* Fixed warnings using deprecated Error::description

* Allowed dead_code
2023-07-20 21:53:45 +02:00
Easyoakland
848abf256f
Added must use to stream. Fixes issue #589 (#772) 2023-04-04 04:36:28 +02:00
VincentJousse
61a2210d70
webaudio: set the channel_count in the AudioDestinationNode (#768)
Co-authored-by: Vincent Jousse <vincent.jousse@luminvent.com>
2023-03-30 16:05:42 +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
François
29dd8e2852
switch from mach to mach2 (#760) 2023-03-14 12:30:52 +01:00
Adrien Prokopowicz
459499686e
Remove thiserror and replace it with hand written Error impls 2023-02-25 20:41:07 +01:00
Csányi István
72ad936b58 Fix CoTaskMemFree always getting called with null 2023-01-22 14:13:35 +01:00
Dimitris Apostolou
f123811209
Fix typos (#738) 2023-01-08 22:23:43 +01:00
Ruairidh Williamson
90471506b1
Support i32 for asio (#737) 2022-12-27 23:25:02 +01:00
Paul Hansen
7776c6634a
Update windows-rs dependency (#726) 2022-11-13 05:03:23 +01:00
Pedro Tacla Yamada
56f54cb0b3
Update to use coreaudio-sys 0.11 (#706) 2022-11-09 12:26:06 +01:00
alichay
7e17373e31
Add rustdoc links in most of the documentation (#682)
* Add rustdoc links in most of the documentation

Additionally, fix a couple of references to old
renamed types still lingering in the docs :)

Fixes #650

* Rustfmt on documentation changes

* Make docs for impl_platform_host not build example
2022-11-04 21:57:23 +01:00
Caden Haustein
29999e6857
Remove stdweb in favor of js-sys, web-sys, and wasm-bindgen (#713) 2022-10-25 03:46:28 +02:00
Marc Bodmer
16617ceade update nix crate to v0.25 2022-10-20 16:03:47 +02: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
general electrix
3d99456c2b Remove debug print statement. 2022-10-11 03:08:10 -07:00
general electrix
d1bbbe0400 Fix docstring grammar. 2022-10-11 03:06:34 -07:00
general electrix
97af8b77ae Respond to code review tidbits. 2022-10-11 02:59:02 -07:00
general electrix
0af6a1c466 Refactor disconnection to trigger error_callback. 2022-10-11 02:55:03 -07:00
general electrix
baa697c7fc Implement disconnection detection for CoreAudio on MacOS.
* Create AudioObjectPropertyListener type, providing an easy way to attach a Rust callback.
* Refactor the existing sample rate update mechanism to use AudioObjectPropertyListener.
* Add an optional property listener that registers a callback that is triggered on device disconnection.
* Create a set_on_disconnect method to register the disconnection callback.
2022-10-09 13:29:04 -07:00
pin
73a035617b
Fix CI failure (#705) 2022-10-08 14:55:50 +02:00
Kai Giebeler
85d773d59f Migrate Sample to dasp_sample (#689) 2022-10-07 14:08:54 +02:00
pin
0f8cd7a9c8 Add NetBSD support 2022-09-25 07:54:19 +02:00
Kai Giebeler
e78a847272 fix some clippy warnings 2022-09-20 21:51:20 +02:00
Kai Giebeler
08acedd677 fix towards edition 2021 2022-09-20 21:47:35 +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
yamadapc
493a0904f3 Also export constructor for SupportedStreamConfig
This is related to #535.
2022-07-06 22:11:23 +02:00
yamadapc
411c671c33 Add constructor for SupportedStreamConfigRange
This is related to #535.
2022-07-06 22:11:23 +02:00
alula
32cee3949b
Return Device(None) as a default i/o device (#638)
In most cases, device with index 0 is NOT the default output device - in my case it happens to be the ear speaker. Returning Device(None) there makes Oboe choose the default input/output device - everything works as expected.
2022-06-07 07:46:24 +02:00
James Liu
223f28262a
Update dependencies, switch to once_cell (#673) 2022-06-06 02:18:23 +02:00
Rodrigo Batista de Moraes
b1457e5945
webaudio: expose AudioContext in WebAudioStream (#659) 2022-04-26 03:21:41 +02:00
Rodrigo Batista de Moraes
8d164ed585
Expose underlying platform specific implemenations (#660)
* expose underlying platform specific implemenations

* add doc to Inner enums

* fix: return `&mut` from `as_inner_mut`
2022-04-26 03:11:14 +02:00
Luca Barbato
a540a98b0a Fallback to monotonic timestamp if monotonic_raw can be set up
Fixes #606
2022-03-22 21:24:41 +01:00
Tatsuyuki Ishi
6ea33722ff platform: Conditional impl_platform_host based on feature flags 2022-03-18 16:36:29 +09:00
Kai Hagseth
d50e0ecbac fix: follow default output source on mac osx
When playing out on default output source, follow the default output
source chosen in sound preferences in osx.
2022-02-28 09:37:17 +01: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
Marijn Suijten
f8b05ade39 android: Migrate from ndk-glue to ndk-context
`ndk-glue` suffers one fatal flaw: it's "only" supposed to be used by
the crate providing `fn main()` and only supposed to end up in the
dependency graph once as it has `static` globals which get duplicated
across versions.

In the current case with `winit 0.26` still on `ndk-glue 0.5` but
`cpal` on `ndk-glue 0.6` it'll always panic in `fn native_activity()` as
the `static` globals on this version is not initialized.

Introducing `ndk-context`: a crate that holds these `static`s, with the
intention/premise to not see a breaking release /ever/ and make this a
problem of the past.  The crate is currently initialized with the VM and
Android Context on `ndk-glue` 0.5.1 and 0.6.1 (0.4.1 pending) making it
compatible with whatever is current, and the possibility for backporting
to older `ndk-glue` versions too.

See also:
https://github.com/rust-windowing/android-ndk-rs/issues/211
https://github.com/rust-windowing/android-ndk-rs/pull/223
2022-02-15 16:52:20 +01:00
nyanpasu64
1edf930bb4
Cleanup and document cpal's ALSA backend (#629) 2022-01-22 22:38:13 +01:00
Ram.Type-0
1b522fb3db
Faster sample format conversion (#618)
* Remove branch in `u16::to_i16` and `i16::to_u16`

If optimizations are at least at level 1, the conversions compile down to the same code as the old one, but if they are turned off, the new code is faster.

* Faster conversion from `f32` to `u16`

The new code is faster in release mode.
2022-01-14 12:23:30 +01:00
hyranno
241b495f44 fix: driver.prepare_output_stream should take streams.input 2021-12-01 12:55:38 +09:00
est31
8e616c3dd9 Update alsa and nix dependencies
Also fixes the build.
2021-10-31 23:37:27 +01: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