Commit graph

43 commits

Author SHA1 Message Date
Roderick van Domburg
c8971dce63
Fix Alsa softvol linear mapping (#950)
Use `--volume-range` overrides
2022-01-27 18:39:28 +01:00
Jason Gray
03e71f6e0a
simplify get_factor (#942)
Simplify `get_factor`
2022-01-27 07:40:59 +01:00
Jason Gray
ceebb374f0
Remove unsafe code (#940)
Remove unsafe code
2022-01-23 19:02:04 +01:00
Roderick van Domburg
72af0d2014
New dynamic limiter for very wide dynamic ranges (#935)
New dynamic limiter for very wide dynamic ranges
2022-01-14 23:31:29 +01:00
Roderick van Domburg
1e54913523
Fix --device argument to various backends (#938)
Fix `--device` argument to various backends
2022-01-14 08:20:29 +01:00
Guillaume Desmottes
f09be4850e Sink: pass ownership of the packet on write()
Prevent a copy if the implementation needs to keep the data around.
2021-12-31 13:46:35 +01:00
JasonLG1979
305f80bdfd Fix auto fallback for --alsa-mixer-device and --alsa-mixer-index
As mentioned in https://github.com/librespot-org/librespot/issues/898#issuecomment-986528998
2021-12-21 19:29:35 -06:00
Jason Gray
e66cc5508c
parse environment variables (#886)
Make librespot able to parse environment variables for options and flags.

To avoid name collisions environment variables must be prepended with `LIBRESPOT_` so option/flag `foo-bar` becomes `LIBRESPOT_FOO_BAR`.

Verbose logging mode (`-v`, `--verbose`) logs all parsed environment variables and command line arguments (credentials are redacted).
2021-12-01 21:29:58 +01:00
Tom Vincent
bbd575ed23
Harden systemd service, update restart policy (#888) 2021-11-26 19:49:50 +01:00
JasonLG1979
c006a23644 Improve --device ? functionality for the alsa backend
This makes `--device ?` only show compatible devices (ones that support 2 ch 44.1 Interleaved) and it shows what `librespot` format(s) they support.

This should be more useful to users as the info maps directly to `librespot`'s `--device` and `--format` options.
2021-11-20 13:51:24 -06:00
JasonLG1979
0e9fdbe6b4 Refactor main.rs
* Don't panic when parsing options. Instead list valid values and exit.
* Get rid of needless .expect in playback/src/audio_backend/mod.rs.
* Enforce reasonable ranges for option values (breaking).
* Don't evaluate options that would otherwise have no effect.
* Add pub const MIXERS to mixer/mod.rs very similar to the audio_backend's implementation. (non-breaking though)
* Use different option descriptions and error messages based on what backends are enabled at build time.
* Add a -q, --quiet option that changed the logging level to warn.
* Add a short name for every flag and option.
* Note removed options.
* Other misc cleanups.
2021-11-17 15:31:16 -06:00
JasonLG1979
24e4d2b636 Prevent librespot from becoming a zombie
Prevent hang when discovery is disabled and there are no credentials or when bad credentials are given.
2021-10-28 09:13:46 -05:00
JasonLG1979
9152ca8159 Update changelog 2021-10-26 22:20:24 -05:00
Roderick van Domburg
9d19841c0f
Prepare for 0.3.1 release 2021-10-24 20:07:11 +02:00
Roderick van Domburg
4c89a721ee
Improve dithering CPU usage (#866) 2021-10-19 22:33:04 +02:00
Nick Steel
3b51a5dc23 Include build profile in the displayed version information
Example output from -V for a debug build is:
librespot 0.3.0 832889b (Built on 2021-10-14, Build ID: ANJrycbG, Profile: debug)
2021-10-14 14:38:09 +01:00
Roderick van Domburg
d99581aeb7
Tag 0.3.0 and document #859 2021-10-13 20:37:46 +02:00
Roderick van Domburg
289b4f9bcc
Fix behavior after last track of an album/playlist
* When autoplay is disabled, then loop back to the first track
   instead of 10 tracks back. Continue or stop playing depending
   on the state of the repeat button.

 * When autoplay is enabled, then extend the playlist *after* the
   last track. #844 broke this such that the last track of an album
   or playlist was never played.

Fixes: #434
2021-10-05 22:08:26 +02:00
Roderick van Domburg
095536f100
Prepare for 0.3.0 release 2021-10-04 21:44:03 +02:00
Jason Gray
89577d1fc1
Improve player (#823)
* Improve error handling
* Harmonize `Seek`: Make the decoders and player use the same math for converting between samples and milliseconds
* Reduce duplicate calls: Make decoder seek in PCM, not ms
* Simplify decoder errors with `thiserror`
2021-09-20 19:29:12 +02:00
Roderick van Domburg
949ca4fded
Add and default to "auto" normalisation type (#844) 2021-09-20 19:22:02 +02:00
Matias
7401d6a96e
Don't panic on local files (#846)
Skip tracks whose Spotify ID can't be found
2021-09-20 19:20:44 +02:00
Roderick van Domburg
fe644bc0d7
Update default normalisation threshold 2021-09-02 22:04:30 +02:00
Roderick van Domburg
c67e268dc8
Improve Alsa mixer command-line options 2021-08-26 22:35:45 +02:00
Jason Gray
9ff33980d6
Better errors in PulseAudio backend (#801)
* More meaningful error messages
* Use F32 if a user requests F64 (F64 is not supported by PulseAudio)
* Move all code that can fail to `start` where errors can be returned to prevent panics
* Use drain in `stop`
2021-06-30 21:14:23 +02:00
Reinier Balt
751ccf63bb
Make convert and decoder public (#814) 2021-06-30 09:54:02 +02:00
JasonLG1979
586e864427 Update change log 2021-06-18 17:33:49 -05:00
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
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
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
d5070a107a
Merge pull request #761 from librespot-org/Johannesd3-fix-changelog
Fix changelog
2021-05-26 22:31:12 +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
3a2455d686
Merge branch 'dev' into log-volume-ctrl-optimisations 2021-05-26 20:50:42 +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
ceab363429
Update changelog 2021-05-19 21:11:01 +02:00
Roderick van Domburg
a4ad6d4aa8
Fix default normalisation threshold [#745] 2021-05-16 22:30:35 +02:00
johannesd3
555274b5af
Move decoder to playback crate 2021-05-11 20:36:53 +02:00
johannesd3
e7b3050a90
Add changelog 2021-05-08 22:04:02 +02:00