Commit Graph

616 Commits

Author SHA1 Message Date
mitchmindtree 6164f83147 Fix compiler errors in wasapi backend after testing on windows 2019-06-21 23:32:00 +10:00
mitchmindtree 0b6e66d38e Update examples to use std Termination 2019-06-21 14:55:21 +02:00
mitchmindtree a733bdb4f9 Fix compile errors on macOS 2019-06-21 03:11:20 +02:00
mitchmindtree eae0e18714 Add `PlayStreamError` and `PauseStreamError`.
This allows for properly handling potential failure on macOS. We should
also consider propagating the mutex/channel poison errors through these
new types, especially considering the potential removal of the event
loop in favour of switching over to high-priority audio threads on
windows and linux.
2019-06-21 03:04:15 +02:00
mitchmindtree ba8d354e93 Improve handling of `BuildStreamError` throughout crate. 2019-06-21 02:38:59 +02:00
mitchmindtree f0e4e312c1 Improve handling of the `DefaultFormatError` 2019-06-21 01:38:21 +02:00
mitchmindtree fbb97f51ef Update examples for DeviceNameError 2019-06-21 01:37:55 +02:00
mitchmindtree 105086a108 Add new `DeviceNameError` type
The coreaudio and wasapi backends may both potentially fail to produce
the name associated with a device. This changes the API to allow for
returning the errors in these cases.
2019-06-21 00:58:15 +02:00
mitchmindtree 78a7cb9e79 Change `SupportedFormatsError::Unknown` variant to `BackendSpecific`
This allows for also passing through a description of the
unknown/platform-specific error.
2019-06-21 00:55:27 +02:00
mitchmindtree 42fc702f53 Add `BackendSpecificError`. Add new `DevicesError`.
See the documentation for both new errors for details.

The new `DevicesError` has been added to allow for returning errors when
enumerating devices. This has allowed to remove multiple potential
`panic!`s in each of the alsa, coreaudio and wasapi backends.
2019-06-20 22:37:36 +02:00
mitchmindtree cf84ab906f Rename `CreationError` to `BuildStreamError`
For clarity and to tie the name more closesly to the methods within from
which it may be returned.
2019-06-20 21:31:15 +02:00
mitchmindtree 0f27c1e0bb Rename `FormatsEnumerationError` to `SupportedFormatsError`
This more tightly associates the error with the device method on which
this might occur.
2019-06-20 21:16:39 +02:00
mitchmindtree 1275db805b Remove std `Error` implementations in favour of using `failure`
This will make adding new errors in the following commits towards better
error handling a lot easier.
2019-06-20 21:12:17 +02:00
mitchmindtree 9c04bf7400
Merge pull request #285 from mohanson/patch-1
Update feedback.rs
2019-06-20 18:31:21 +02:00
Mohanson 6ceb3a215f
Update feedback.rs 2019-06-19 10:34:12 +08:00
mitchmindtree e6f61b3a82
Merge pull request #283 from ishitatsuyuki/no-mutex
Use channels instead of mutex
2019-06-13 13:03:38 +02:00
Tatsuyuki Ishi 1d3754fa7d Use channels instead of mutex 2019-06-13 15:31:37 +09:00
mitchmindtree 755eefedff
Merge pull request #280 from mitchmindtree/deref_panic
Remove unnecessary panic! from OutputBuffer Deref impl
2019-06-08 00:13:53 +02:00
mitchmindtree 960b1d5a40 Remove unnecessary panic! from OutputBuffer Deref impl
Since #269 this `panic!` is certainly unnecessary as `InputBuffer` and
`OutputBuffer` are a thin wrapper around a slice. That said, I'm
struggling to understand exactly why this `panic!` was necessary in the
first place.

This closes #228.
2019-06-07 21:05:14 +02:00
mitchmindtree d0cafd68bf
Merge pull request #276 from AustinJ235/master
Release 0.9.0
2019-06-07 15:39:52 +02:00
mitchmindtree 7f7e50c96a
Merge pull request #211 from mitchmindtree/feedback_example
Add an example that demonstrates feeding input directly to output with some latency
2019-06-06 18:09:09 +02:00
Austin Johnson 49b2c42443 add changelog entries for #248 #254 & #269; update version to 0.9.0 2019-06-06 10:29:52 -05:00
mitchmindtree 48e1a96e60
Merge pull request #244 from azyobuzin/WasapiBufferEmpty
Assertion failed in Windows
2019-06-06 15:24:24 +02:00
mitchmindtree ba4a29ae6c
Merge pull request #275 from desttinghim/invalid-params-fix
Don't panic when setting hardware params in alsa
2019-06-06 15:22:42 +02:00
Austin Johnson 78adc983f6 update hound & lazy_static; release 0.8.2 2019-06-06 00:49:49 -05:00
Louis Pearson e7c086d0af Return error from set_hw_params_from_format instead of crashing 2019-06-04 12:48:11 -06:00
mitchmindtree b82ca1e348
Merge pull request #235 from ArtemGr/master
Switching the headset on and off
2019-06-04 20:15:26 +02:00
mitchmindtree 72fd027f57
Merge pull request #269 from ishitatsuyuki/better-buffer
Better buffer handling
2019-06-04 19:51:45 +02:00
mitchmindtree 7861dd84da
Merge pull request #248 from RoflCopter24/master
Added error handling for unknown ALSA device errors
2019-05-30 23:56:43 +02:00
Tatsuyuki Ishi 4d3fe57fe3 Improved buffer management
- ALSA backend: reuse the buffers
- Make `InputBuffer` and `OutputBuffer` types just a wrapper of slice
  * Buffer is now submitted at the end of callback
