Commit graph

1493 commits

Author SHA1 Message Date
Jason Gray
4c77854ffe
Better errors alsa backend (#797)
Better error handling in Alsa backend

* More consistent error messages
* Bail on fatal errors in player
* Capture and log the original error as a warning when trying to write to PCM before trying to recover
2021-06-18 20:25:09 +02:00
JasonLG1979
0bece0d867 Fix pipe backend
* Move all code that can fail to `start` where errors can be returned to prevent a panic!
* Replace unwrap
2021-06-18 04:54:20 -05:00
Hugo Osvaldo Barrera
51a697201b
Include a systemd.service file to run as a user (#800)
Include a systemd.service file to run as a user

This new `systemd.service` file allows running and controlling the service as
an unpriviledged user (generally, as part of a user session).
2021-06-18 11:40:44 +02:00
Roderick van Domburg
6244515879
Resolve dealer and spclient access points (#795) 2021-06-10 22:24:40 +02:00
Roderick van Domburg
b0a94f901d
Merge pull request #789 from JasonLG1979/alsa_backend_fix
Improve ALSA buffer size
2021-06-09 20:51:15 +02:00
Roderick van Domburg
c30959212a
Update CHANGELOG.md 2021-06-09 20:50:24 +02:00
JasonLG1979
4af095e741 Improve ALSA buffer size
* Go back to 4 periods at 125ms.
* Deal strictly in period time and periods to set ALSA buffer.
* Rename `buffer` to `period_buffer`.
* Add comments and change some other var names to add clarity.
* Let ALSA calculate the size of `period_buffer`.
2021-06-08 23:44:20 -05:00
Roderick van Domburg
5764f1f1a2
Merge pull request #783 from roderickvd/remove-fallback-accesspoint
Remove feature gate around `apresolve`

See: hrkfdn/ncspot#535
2021-06-05 23:53:31 +02:00
Roderick van Domburg
7c975f8ed0
Remove feature gate around apresolve 2021-06-01 20:43:23 +02:00
Roderick van Domburg
33c07f0e2b
Merge pull request #785 from roderickvd/revert-round-half-to-even
Revert `math::round_half_to_even`
2021-06-01 08:17:28 +02:00
Roderick van Domburg
d4f466ef58
Revert math::round_half_to_even
This caused quite a bump in CPU usage, which be acceptable if this
actually improved sound quality. However, it turns out that this
function only has one decimal precision, i.e. it would consider
all values from `0.50..0.60` (exclusive) as `0.5` which is in
error for our purposes.
2021-05-31 23:35:48 +02:00
Roderick van Domburg
ad19b69bfb
Various code improvements (#777)
* Remove deprecated use of std::u16::MAX
* Use `FromStr` for fallible `&str` conversions
* DRY up strings into constants
* Change `as_ref().map()` into `as_deref()`
* Use `Duration` for time constants and functions
* Optimize `Vec` with response times
* Move comments for `rustdoc` to parse
2021-05-31 22:32:39 +02:00
Roderick van Domburg
bae1834988
Fix output on big-endian systems (#778) 2021-05-30 20:57:46 +02:00
Roderick van Domburg
fe2d5ca7c6
Store and process samples in 64 bit (#773) 2021-05-30 20:09:39 +02:00
Roderick van Domburg
8062bd2518
Improve sample rounding and clean up noise shaping leftovers (#771) 2021-05-29 22:53:19 +02:00
johannesd3
a2fde0a1d6 Run cargo update 2021-05-28 19:55:57 +02:00
Johannesd3
d1cdc9e236
Merge pull request #766 from Johannesd3/fix-integer-overflow
Fix integer overflow in spotify_id
2021-05-28 09:33:00 +02:00
Roderick van Domburg
a7255c32a7
Merge pull request #772 from roderickvd/fix-merging-leftovers
Fix leftovers from merging diverging branches
2021-05-28 00:18:34 +02:00
Roderick van Domburg
19f0555e7c
Fix leftovers from merging diverging branches 2021-05-27 23:44:45 +02:00
johannesd3
3be50fd90f
Corrected documentation 2021-05-27 17:20:49 +02:00
Johannesd3
7ed35396f8
Mostly cosmetic changes in dealer (#762)
* Add missing timeout on reconnect

* Cosmetic changes
2021-05-27 15:33:29 +02:00
johannesd3
049bcf616f
Fix integer overflow in spotify_id 2021-05-27 15:29:36 +02:00
Roderick van Domburg
5d43b7dc31
Merge pull request #764 from roderickvd/print-normalisation-pregain
Print normalisation pregain in verbose mode
2021-05-26 23:34:02 +02:00
Roderick van Domburg
f2d31b73bb
Print normalisation pregain in verbose mode 2021-05-26 23:14:24 +02:00
Roderick van Domburg
d5070a107a
Merge pull request #761 from librespot-org/Johannesd3-fix-changelog
Fix changelog
2021-05-26 22:31:12 +02:00
Roderick van Domburg
87743394d9
Improve getopts and stderr message consistency in main (#757) 2021-05-26 22:30:32 +02:00
Roderick van Domburg
8abc0becaf
Print normalisation setup once and add units (#759) 2021-05-26 22:03:52 +02:00
johannesd3
14c1779056
Adjust arg types of Credentials::with_blob
... to avoid redundant utf-8 checking
2021-05-26 21:52:36 +02:00
Roderick van Domburg
11dfedea3b
Remove with-vorbis and with-tremor features (#750) 2021-05-26 21:43:20 +02:00
Roderick van Domburg
bb3dd64c87
Implement dithering (#694)
Dithering lowers digital-to-analog conversion ("requantization") error, linearizing output, lowering distortion and replacing it with a constant, fixed noise level, which is more pleasant to the ear than the distortion.

Guidance:

- On S24, S24_3 and S24, the default is to use triangular dithering. Depending on personal preference you may use Gaussian dithering instead; it's not as good objectively, but it may be preferred subjectively if you are looking for a more "analog" sound akin to tape hiss.

- Advanced users who know that they have a DAC without noise shaping have a third option: high-passed dithering, which is like triangular dithering except that it moves dithering noise up in frequency where it is less audible. Note: 99% of DACs are of delta-sigma design with noise shaping, so unless you have a multibit / R2R DAC, or otherwise know what you are doing, this is not for you.

- Don't dither or shape noise on S32 or F32. On F32 it's not supported anyway (there are no integer conversions and so no rounding errors) and on S32 the noise level is so far down that it is simply inaudible even after volume normalisation and control.

New command line option:

--dither DITHER Specify the dither algorithm to use - [none, gpdf,
                tpdf, tpdf_hp]. Defaults to 'tpdf' for formats S16
                S24, S24_3 and 'none' for other formats.

Notes:

This PR also features some opportunistic improvements. Worthy of mention are:
- matching reference Vorbis sample conversion techniques for lower noise
- a cleanup of the convert API
2021-05-26 21:19:17 +02:00
Johannesd3
db71f6d87e
Fix changelog 2021-05-26 21:03:06 +02:00
Roderick van Domburg
7f113b37c3
Merge pull request #685 from roderickvd/log-volume-ctrl-optimisations
Optimize volume control logic
2021-05-26 20:51:27 +02:00
Roderick van Domburg
3a2455d686
Merge branch 'dev' into log-volume-ctrl-optimisations 2021-05-26 20:50:42 +02:00
Roderick van Domburg
d8ec98015c
Merge pull request #673 from Johannesd3/discovery-crate
Create separate discovery crate
2021-05-26 20:21:43 +02:00
johannesd3
1ade02b7ad
Add basic websocket support 2021-05-26 16:51:13 +02:00
Roderick van Domburg
08ba3ad7d7
Merge pull request #758 from roderickvd/bump-rodio-and-jack-crates
Bump jack and Rodio crates
2021-05-25 23:01:33 +02:00
Roderick van Domburg
a590b778de
Bump jack and Rodio crates 2021-05-25 22:35:35 +02:00
Roderick van Domburg
9efd886e91
Describe new mixer-card getopts behavior
Also remove some other getopts and string changes to a separate PR.
2021-05-25 20:48:20 +02:00
Johannesd3
28dd842e05 Fix bug in MercurySender 2021-05-24 16:31:34 +02:00
Roderick van Domburg
eca505c387
Improve volume controls
This is a squashed commit featuring the following:

Connect:
- Synchronize player volume with mixer volume on playback
- Fix step size on volume up/down events
- Remove no-op mixer started/stopped logic

Playback:
- Move from `connect` to `playback` crate
- Make cubic volume control available to all mixers with `--volume-ctrl cubic`
- Normalize volumes to `[0.0..1.0]` instead of `[0..65535]` for greater precision and performance (breaking)
- Add `--volume-range` option to set dB range and control `log` and `cubic` volume control curves
- Fix `log` and `cubic` volume controls to be mute at zero volume

Alsa mixer:
- Complete rewrite (breaking)
- Query card dB range for the `log` volume control unless specified otherwise
- Query dB range from Alsa softvol (previously only from hardware)
- Use `--device` name for `--mixer-card` unless specified otherwise
- Fix consistency for `cubic` between cards that report minimum volume as mute, and cards that report some dB value
- Fix `--volume-ctrl {linear|log}` to work as expected
- Removed `--mixer-linear-volume` option; use `--volume-ctrl linear` instead
2021-05-24 15:53:32 +02:00
Johannesd3
4448ce0c09
Set correct libraryVersion 2021-05-24 11:54:01 +02:00
johannesd3
ceab363429
Update changelog 2021-05-19 21:11:01 +02:00
johannesd3
9b6ba49026
Add "discovery" compat layer to "connect" 2021-05-19 21:09:38 +02:00
johannesd3
c49e1320d4
Update workflow 2021-05-19 21:09:38 +02:00
johannesd3
16de6a7f68
Improve api of discovery crate's builder 2021-05-19 21:05:20 +02:00
johannesd3
a7f9e0a20b
Add an error type to librespot_discovery 2021-05-19 21:05:20 +02:00
johannesd3
1ec5dd21fa
Add discovery example 2021-05-19 21:05:20 +02:00
Johannesd3
ebea5397b9
Add librespot-discovery crate 2021-05-19 21:05:19 +02:00
johannesd3
68818758a2
Add timeout to test 2021-05-18 15:17:30 +02:00
Sasha Hilton
79f75b9119
Merge pull request #749 from roderickvd/fix-default-threshold 2021-05-18 04:40:46 +01:00