Commit graph

171 commits

Author SHA1 Message Date
Roderick van Domburg f3bb679ab1
Rid of the last remaining clippy warnings 2021-12-08 21:00:42 +01:00
Roderick van Domburg 9b2ca1442e
Move FileId out of SpotifyId 2021-12-08 19:53:45 +01:00
Roderick van Domburg f03a7e95c1
Merge remote-tracking branch 'librespot-org/dev' into new-api-wip 2021-12-08 19:11:53 +01:00
Roderick van Domburg 0e6b1ba9dc
Update version numbers to 0.3.1 2021-10-24 20:12:33 +02:00
Sasha Hilton 6a3377402a Update version numbers to 0.3.0 2021-10-13 15:10:18 +01:00
Roderick van Domburg 949ca4fded
Add and default to "auto" normalisation type (#844) 2021-09-20 19:22:02 +02:00
Roderick van Domburg b016b69772
Fix clippy warnings 2021-09-01 21:25:32 +02:00
Roderick van Domburg 7cd1b7a26a
Merge branch 'dev' into new-api-client 2021-06-26 00:14:20 +02:00
Roderick van Domburg 0703630041
Use PacketType instead of hex identifiers 2021-06-22 23:57:38 +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
johannesd3 555274b5af
Move decoder to playback crate 2021-05-11 20:36:53 +02:00
Sasha Hilton 2ef3928691 Update version numbers to 0.2.0 2021-05-04 13:05:13 +01:00
johannesd3 4925adb4f1 Fix broken streaming mode 2021-04-21 11:26:49 +02:00
johannesd3 b4f9ae31e2 Fix clippy warnings 2021-04-10 14:06:41 +02:00
johannesd3 26c127c2ec Merge branch 'dev' into tokio_migration 2021-04-10 12:59:47 +02:00
johannesd3 ff499825e0 Add missing feature flag to tokio 2021-04-10 12:50:30 +02:00
johannesd3 b7350b71da Restore previous feature flags
Some of the feature flags librespot uses are not really additive but
rather mutual exclusive. A previous attempt to improve the situation
had other drawbacks, so it's better to postpone a decision and restore
the old behaviour.
2021-04-10 12:50:30 +02:00
Roderick van Domburg e20b96c598 Merge remote-tracking branch 'upstream/dev' into hi-res-volume-control 2021-04-09 20:06:20 +02:00
Roderick van Domburg d0ea9631d2 Optimize requantizer to work in f32, then round 2021-04-09 19:33:28 +02:00
johannesd3 7c3d89112d Fix clippy warnings 2021-04-09 10:45:43 +02:00
johannesd3 f5274f5ada Merge branch 'dev' into tokio_migration 2021-04-09 10:39:06 +02:00
Roderick van Domburg 78bc621ebb Move SamplesConverter into convert.rs 2021-04-05 21:30:40 +02:00
Roderick van Domburg a200b25916 Fix formatting 2021-03-27 21:44:01 +01:00
Roderick van Domburg cdbce21e71 Make S16 to F32 sample conversion less magical 2021-03-27 21:42:10 +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
philippe44 86dbaa8ed5
true/false don't need to be explicit
Co-authored-by: Johannesd3 <51954457+Johannesd3@users.noreply.github.com>
2021-03-20 12:11:49 -07: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 770ea15498 Add support for S24 and S24_3 output formats 2021-03-17 00:00:27 +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 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
johannesd3 ca255c17f0 Split file fetch.rs 2021-03-11 18:09:51 +01:00
johannesd3 e71a004e93 Refactor AudioFileFetch using async/await
Previously, polling `AudioFileFetch` consisted of three parts: Handling
stream loader commands, handling received data, and triggering preloading
in stream mode when the number of open requests is sufficiently small. The
first steps use channels which are polled, and if something's available,
it's handled. The third step is executed on every call of `poll`.

The first two could easily be refactored using a `tokio::select!`-loop.
Therefore, counting the number of open requests was also refactored to fit
into this scheme. They were previously counted using a shared
`AtomicUsize`. Now, the number of open requests is stored exclusively in
`AudioFileFetch`, increased on starting a request, and decreased by an
oneshot channel that is fired when a request is finished.

This allows us to `select` that channel in the loop too, and since
loading ahead makes only sense if the number of open requests decreases,
the third step is only executed in this case.

`AudioFileFetch` does not implement `Future` anymore, but is rather used
as helper struct in an async fn `audio_file_fetch`.
2021-03-11 18:08:00 +01:00
Evan Cameron 6a33eb4efa
minor cleanup 2021-02-28 21:54:19 -05:00
Philippe G 8dc1e80633 separated stream for each seek 2021-02-27 14:59:53 -08:00
johannesd3 f9c0e26f6d Simplify code 2021-02-23 22:22:52 +01:00
johannesd3 5c42d2e879 Clean up dependencies in librespot-audio
* Remove unused deps
* Use futures-util instead of futures
* Replace futures channels by tokio channels
* Remove unnecessary pin_project
* Reordered "use" statements
2021-02-23 22:22:52 +01:00
johannesd3 b83976a8ec Remove "extern crate"s from librespot-audio 2021-02-23 22:22:52 +01:00
johannesd3 746e6c863e Put lewton behind feature flag 2021-02-23 22:22:52 +01:00
johannesd3 678d1777fd Merge branch 'dev' into tokio_migration 2021-02-23 22:22:49 +01:00
Sasha Hilton e8204c970e
Merge pull request #569 from philippe44/passthrough-v3
Allow pipeline writer to spit out Ogg directly, including when seeking
2021-02-23 00:16:01 +00:00
Philippe G 34bc286d9b ogg passthrough
rename
2021-02-22 13:45:53 -08:00
Sasha Hilton d8c1b491c4 Merge branch 'master' into dev 2021-02-22 00:57:45 +00:00
Sasha Hilton b7c3609c7b Update version numbers to 0.1.6 2021-02-22 00:37:28 +00:00
Sasha Hilton 4e1c24d98d
Merge pull request #602 from Johannesd3/bumb_crypto_crates
Bump crypto crates
2021-02-21 23:29:00 +00:00
Sasha Hilton 7f705ed148 Merge branch 'master' into dev 2021-02-20 23:31:04 +00:00
Sasha Hilton 2c110ca256 Update version numbers to 0.1.5 2021-02-20 23:05:56 +00:00
Sasha Hilton a173fa7cc5 Remove depreciated error description method 2021-02-20 21:55:12 +00:00
Érico Nogueira Rolim 7662bc5064 librespot-audio: update librespot-tremor.
This picks up a fix for librespot-tremor when building with Rust 1.48.
2021-02-20 21:54:14 +00:00
johannesd3 34733baa75 Bump crypto crates 2021-02-13 19:10:57 +01:00
johannesd3 872fab62d8 Merge branch 'dev' into tokio_migration 2021-02-10 21:51:33 +01:00
johannesd3 d3495cfed4 Re-add support for Rust 1.40 2021-02-09 09:14:32 +01:00
johannesd3 3446864838 Handle corrupt cache files (#591) 2021-02-02 02:18:58 +01:00
Sasha Hilton 4990351dba
Merge pull request #585 from ericonr/patch-1 2021-02-02 01:10:27 +00:00
Sasha Hilton a09845ee7d
Merge pull request #582 from Johannesd3/refactor_cache_remove_volume 2021-02-02 01:08:07 +00:00
Sasha Hilton ccde0c8dcb Merge branch 'dev' into patch-1
Merge latest changes from dev
2021-01-31 01:37:11 +00:00
Sasha Hilton 9ad68dfb76 Remove depreciated error description method 2021-01-31 01:36:10 +00:00
johannesd3 78614c9d7a Bump lewton to 0.10 2021-01-29 11:25:09 +01:00
Érico Nogueira Rolim d010cb7999
librespot-audio: update librespot-tremor.
This picks up a fix for librespot-tremor when building with Rust 1.48.
2021-01-28 12:07:33 -03:00
johannesd3 c97fdeb3b4 Replaced .fold(0, add) by .sum() 2021-01-25 20:56:22 +01:00
johannesd3 fa5c9f7d11 Made locations in cache optional
The locations of credentials, volume and audio are now stored
in three separate Optional<PathBuf>s.
Removed the clearing of the cache if an error occurs. This might
be added again later.
2021-01-25 10:48:14 +01:00
johannesd3 14a004f84c Refactored Cache
Proper error handling, and moving the conversion between
{ credentials, volume } and file into the cache module
2021-01-25 10:47:42 +01:00
johannesd3 6c9d8c8d83 Replace pin_project and updated dependencies 2021-01-25 09:04:33 +01:00
johannesd3 90905b81bb Improved RangeSet implementation 2021-01-25 09:04:33 +01:00
johannesd3 80d384e001 Migrated audio crate to futures 0.3 2021-01-25 09:04:33 +01:00
Lyndon Brown 0460429380 bump num-bigint dependency (v0.2 to v0.3)
compiles fine after version change; version changes seem to be very minimal.
2020-12-14 11:53:54 +00:00
Sasha Hilton 45f4276d68 Update version numbers to 0.1.3 2020-07-29 16:23:41 +01:00
Sasha Hilton 4a21b5cbeb Fix depreciation warnings
Fixes error description depreciation warnings and removes unnecessary parentheses
2020-07-24 03:32:36 +01:00
Sasha Hilton 68949da7c2 Update version numbers to 0.1.2 2020-07-22 16:53:52 +01:00
Sasha Hilton 258db6ba42 Downgrade vorbis lib due to upstream issue 2020-07-22 16:23:44 +01:00
Konstantin Seiler 5784b4652c Prepare for gapless play.
- change communication between player and spirc to use player events channel.
- enhance player events channel
- have spirc send loading messages to Spotify
- enable preloading of tracks in the player
2020-02-01 08:41:11 +11:00
Sasha Hilton 6daa2acd0a Update version numbers to 0.1.1 2020-01-30 02:39:41 +01:00
marcelbuesing c9147d31ab
Turn child crates into rust 2018 edition 2020-01-17 20:54:05 +01:00
marcelbuesing 38d82f2dc2
Rerun rustfmt on full codebase 2020-01-17 18:47:30 +01:00
ashthespy d26590afc5
Update to Rust 2018
- Fix deprecated Error::cause warnings and missing dyn
- Reset max_width
- Add rustfmt to Travis
- Run rustfmt on full codebase
 with `cargo fmt --all`
- Add rustfmt to Travis
- Complete migration to edition 2018
- Replace try! shorthand
- Use explicit `dyn Trait`
2020-01-17 18:11:52 +01:00
Konstantin Seiler e550b7f729 rustfmt 2019-11-18 11:08:34 +11:00
Konstantin Seiler db0e4a0422 Limit number of prefetch requests. 2019-11-18 10:54:44 +11:00
Konstantin Seiler 5d8c9f8860 Hide waiting for download message during seek. 2019-11-11 19:00:19 +11:00
Konstantin Seiler e4134806df Remove debug messages. 2019-11-11 18:43:41 +11:00
Konstantin Seiler d2d6df0e24 Run cargo fmt for my code. 2019-11-11 18:22:41 +11:00
Konstantin Seiler e75021b213 Merge remote-tracking branch 'origin/dev' into dynamic-blocks-kdev 2019-11-08 09:23:30 +11:00
Konstantin Seiler c4e0f15eb3 Tune prefetch, squish bugs. 2019-11-08 08:58:17 +11:00
Konstantin Seiler 6422dcef78 Refine file downloading heuristics to use data rates and ping times everywhere. 2019-11-08 00:02:53 +11:00
Sasha Hilton e7177da3b1 Add librespot-core version number 2019-11-06 16:56:51 +01:00
Sasha Hilton 394320c7b7 Add description and license to Cargo.toml for each crate 2019-11-06 16:50:26 +01:00
Sasha Hilton 6093d8f299 Move to librespot-tremor for crates.io compatability. 2019-11-06 16:40:13 +01:00
Konstantin Seiler c50fc9885a Adapt code for the new bitrate selection via alternatives. 2019-11-06 08:16:01 +11:00
Konstantin Seiler 4a611d9af3 Fix pre-fetch heuristic. 2019-11-05 23:58:35 +11:00
Konstantin Seiler 393df6475e Set better log messages. 2019-11-05 22:58:00 +11:00
Konstantin Seiler c991974f82 Improve ping time measurements.
Don't measure response times if other requests are pending.
2019-11-02 17:19:31 +11:00
Konstantin Seiler af6e33bfa0 Remove commented line 2019-11-02 11:11:24 +11:00
Konstantin Seiler 9f3e3d09d9 Fix infinite loop bug 2019-11-02 11:04:46 +11:00
Konstantin Seiler 216bdc0f6f Fix typo 2019-11-02 10:00:08 +11:00
Konstantin Seiler 1fcacf78cd Merge branch 'dynamic-blocks' into comments 2019-11-02 09:22:35 +11:00
Konstantin Seiler 971b2a9b9f Fix compile issues after merge 2019-11-02 08:38:46 +11:00
Konstantin Seiler 6545674a63 Merge remote-tracking branch 'origin/master' into dynamic-blocks 2019-11-02 07:15:23 +11:00
Konstantin Seiler bf47ca7033 some debug messages 2019-11-02 06:48:18 +11:00
Konstantin Seiler 333fc5010c New file downloading mechanism 2019-11-02 06:46:28 +11:00
Nick Mavis c19375c5ca Fixed nightly conflict with 2019-09-16 15:00:09 -04:00