Commit Graph

339 Commits

Author SHA1 Message Date
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
Tatsuyuki Ishi af88cd87e2 Fix #254, logic error in frame/sample size 2019-04-29 20:33:03 +09: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
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
Nitori 77ce5eba06 Implement Display and Error for DefaultFormatError (#230) 2018-06-30 11:51:24 +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 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
mitchmindtree fcc75f4566 Rename `SamplesRate` to `SampleRate` and `ChannelsCount` to `ChannelCount` (#199)
* Rename SamplesRate to SampleRate and samples_rate to sample_rate

* Rename ChannelsCount to ChannelCount

* Update CHANGELOG for SamplesRate and ChannelsCount renaming
2018-02-04 13:02:16 +01:00
mitchmindtree f2728f6bdf Remove unused `ChannelPosition` API (update all backends and examples accordingly) (#198)
* Remove ChannelPosition API

This removes the ChannelPosition API from the lib root and updates the
ALSA backend and examples accordingly. The other backends have not yet
been updated.

Related discussion at #187.

* Update windows backend to removal of ChannelPosition API

The windows backend now assumes the channel position order is equal to
the channel position mask order. E.g. channel 0 will always be front
left, channel 1 will always be front right, etc.

Compiled and ran both examples successfully.

* Update coreaudio backend to removal of ChannelPosition API

Compiled and ran both examples successfully.

* Update emscriptem backend for removal of ChannelPosition API

* Update CHANGELOG for ChannelPosition removal
2018-02-04 10:38:06 +01: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 45f2f1b371 Update changelog 2018-01-24 21:34:18 +11:00
mitchmindtree dcb7dea028 Implement format handling in `build_voice` macos backend 2018-01-24 21:33:00 +11:00
Andriy Symonovych 37016e612c Fix macos build (#186)
* fix compile error

* fix missing function error

* fix undefined behavior issue

* require callback to be `Send`
2017-12-06 12:13:36 +01:00
Zachary Hamm 5105427529 Fix coreaudio build (#189)
The last commit to coreaudio/mod.rs added a call to convert_error, but
that function was removed earlier. Remove the call to fix the build.
2017-12-05 08:47:08 +01:00
Eidolon e9856c07ed [coreaudio] Remove intermediate buffer (#182)
* [coreaudio] Remove intermediate buffer

Fixes #181

* [coreaudio] Create voice id after setting format
2017-11-03 10:51:02 +01:00
Eidolon 77cd690b00 [coreaudio] Simplify error conversion (#183) 2017-11-03 10:50:02 +01:00
mitchmindtree 019b27350f Implement `pause` and `play` for ALSA backend (#176)
* Implement `pause` and `play` for ALSA backend

This commit also ensures that the Voice is initially paused when
returned to remain consistent with the rest of the CPAL backends.

Related to #175.

* Remove ineffective pause from end of build_voice method

* ALSA - Change `is_paused` flag from `AtomicBool` to `bool`

* Add pause and play ALSA addition to CHANGELOG
2017-11-02 10:30:15 +01:00
tomaka 743e4e3526
Fix #177 (#179) 2017-11-01 10:15:17 +01:00
tomaka 91adc3e380 Docs and style improvements (#174)
* Improve the crate root documentation

* Add entry in CHANGELOG

* Run rustfmt on the code

* More improvements to documentation
2017-10-23 16:41:38 +02: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 87949d859b Add SupportedFormat (#168) 2017-10-20 21:18:40 +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 4b019243c2 Rename the methods of the backend as well (#164) 2017-10-12 11:54:09 +02:00
tomaka 2028d5907f Run rustfmt on the code (#162) 2017-10-11 13:24:49 +02:00
tomaka cdcef96279 Remove the `get_` prefix of methods (#151)
* Remove the `get_` prefix of methods

* Fix overlooks
2017-10-11 10:39:44 +02:00
egnehots bd88d9d6ff Document RemoteIO as ios unit fallback
iOS provides three I/O (input/output) units. The vast majority of audio-unit applications use the Remote I/O unit, which connects to input and output audio hardware and provides low-latency access to individual incoming and outgoing audio sample values. For VoIP apps, the Voice-Processing I/O unit extends the Remote I/O unit by adding acoustic echo cancelation and other features. To send audio back to your application rather than to output audio hardware, use the Generic Output unit.

See https://developer.apple.com/library/content/documentation/MusicAudio/Conceptual/AudioUnitHostingGuide_iOS/UsingSpecificAudioUnits/UsingSpecificAudioUnits.html
2017-10-10 20:43:37 +02:00
egnehots 33a8cde056 Minimal ios support 2017-10-10 18:24:53 +02:00
Johannes Lundberg e86ffce712 Fixes for *BSDs
Replace linux-only eventfd() with pipe() to enable use on *BSDs for alsa.
Add FreeBSD to supported OSes.
2017-07-13 15:59:40 +02:00
shockham 97657fae4a SampleStream also holds on to the AudioUnit so it is not dropped 2017-04-19 11:44:42 +01:00
shockham 8cfe176e52 Fix for loop in EventLoop::run being optimised out in a release build on macOS 2017-04-07 11:06:00 +01:00
Nikita Chashchinskii 0f8babe8bd Pass period instead of buffer to snd_pcm_sw_params_set_avail_min
* Also bump version from 0.4.2 to 0.4.3
2017-02-04 08:20:21 +03:00
jwestfall 7c03219451 alsa: set sw_params_set_avail_min based on get_params buffer size
snd_pcm_sw_params_set_avail_min was being hardcoded to 4096, which
seems to be problematic for lower sample rates.  This update sets
the value to the buffer size as supplied by snd_pcm_get_params(),
which is what alsa own sample code does.

This should fix https://github.com/tomaka/cpal/issues/142
2017-01-23 16:10:44 -08:00
Pierre Krieger c291ab13f1 Mark deprecated functions as deprecated 2016-11-16 08:32:02 +01:00
Pierre Krieger a26a9f5337 Fix compilation on windows 2016-11-16 08:17:11 +01:00
Ronald Kinard b44a2ab515 [osx] Implement play/pause for coreaudio 2016-10-18 01:20:40 -05:00
thiolliere 25bb025a9a arc not necessary 2016-10-02 14:24:30 +02:00
thiolliere 5c86eec4f3 line not necessary 2016-10-02 14:21:33 +02:00
thiolliere 1b0c9f2c54 syntax: space after comma 2016-10-02 14:19:58 +02:00
thiolliere f822631bc4 impl play and pause for ALSA
snd_pcm_pause could have been used but not all hardware implement it, so
I propose not to use it.

In this implementation:

there are two kind of scheduling: wait for resume signal and wait for
pcm to be available

if the stream is paused then it return notready and wait for resume

the event loop is different as it manages descriptors corresponding to
voices according to the nature of the scheduling.

there is still a FIXME: in voice.play the is signal is send even if
the event loop wasn't waiting for resume.
It doesn't seem to create any issue. But it happens when you write
voice.pause();voice.play();
2016-10-02 13:29:01 +02:00
mitchmindtree f71a95cd0e Do not lock inner twice. Fixes bug in osx futures 0.1.1 update. 2016-10-01 18:19:27 +10:00
Pierre Krieger 869af718a2 Try fix the OSX code with futures 2016-10-01 09:21:29 +02:00
thiolliere e031025abe update to futures 0.1.1: alsa wasapi 2016-10-01 00:44:22 +02:00
Boris-Chengbiao Zhou 70858ad2e5 Fix #126 2016-08-19 21:48:53 +02:00
Pierre Krieger bf051dd16f Add some documentation to the winapi implementation 2016-08-12 18:06:17 +02:00
Pierre Krieger b1add0b12b Fix most warnings 2016-08-12 17:57:06 +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 6060582aa0 Update the null implementation 2016-08-03 13:06:23 +02:00
Pierre Krieger c2f89d8b2d Update documentation 2016-08-03 13:06:23 +02:00
Pierre Krieger 0c915cac8f Use a max buffer size in order to avoid problems 2016-08-03 10:31:02 +02:00
Pierre Krieger 7c587853ad Make it work on Linux 2016-08-03 10:17:23 +02:00
Pierre Krieger be8310da51 Draft for switching to futures 2016-08-02 18:19:03 +02:00
Jan Solanti f717817c86 coreaudio: update to coreaudio-rs 0.5.0 2016-07-06 00:13:17 +03:00
Ronald Kinard 4d2767ee42 [osx] Correct implementation of get_pending_samples 2016-06-28 18:09:54 -05:00
Ronald Kinard e9b8f46f73 [osx] Return correct Voice period. 2016-06-14 23:38:52 -05:00
Ronald Kinard b2635a52c5 [osx] Add get_period to Voice 2016-06-01 01:28:59 -05: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
Mathijs van de Nes f3f194293a Fix underflow detection for alsa
The old method always returned _RUNNING on some machines.
This new method seems to produce the expected behaviour.

Note: -32 is probably -EPIPE, but the appropriate constant was not
available at this time.
2016-02-28 17:01:13 +01:00
Nicolas Koch 606bcf9fa6 Fix underflow bug on linux 2016-01-28 21:27:09 +01:00
psych0d0g 7c3aab71a2 Add some sane error messages 2016-01-15 21:16:34 +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 dd87dbc1d2 Fix compilation on OSX with the new API for coreaudio-rs
this builds upon the following pull request:
https://github.com/tomaka/cpal/pull/81
2016-01-12 17:06:14 +01:00
tomaka b049e80ca3 Merge pull request #84 from tomaka/alsa-channels
Use correct ALSA channels
2015-12-15 17:49:42 +01:00
Peter Atashian fc4e3ce823 Update winapi
Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-11-09 17:52:43 -05:00
Mathijs van de Nes 951b7f5e65 Catch another 'device not found' error code 2015-10-13 12:22:07 +02:00
Pierre Krieger 55dbfa881e Use correct ALSA channels 2015-09-27 13:27:00 +02:00
Pierre Krieger c93ffcff6c Add Voice::get_period() 2015-09-27 13:00:17 +02:00
Ronald Kinard 30e96aa15a coreaudio: implementation cleanup 2015-09-26 23:04:17 -05:00
Ronald Kinard 1cdf5af808 coreaudio: Implement some missing functions.
underflow and get_pending_samples.
2015-09-24 16:24:12 -05:00
Ronald Kinard 53c5529b16 Return correct length of buffer, stub unimpl funcs 2015-09-24 13:19:42 -05:00
Ronald Kinard fd50a113a1 Revert "coreaudio: Add support for U16/I16 PCM formats."
This reverts commit bdef4fb3fe.
2015-09-24 12:54:54 -05:00
Ronald Kinard bdef4fb3fe coreaudio: Add support for U16/I16 PCM formats.
The conversion is done Rust-side instead of using AUHAL's
automatic conversion because I haven't gotten around generics
issues yet.
2015-09-23 23:19:29 -05:00
Ronald Kinard 54fb5b03cc Set coreaudio sample rate to 44100.
This makes rodio demos work correctly!
2015-09-23 22:23:57 -05:00
Ronald Kinard dbf9ae20da Make coreaudio Voice Send/Sync. 2015-09-23 22:14:32 -05:00
Ronald Kinard c841be235c Restore CoreAudio support after API overhaul. 2015-09-23 22:02:28 -05:00
Pierre Krieger 6bd28231ec Make sure that all writes succeed 2015-09-22 21:01:26 +02:00
Pierre Krieger 5fc346b34b Make the ALSA implementation more robust by recovering from underruns 2015-09-22 20:20:17 +02:00
Pierre Krieger 44e9dce43f Add Voice::get_pending_samples 2015-09-22 17:59:36 +02:00
Pierre Krieger 33dc72ab45 Add device name on WASAPI 2015-09-22 16:05:40 +02:00
Pierre Krieger 5fa41538a6 Various ALSA fixes 2015-09-22 15:46:56 +02:00
tomaka 0a13991f86 Merge pull request #75 from tomaka/alsa-format
Use the correct format in ALSA
2015-09-22 15:23:28 +02:00
Pierre Krieger 46151e09cc Use the correct format in ALSA 2015-09-22 15:20:11 +02:00
Pierre Krieger a2b8b4f4a7 Use the correct device name when enumerating formats 2015-09-22 15:12:41 +02:00
Pierre Krieger 73906885f9 Fix bug and filter out devices that are not "Output" 2015-09-22 15:04:32 +02:00
tomaka debb6c957c Merge pull request #73 from tomaka/example-enumerate
Example enumerate
2015-09-22 14:49:31 +02:00
Pierre Krieger ec48453b6f Add endpoint::get_name() and an enumerate example 2015-09-22 14:46:27 +02:00
tomaka d4c7d91fd7 Merge pull request #63 from tomaka/alsa-formats
Correctly enumerate supported formats on ALSA
2015-09-22 13:56:22 +02:00
Pierre Krieger 8d21f5ff25 Store the format in the public `Voice` struct 2015-09-22 13:34:06 +02:00
Pierre Krieger d0e5e7f4e6 General WASAPI cleanup 2015-09-22 13:26:22 +02:00
Pierre Krieger de0236b3b0 Fix the hack in the WASAPI implementation 2015-09-22 10:26:11 +02:00
tomaka d3e610a614 Merge pull request #64 from tomaka/underflowed
Add an underflow() method to Voice
2015-09-22 10:02:41 +02:00
tomaka 826ad84db4 Merge pull request #66 from tomaka/inline
Add #[inline] attributes
2015-09-22 10:01:59 +02:00
Peter Atashian 61ac0528e7 Update winapi dependency
Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-09-17 14:22:52 -04:00
Peter Atashian 5b1291c215 Unused extern crate libc
Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-09-17 06:29:13 -04:00
Pierre Krieger 75f828b04f Add #[inline] attributes 2015-09-11 10:55:29 +02:00
Pierre Krieger 3dd7a8abe7 Add UnknownBufferType::len() 2015-09-10 21:24:41 +02:00
Pierre Krieger c5e2cdd3c5 Add an underflow() method to Voice 2015-09-10 21:03:40 +02:00
Pierre Krieger c5f51183f4 Correctly enumerate supported formats on ALSA 2015-09-10 19:48:39 +02:00
Pierre Krieger d9eae23023 Restore the null implementation and compile it every time 2015-09-10 18:42:42 +02:00
Pierre Krieger 541af2f7f2 Fix compilation on ALSA 2015-09-10 12:43:37 +02:00
Pierre Krieger 48282a068d Handle channels positionning 2015-09-10 11:44:19 +02:00
Pierre Krieger d7a31b4762 Fix doctests 2015-09-01 17:47:55 +02:00
Pierre Krieger 3db17889a4 Make ALSA compile again 2015-09-01 17:15:49 +02:00
Pierre Krieger 078769dbbd Enable 32bits samples with WASAPI 2015-09-01 15:58:22 +02:00
Pierre Krieger 77fb55329e Better error handling in format detection 2015-09-01 15:33:44 +02:00
Pierre Krieger dc08fc4652 Now decoding the format from the WAVEFORMAT returned by the winapi 2015-09-01 15:32:03 +02:00
Pierre Krieger bf20431901 Handle F32 formats in Voice::new 2015-09-01 14:51:35 +02:00
Pierre Krieger 52052b6d07 Use the format passed as parameter in Voice::new 2015-09-01 14:26:25 +02:00
Pierre Krieger 98b931edff Add proper error handling 2015-09-01 14:17:57 +02:00
Pierre Krieger 1985c346ac Add supported formats enumeration 2015-09-01 13:53:54 +02:00
Pierre Krieger 47f966bf75 Correctly enumerate audio devices (core + wasapi) 2015-09-01 11:29:00 +02:00
Pierre Krieger ca72d1d67e Remove the conversion system 2015-08-20 14:44:23 +02:00
Mariusz Ceier 55eec8567e Add more detailed message to panic
When samples format is not supported, cpal panics with "not yet implemented" message, which is not useful in bug reports.
This adds samples format to the message.

Signed-off-by: Mariusz Ceier <mceier+cpal@gmail.com>
2015-08-18 08:54:40 +02:00
Ronald Kinard 6389ab3ece Remove use of box syntax.
Allows build on stable/beta rust.
2015-07-25 17:13:51 -05:00
Ronald Kinard 157011182a Add box syntax feature annotation.
Fixes build.
2015-07-25 17:08:31 -05:00
Pierre Krieger 2f36175d96 Fix samples signs on win32 2015-07-22 14:28:45 +02:00
Pierre Krieger c71d9d74b3 Merge branch 'sample-format' of https://github.com/kmcallister/cpal into fix-signed 2015-07-22 14:28:13 +02:00
Pierre Krieger 48b7278254 Fix the win32 build 2015-07-20 19:06:58 +02:00
Pierre Krieger b813aa168a Calls to a single ALSA channel are not thread safe 2015-06-24 15:17:52 +02:00
Peter Atashian 618ef2a4f9 Use shiny new COM
Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-05-27 12:24:14 -04:00
Pierre Krieger d85f969caf Rustup and version bumps 2015-04-20 09:30:36 +02:00
Pierre Krieger 07b2009dae Update for Rustc 1.0.0 beta 2015-04-04 09:22:23 +02:00
Pierre Krieger 93073f1ff7 Update for change in rustc and winapi 2015-03-30 11:19:03 +02:00
Pierre Krieger a6c1b14d66 Rustup 2015-03-26 10:03:40 +01:00
Pierre Krieger 84326cb4a7 Rustup 2015-03-25 13:50:52 +01:00
mitchmindtree 1d66e18d7e Fixed coreaudio callback to send proper buffersize, removed code in lib where sampleformat affected buffersize 2015-03-03 18:17:21 +11:00
mitchmindtree 1347c7c99d Removed core_audio-sys local bindings in favour of new coreaudio-rs crate 2015-03-01 05:50:29 +11:00
mitchmindtree d6470de74c Properly shutdown the AudioUnit on drop 2015-02-28 06:43:15 +11:00
mitchmindtree f212d85889 OSX support via the Apple Core Audio, Audio Unit C API. Only supports f32 so far. 2015-02-28 06:05:24 +11:00
Keegan McAllister 8692eb2fc6 Correct reported ALSA sample format 2015-02-24 14:02:22 -08:00
mitchmindtree 2b86445c9a Merge remote-tracking branch 'upstream/master'
merging with upstream changes
2015-02-23 00:50:10 +11:00
mitchmindtree c9fe2a132a Commiting pre-merge 2015-02-23 00:50:06 +11:00
Pierre Krieger 28bd368658 Update for rustc 2015-02-22 11:24:49 +01:00
Pierre Krieger 0fa579d885 Update for rustc 2015-02-19 21:22:22 +01:00
Pierre Krieger 2e6143269a Update for rustc 2015-01-29 14:57:11 +01:00
Pierre Krieger 284f12f1cb Update for winapi 2015-01-20 16:45:47 +01:00
Pierre Krieger 48efe03661 Add a "null" implementation for platforms that aren't supported 2015-01-09 22:52:12 +01:00
Pierre Krieger 2bc50adf4d Update for rust-1.0 alpha 2015-01-09 21:25:51 +01:00
Pierre Krieger 23e1e0639c Update for Rustc 2015-01-08 21:24:04 +01:00
Pierre Krieger 420a0f0fd4 Update for rustc 2015-01-05 10:52:59 +01:00
Pierre Krieger 7adfdb4461 Update for changes in rustc 2014-12-30 08:35:13 +01:00
Pierre Krieger 7389ebf84b Add `#[must_use]` marker for Buffer 2014-12-26 10:39:19 +01:00
tomaka 73cd809636 Merge pull request #5 from tomaka/add-play-pause
Add play() and pause() functions
2014-12-23 15:28:43 +01:00
Pierre Krieger d947014084 Add play() and pause() functions 2014-12-23 15:25:25 +01:00
tomaka 0f76134359 Merge pull request #8 from tomaka/clean-convert-samples
Cleanup and add tests for convert_samples_rate
2014-12-23 15:02:26 +01:00
Pierre Krieger 6f01c38a62 Implement f32 to i16 and f32 to u16 conversions 2014-12-22 16:35:10 +01:00
Pierre Krieger aa83f64443 Cleanup and add tests for convert_samples_rate 2014-12-22 16:31:37 +01:00
Pierre Krieger fb11478bf6 Cleanup and add tests for convert_channels 2014-12-22 15:34:18 +01:00
Pierre Krieger 56cb67989e Update for rustc 2014-12-20 18:55:44 +01:00
Pierre Krieger e607e65379 Improve documentation 2014-12-17 09:45:14 +01:00
Pierre Krieger 04f9aac2c3 Rename `Channel` to `Voice` 2014-12-17 09:16:26 +01:00
Pierre Krieger 094dbef0e4 Add some documentation 2014-12-17 09:13:58 +01:00
Pierre Krieger f096a3b3a9 Add fixes and tests for samples conversions 2014-12-17 09:08:13 +01:00
Pierre Krieger 9721004ad0 Use Cow for formats conversions to avoid an allocation and copy 2014-12-17 08:53:09 +01:00
Pierre Krieger f4ac8a5492 Implement all samples formats 2014-12-17 08:47:19 +01:00
Pierre Krieger d3d6dd94db Implement samples formats conversions 2014-12-17 08:39:00 +01:00
Pierre Krieger c2ed846765 Add basic implementation for alsa 2014-12-16 16:54:58 +01:00
Pierre Krieger 302a1941ab Fix warnings 2014-12-15 16:41:57 +01:00
Pierre Krieger d06a67a97b Fix PCM formats conversions not working 2014-12-15 16:40:55 +01:00
Pierre Krieger 49636365d8 Switch back to using buffers 2014-12-15 16:32:13 +01:00
Pierre Krieger 1a556514b0 Sound output now works correctly 2014-12-15 16:26:55 +01:00
Pierre Krieger 9598f68d3c Minor fixes 2014-12-15 16:06:37 +01:00
Pierre Krieger 5c6fa4384f Fix issue when calling `buffer.samples()` multiple times with the same buffer 2014-12-15 15:48:30 +01:00
Pierre Krieger e26a8c4cb2 Minor nitpicking 2014-12-15 15:40:30 +01:00
Pierre Krieger 04d07c27dc Modify API to use a "samples" iterator 2014-12-15 15:29:59 +01:00
Pierre Krieger 081912c5fb Implement some samples rate conversions 2014-12-15 11:58:52 +01:00
Pierre Krieger 32bca93cc9 Implement some basic data conversion 2014-12-15 11:45:38 +01:00
Pierre Krieger b23857a57c Restore variable input format system 2014-12-15 10:29:29 +01:00
Pierre Krieger f00bb5a2b8 Update for rustc 2014-12-15 10:16:18 +01:00
Pierre Krieger b4b75f526a Remove old code 2014-12-11 19:42:49 +01:00
Pierre Krieger 8efaf06ec2 Add destructor for wasapi::Channel 2014-12-11 19:42:04 +01:00
Pierre Krieger 99c23327d8 Add some formats-related functions 2014-12-11 19:07:58 +01:00
Pierre Krieger 0bdafdab9b Buffer now always has the u8 format 2014-12-11 19:02:04 +01:00
Pierre Krieger b98ac14bf4 Add some documentation 2014-12-11 18:09:48 +01:00
Pierre Krieger 873779aaa8 Add basic API 2014-12-11 17:41:18 +01:00
Pierre Krieger 6b48a00758 Semi-working WASAPI example 2014-12-11 16:28:26 +01:00
Pierre Krieger 4f96e54e31 Initial commit 2014-12-11 14:23:51 +01:00