Commit graph

79 commits

Author SHA1 Message Date
Roderick van Domburg
7226bfd55a
Remove warning for Rodio on Alsa (fixed upstream) (#696) 2021-04-15 08:42:19 +02:00
johannesd3
b4f9ae31e2 Fix clippy warnings 2021-04-10 14:06:41 +02:00
johannesd3
a576194b0e Fix bug in rodio backend 2021-04-10 13:31:42 +02:00
johannesd3
26c127c2ec Merge branch 'dev' into tokio_migration 2021-04-10 12:59:47 +02:00
johannesd3
5435ab3270 Fix compile errors in backends
fe37186 added the restriction that `Sink`s must be `Send`. It turned
out later that this restrictions was unnecessary, and since some
`Sink`s aren't `Send` yet, this restriction is lifted again.

librespot-org/librespot#601 refactored the `RodioSink` in order to make
it `Send`. These changes are partly reverted in favour of the initial
simpler design.

Furthermore, there were some compile errors in the gstreamer backend
which are hereby fixed.
2021-04-10 12:50:30 +02:00
Roderick van Domburg
928a673653 DRY up constructors 2021-04-05 23:14:02 +02:00
Roderick van Domburg
07d710e14f Use AudioFormat size for SDL 2021-03-31 20:41:09 +02:00
Roderick van Domburg
d252eeedc5 Warn about broken backends 2021-03-27 22:53:05 +01:00
Roderick van Domburg
cc60dc11dc Fix buffer size in JACK Audio backend 2021-03-27 22:52:43 +01:00
Roderick van Domburg
bfca1ec15e Minor code improvements and crates bump 2021-03-27 21:13:14 +01:00
Roderick van Domburg
74b2fea338 Refactor sample conversion into separate struct 2021-03-21 22:16:47 +01:00
Roderick van Domburg
a1326ba9f4 First round of refactoring
- DRY-ups

 - Remove incorrect optimization attempt in the libvorbis decoder,
   that skewed 0.0 samples non-linear

 - PortAudio and SDL backends do not support S24 output. The PortAudio
   bindings could, but not through this API.
2021-03-18 22:06:43 +01:00
Roderick van Domburg
b94879de62 Fix GStreamer buffer pool size [ref #660 review] 2021-03-18 20:51:53 +01:00
Roderick van Domburg
770ea15498 Add support for S24 and S24_3 output formats 2021-03-17 00:00:27 +01:00
Roderick van Domburg
9dcaeee6d4 Default to S16 output 2021-03-16 20:22:00 +01:00
Roderick van Domburg
5f26a745d7 Add support for S32 output format
While at it, add a small tweak when converting "silent" samples
from float to integer. This ensures 0.0 converts to 0 and vice
versa.
2021-03-13 23:43:24 +01:00
Roderick van Domburg
a4ef174fd0 Fix Alsa backend for 64-bit systems 2021-03-12 23:50:17 +01:00
Roderick van Domburg
5257be7824 Add command-line option to set F32 or S16 bit output
Usage: `--format {F32|S16}`. Default is F32.

 - Implemented for all backends, except for JACK audio which itself
 only supports 32-bit output at this time. Setting JACK audio to S16
 will panic and instruct the user to set output to F32.

 - The F32 default works fine for Rodio on macOS, but not on Raspian 10
 with Alsa as host. Therefore users on Linux systems are warned to set
 output to S16 in case of garbled sound with Rodio. This seems an issue
 with cpal incorrectly detecting the output stream format.

 - While at it, DRY up lots of code in the backends and by that virtue,
 also enable OggData passthrough on the subprocess backend.

 - I tested Rodio, ALSA, pipe and subprocess quite a bit, and call on
 others to join in and test the other backends.
2021-03-12 23:09:15 +01:00
Roderick van Domburg
f29e5212c4 High-resolution volume control and normalisation
- Store and output samples as 32-bit floats instead of 16-bit integers.
   This provides 24-25 bits of transparency, allowing for 42-48 dB of
   headroom to do volume control and normalisation without throwing
   away bits or dropping dynamic range below 96 dB CD quality.

 - Perform volume control and normalisation in 64-bit arithmetic.

 - Add a dynamic limiter with configurable threshold, attack time,
   release or decay time, and steepness for the sigmoid transfer
   function. This mimics the native Spotify limiter, offering greater
   dynamic range than the old limiter, that just reduced overall gain
   to prevent clipping.

 - Make the configurable threshold also apply to the old limiter, which
   is still available.

Resolves: librespot-org/librespot#608
2021-03-12 23:09:15 +01:00
Evan Cameron
6a33eb4efa
minor cleanup 2021-02-28 21:54:19 -05:00
johannesd3
c0942f14e8 Restore rodiojack support
Probably more simple than the previous approach which
doubles the code: Instead of implementing the `Open` trait,
we simply use custom SinkBuilder, one for the default host,
and one for the "jack" host.
2021-02-23 22:22:51 +01:00
johannesd3
678d1777fd Merge branch 'dev' into tokio_migration 2021-02-23 22:22:49 +01:00
johannesd3
1fc5267a71 Revert "Merge pull request #548 from Lcchy/rodiojack-backend"
This reverts commit f483075b2c, reversing
changes made to ea8ece36d9.
2021-02-23 22:20:58 +01:00
Philippe G
34bc286d9b ogg passthrough
rename
2021-02-22 13:45:53 -08:00
johannesd3
689415a6f1 Improved error handling in rodio backend 2021-02-12 19:34:40 +01:00
johannesd3
b2f1be4374 Make RodioSink Send and improve error handling 2021-02-12 19:34:28 +01:00
johannesd3
872fab62d8 Merge branch 'dev' into tokio_migration 2021-02-10 21:51:33 +01:00
Sasha Hilton
59f87dcb37 Amend conditional compilation to fail on unsupported systems 2021-02-10 01:44:05 +00:00
Lcchy
52438b1cc2 Use rodio for jackaudio backend 2021-02-09 17:45:21 +01:00
Johannesd3
ed20f357dc
Fix playback in pulseaudio backend (#577)
* Fix playback in pulseaudio backend

* Add comment regarding safety
2021-01-29 02:01:38 +00:00
johannesd3
fe37186804 Make librespot_playback work 2021-01-25 09:04:33 +01:00
Lyndon Brown
3ba05845d2 upgrade jack dependency from v0.5 to v0.6
A bunch of stuff got moved around; means of constructing audio output port
changed.

I simply used the commits, mostly from [1], to their examples to figure
out how to address the errors that resulted from compiling after the
version bump. It compiles cleanly again now.

[1]: https://github.com/RustAudio/rust-jack/pull/89
2020-12-14 11:53:54 +00:00
Lyndon Brown
120bd88326 fix alignment causing format check failure 2020-12-13 17:51:43 +00:00
Lyndon Brown
0411e69548 convert PulseAudio backend to use the available binding crates
rather than the raw 'sys' layer.
2020-12-13 17:51:41 +00:00
Lyndon Brown
28061dffe2 upgrade to newer PulseAudio crate dependency
requires adding dependency on libpulse-simple-sys since the PulseAudio
simple components were moved to their own crate (the original version
did not stick to the one crate per one system library rule).

this fixes the licensing compatibility issue discussed in #539 ([1])
(the original v0.0.0 was LGPL-3.0 licensed, while v1.11 onwards are
'MIT OR Apache-2.0').

[1]: https://github.com/librespot-org/librespot/issues/539
2020-12-13 17:50:23 +00:00
Will Stott
8ff1dc24bd Quick minimal hack to get latest rodio working. 2020-12-02 19:45:46 +00:00
Sasha Hilton
732bb1ce82 Merge branch 'dev' into gst1.0-2020 2020-07-25 02:52:21 +01:00
sniperrifle2004
1e5d98b8fd Actually store the period_size 2020-06-17 03:53:20 +02:00
sniperrifle2004
82e54dfaba Rewrite buffer around the actual period size
This prevents over or underestimating of the period.
While it is unlikely, with comparitively small period
sizes overestimating can cause buffer underruns and
underestimating causes more writes than necessary.
It also properly accounts for the number of channels,
which I had overlooked.
2020-06-17 03:34:46 +02:00
sniperrifle2004
a68dfa0287 On stop write any chunk(s) left in the period buffer
That should prevent a possible sudden stop
2020-06-14 07:22:23 +02:00
sniperrifle2004
cbe3c98fa1 Clear buffer when the sink is stopped 2020-06-14 06:15:53 +02:00
sniperrifle2004
64081a12bb Introduce a buffer for a full period
Writing to the pcm more often than necessary is
just a waste of resources and depending
on the pcm it can have quite an impact
on performance. The pcm expects full periods
anyway.
2020-06-14 06:15:45 +02:00
sniperrifle2004
aaef07e819 Introduce an appropriate period for the desired buffer 2020-06-14 06:15:25 +02:00
Sean McNamara
5d57ac773b Fix PR feedback 2020-05-10 16:26:01 -04:00
Sean McNamara
0e6beaf8c7 Merge https://github.com/librespot-org/librespot into gst1.0-2020 2020-05-07 13:12:39 -04:00
kaymes
9fe82ef781
Enable pulseaudio device names (#450)
Fixes #207
2020-04-25 13:27:21 +02:00
Sean McNamara
e7093cb0bc gstreamer-backend: rustfmt. 2020-04-06 23:54:05 -04:00
Sean McNamara
1e9a52bd6e Fix auto disposal of pipeline that needs to stay in struct 2020-04-06 23:34:20 -04:00
Sean McNamara
f192bd1079 gstreamer-1.0 backend: Version updates and squelch warnings 2020-04-06 23:29:29 -04:00
Sean McNamara
ac0df7e11f Merge https://github.com/librespot-org/librespot into gst1.0-2020 2020-02-14 19:01:42 -05:00