2019-05-30 17:45:16 +09:00
mitchmindtree 0354548426
Merge pull request #267 from ishitatsuyuki/254-segfault
Fix #254, logic error in frame/sample size
2019-04-29 22:21:48 +10:00
Tatsuyuki Ishi af88cd87e2 Fix #254, logic error in frame/sample size 2019-04-29 20:33:03 +09:00
mitchmindtree 0b6df67085
Merge pull request #265 from simonrepp/master
Minor textual corrections in crate documentation intro
2019-04-23 03:09:10 +10:00
Simon Repp c2c7089d1a
Minor textual corrections in crate documentation intro 2019-04-22 13:55:42 +02:00
Chris Morgan 2679ea845f impl Debug for Device (#253)
The internal alsa, null and emscripten Device implementations already
implemented Debug; but the coreaudio and wasapi ones, and therefore
also the wrapper, did not.

I decided to eschew the `Device(…)` wrapping in the outer layer
(hence a custom implementation rather than `#[derive(Debug)]`),
because `Device(Device)`, `Device(Device { … })` and so forth all
look better without the extra `Device(…)` wrapping.

On the wasapi and coreaudio implementations I put both the pointer and
name. Name because it’s useful, pointer because on Windows at least
I believe duplicated names are possible. (e.g. two monitors that include
monitors, of the same type; I haven’t strictly confirmed this, because I
killed those off harshly on my machine and don’t want to reinstate
them.)

I do not have access to a macOS device to confirm that the coreaudio
implementation is sane, but I think it is.
2019-03-22 21:27:17 +01:00
Florian Vick 5cb45bfd7e
Added error handling for unknown ALSA device errors (#1)
Instead of taking the easy way out and killing the whole program by panicking, device enumeration and stream creation will now report the error variant 'Unknown'
2018-11-06 21:01:03 +01:00
azyobuzin 8a002b7077 Fix failing the assertion when HRESULT is AUDCLNT_S_BUFFER_EMPTY 2018-10-12 12:12:05 +09:00
Ben Boeckel c2d606176a readme: mention system dependencies (#240)
Fixes #229.
2018-09-17 15:57:51 +02:00
Andre-Philippe Paquet 1a3a8956e4 WASPI - Fix stream start after destroy (#241)
* waspi - Fix stream start after destroy

* Fix stream name
2018-09-12 13:13:13 +02:00
Artem 71a5a43e33 Come to think of it, changing comparison logic unexpectedly is a bad idea. 2018-07-14 16:22:56 +02:00
Artem e959c770e2 Compare the Windows devices by ID, allowing the user to detect if the default device has been changed. 2018-07-14 15:42:48 +02:00
Artem 513071b60a Don't panic when an audio device is disconnected. 2018-07-14 15:41:30 +02:00
Artem 95caa88cfa Fix the PauseStream handler to flip the `playing` bit. (#233)
* Fix the PauseStream handler to flip the `playing` bit.

* Changelog entry on the wasapi stream resuming fix.

* Moved the changelog entry to the Unreleased.
2018-07-10 16:43:52 +02:00
thiolliere 77a4ee6145 impl default output format for emscripten (#234) 2018-07-10 15:04:00 +02:00
Jacob Kiesel 568d4097e7 Upgrade lazy_static (#232) 2018-07-03 21:07:08 +02:00
Nitori 77ce5eba06 Implement Display and Error for DefaultFormatError (#230) 2018-06-30 11:51:24 +02:00
frazar 20fffb26fb Add missing braking changes introduced into 0.7 (#219) 2018-04-18 15:18:10 +02:00
mitchmindtree a2fe9386af [coreaudio] Fix handling of non-default sample rates for input streams (#214)
* [coreaudio] Fix handling of non-default sample rates for input streams

Currently when building an input stream the coreaudio backend only
specifies the sample rate for the audio unit, however coreaudio requires
that the audio unit sample rate matches the device sample rate.

This changes the `build_input_stream` behaviour to:

1. Check if the device sample rate differs from the desired one.
2. If so, check that there are no existing audio units using the device
at the current sample rate. If there are, panic with a message
explaining why.
3. Otherwise, change the device sample rate.
4. Continue building the input stream audio unit as normal.

Closes #213.

* Update CHANGELOG for coreaudio input stream sample rate fix

* Publish 0.8.1 for coreaudio input stream sample rate fix
2018-04-01 13:25:46 +02:00
mitchmindtree c20978fc01 Add an example that demonstrates feeding input directly to output with some latency 2018-02-17 15:33:00 +11:00
mitchmindtree 06a0f0a3ab Publish 0.8 for new Device and Stream API. Update CHANGELOG. (#209) 2018-02-15 08:47:43 +01:00