Commit Graph

102 Commits

Author SHA1 Message Date
Tom Gowan d430000d2c beep working 2019-07-05 05:51:22 +10:00
Tom Gowan 8d5cb951d8 asio_utils 2019-07-05 05:51:22 +10:00
DMSDeveloper 9a084347db removed itertools 2019-07-05 05:51:21 +10:00
Tom Gowan 49968f4b82 change of branch 2019-07-05 05:51:21 +10: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
Austin Johnson 49b2c42443 add changelog entries for #248 #254 & #269; update version to 0.9.0 2019-06-06 10:29:52 -05:00
Austin Johnson 78adc983f6 update hound & lazy_static; release 0.8.2 2019-06-06 00:49:49 -05:00
Jacob Kiesel 568d4097e7 Upgrade lazy_static (#232) 2018-07-03 21:07:08 +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 06a0f0a3ab Publish 0.8 for new Device and Stream API. Update CHANGELOG. (#209) 2018-02-15 08:47:43 +01:00
mitchmindtree c38bbb26e4 Update to a more general Device and Stream API. Add support for input streams (E.g. microphone). Add default format methods. (#201)
* Update to a more general Device and Stream API

This update prepares for adding input stream support by removing the
`Endpoint` type (which only supports output streams) in favour of a more
general `Device` type which may support any number of input or output
streams. Previously discussed at #117.

The name `Voice` has been replaced with the more ubiquitous name
`Stream`. See #118 for justification.

Also introduces a new `StreamData` which is now passed to the
`EventLoop::run` callback rather than the `UnknownTypeBuffer`.
`StreamData` allows for passing either `Input` data to be read, or
`Output` data to be written.

The `beep.rs` example has been updated for the API changes.

None of the backends have been updated for this API change yet. Backends
will be updated in the following commits.

Closes #117.
Closes #118.

* Update ALSA backend for new `Device` and `Stream` API.

* Update wasapi backend for new `Device` and `Stream` API.

* Update enumerate.rs example for new `Device` and `Stream` API.

* Update coreaudio backend for new `Device` and `Stream` API.

* Fix lib doc tests for Device and Stream API update

* Update emscripten backend for new `Device` and `Stream` API.

* Update null backend for new `Device` and `Stream` API.

* Merge match exprs in beep.rs example

* Add Input variant along with UnknownTypeInputBuffer and InputBuffer

UnknownTypeBuffer and Buffer have been renamed to
UnknownTypeOutputBuffer and OutputBuffer respectively.

No backends have yet been updated for this name change or the addition
of the InputBuffer.

* Update null backend for introduction of InputBuffer

* Update emscripten backend for introduction of InputBuffer

* Make InputBuffer inner field an option to call finish in drop

* Update alsa backend for introduction of InputBuffer

* Update wasapi backend for introduction of InputBuffer

* Update coreaudio backend for introduction of InputBuffer

* Update enumerate.rs example to provide more detail about devices

The enumerate.rs example now also displays:

- Supported input stream formats.
- Default input stream format.
- Default output stream format.

This should also be useful for testing the progress of #201.

* Add `record_wav.rs` example for demonstrating input streams

Records a ~3 second WAV file to `$CARGO_MANIFEST_DIR/recorded.wav` using
the default input device and default input format.

Uses hound 3.0 to create and write to the WAV file.

This should also be useful for testing the input stream implementations
for each different cpal backend.

* Implement input stream support for coreaudio backend

This implements the following for the coreaudio backend:

- Device::supported_input_formats
- Device::default_input_format
- Device::default_output_format
- EventLoop::build_input_stream

The `enumerate.rs` and `record_wav.rs` examples now work successfully on
macos.

* Add `SupportedFormat::cmp_default_heuristics` method

This adds a comparison function which compares two `SupportedFormat`s in
terms of their priority of use as a default stream format.

Some backends (such as ALSA) do not provide a default stream format for
their audio devices. In these cases, CPAL attempts to decide on a
reasonable default format for the user. To do this we use the "greatest"
of all supported stream formats when compared with this method.

* Implement input stream support for ALSA backend

This implements the following for the ALSA backend:

- Device::supported_input_formats
- Device::default_input_format
- Device::default_output_format
- EventLoop::build_input_stream

Note that ALSA itself does not give default stream formats for its
devices. Thus the newly added `SupportedFormat::cmp_default_heuristics`
method is used to determine the most suitable, supported stream format
to use as the default.

The `enumerate.rs` and `record_wav.rs` examples now work successfully on
my linux machine.

* Implement input stream support for wasapi backend

This implements the following for the wasapi backend:

- Device::supported_input_formats
- Device::default_input_format
- Device::default_output_format
- EventLoop::build_input_stream

Note that wasapi does not enumerate supported input/output stream
formats for its devices. Instead, we query the `IsFormatSupported`
method for supported formats ourselves.

* Fix some warnings in the alsa backend

* Update CHANGELOG for introduction of input streams and related items

* Update README to show latest features supported by CPAL

* Simplify beep example using Device::default_output_format

* Remove old commented code from wasapi/stream.rs
2018-02-12 14:10:24 +01:00
mitchmindtree b47e46a4ac Update winapi version from 0.2 to 0.3 (#202)
Adds only the necessary cargo features to reduce compile time and reduce
the chance of linking errors occurring for unused libraries (e.g.
d3d12.dll fails to link on my win10 VM).

I thought I'd try and land this before before working on the wasapi
backend implementation for #201.

Tested both beep.rs and enumerate.rs and they work fine with the update.
2018-02-07 17:36:59 +01:00
Pierre Krieger 3ff9e6fe65
Publish 0.7 (#200) 2018-02-04 13:03:03 +01:00
mitchmindtree d482d646a0 Link only to necessary coreaudio frameworks 2018-02-03 14:14:15 +11:00
mitchmindtree 3952c44c63 [macos] Implement Endpoint and Format Enumeration
Based on #195.

Also implements proper handling of the given `Endpoint` in the
macos implementation of the `build_voice` method.

Updates to the latest coreaudio-sys and coreaudio-rs which include the
additional necessary frameworks.

Also adds a line that prints the name of the default device in the
`enumeration.rs` example.

Updates the CHANGELOG for this PR.

Closes #194.
Related to #180.

Related external issues:

- RustAudio/coreaudio-sys#4
- RustAudio/coreaudio-rs#57
2018-01-28 12:40:25 +11:00
mitchmindtree d09532c36e Publish v0.6.0 (#190)
There does not seem to be any major API breakage, however the emscripten
and macos backends have been pretty heavily refactored so I thought it
best to bump to 0.6 (rather than 0.5.2) just in case there is any subtle
behavioural breakage. Happy to change this to 0.5.2 though if someone
can confirm there will be no downstream breakage.
2017-12-11 09:31:22 +01:00
tomaka c524f63000 Improve the emscripten backend (#172)
* Use the js! macro from stdweb

* Rework the Buffer::finish method

* Use references from stdweb

* Fix emscripten warnings

* Rework the run() method to use stdweb

* Adjust timings

* Add entry in CHANGELOG
2017-10-22 14:17:25 +02:00
tomaka d353c97c30 Add samples conversion functions and publish 0.5.1 (#170) 2017-10-21 09:45:02 +02:00
tomaka 40bd5a9f2c Publish 0.5.0 (#169) 2017-10-21 09:25:24 +02:00
tomaka c28407b26d Fix warnings and reduce scope of libc (#166) 2017-10-19 12:44:14 +02:00
tomaka 6ae01f437c RFC: Rework the API [WIP] (#165)
* Rework the API to not use futures anymore

* Add some comments

* Update the MacOS backend

* Restore the null implementation

* Add an emscripten backend

* Remove erroneously added feature

* Fix to_f32 formula

* [WIP] Alsa backend

* Alsa backend compiling

* Working ALSA backend

* Fix tests

* Move WASAPI endpoint to endpoint module

* Fix WASAPI warnings

* Rework the WASAPI backend

* Check overflows for voice ID

* Add comments and minor fixes to WASAPI backend

* Add a changelog
2017-10-18 20:24:05 +02:00
tomaka 84f0acbd65 Publish 0.4.6 (#163) 2017-10-11 14:34:40 +02:00
egnehots 33a8cde056 Minimal ios support 2017-10-10 18:24:53 +02:00
mitchmindtree 381d599155 Publish 0.4.5 2017-04-29 01:04:13 +10:00
Pierre Krieger 263039412e Simplify the Cargo.toml 2017-02-10 09:56:53 +01:00
Nikita Chashchinskii 5c33787f48 Bump crate version to 0.4.4 2017-02-04 08:20:21 +03:00
jwestfall d167bbc206 bump crate to 0.4.3 2017-02-01 20:51:41 -08:00
ferris 6e8f51de09 Bump crate version to 0.4.2 2017-01-19 16:06:17 +01:00
ferris 929bc1b8be Add coreaudio-rs dependency for i686-apple-darwin
Fixes build for 32-bit mac
2017-01-19 14:51:50 +01:00
Pierre Krieger 4511ac5b56 Publish 0.4.1 2016-11-16 08:18:14 +01:00
Pierre Krieger d0610c14f0 Publish 0.4.0 2016-10-01 10:30:38 +02:00
Pierre Krieger 375d669ce4 Force futures 0.1.1 2016-10-01 09:09:50 +02:00
tomaka e5f127b460 Bump to 0.3.1 2016-08-20 07:35:53 +02:00
Pierre Krieger 88bf15faca Bump alsa-sys to 0.1 2016-08-14 20:16:34 +02:00
Pierre Krieger 71e94bb6d1 Update the Cargo.toml and the README 2016-08-12 17:54:54 +02:00
mitchmindtree cc26897acd Update coreaudio backend to new futures-rs oriented design.
This depends on the changes introduced in #121.

Update to coreaudio 0.6.
2016-08-12 17:49:13 +10:00
Pierre Krieger be8310da51 Draft for switching to futures 2016-08-02 18:19:03 +02:00
tomaka 47fec7e846 Merge pull request #115 from tomaka/tomaka-patch-1
Bump to 0.2.12
2016-08-02 09:25:43 +02:00
George Burton b981277c86 Update deps 2016-07-26 05:08:16 +01:00
tomaka b30fc84124 Update to 0.2.12 2016-07-10 20:25:11 +02:00
Jan Solanti f717817c86 coreaudio: update to coreaudio-rs 0.5.0 2016-07-06 00:13:17 +03:00
Pierre Krieger 752676c818 Be more relaxed with c_void 2016-04-25 13:33:12 +02:00
Pierre Krieger c4bf6e91da Fix the android build 2016-04-22 17:31:24 +02:00
Ben Burdette cb3183a19a add ARM target 2016-02-14 20:20:09 +00:00
tomaka c72467a574 Publish 0.2.9 2016-01-28 22:25:16 +01:00
psych0d0g b7319626b1 allow for building for mipsel targets
mipsel is mostly used on embedded multimedia devices like settop bockes for eg.
This change will allow building cpal for those platforms aswell
2016-01-14 22:22:56 +01:00
tomaka 1603bc8423 Merge pull request #94 from Geal/coreaudio-fix
Coreaudio compilation fixes
2016-01-12 17:49:34 +01:00
Geoffroy Couprie 41d86ce17b Do not use a wildcard version number 2016-01-12 17:16:15 +01:00
tomaka 8ec4bc4b6d Publish 0.2.8 2015-11-10 07:52:07 +01:00
tomaka 54f3dc4eb4 Libc 0.2 2015-11-10 07:39:24 +01:00