free-librespot/core/src/lib.rs
Brice d40c0f50db Cache volume across restarts (#220)
* create Volume struct for use with Cache

* add "volume" file to Cache

* load cached volume on start, intial overrides cached overrides default

* amend volume_to_mixer function to cache the volume on every change

* pass cache to Spirc and SpircTask so volume_to_mixer has access

* rustfmt changes

* revert volume_to_mixer function and Spirc/SpircTask cache variable

* Volume implements Copy, pass by value instead of reference

* clamp volume to 100 if cached value exceeds limit

* convert Volume to u16 internally, use float and round to convert hex->dec

* convert initial_volume and ConnectConfig.volume to u16 as well

* add cache_volume function to SpircTask

* remove conversion to/from percentage on cached volume

* consolidate device.set_volume, mixer.set_volume, and caching

* streamline intial volume logic
2018-05-17 03:15:17 +02:00

55 lines
1.1 KiB
Rust

#![cfg_attr(feature = "cargo-clippy", allow(unused_io_amount))]
#[macro_use]
extern crate error_chain;
#[macro_use]
extern crate futures;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
#[macro_use]
extern crate serde_derive;
extern crate base64;
extern crate byteorder;
extern crate bytes;
extern crate crypto;
extern crate extprim;
extern crate httparse;
extern crate hyper;
extern crate hyper_proxy;
extern crate num_bigint;
extern crate num_integer;
extern crate num_traits;
extern crate protobuf;
extern crate rand;
extern crate rpassword;
extern crate serde;
extern crate serde_json;
extern crate shannon;
extern crate tokio_core;
extern crate tokio_io;
extern crate url;
extern crate uuid;
extern crate librespot_protocol as protocol;
#[macro_use]
mod component;
mod apresolve;
pub mod audio_key;
pub mod authentication;
pub mod cache;
pub mod channel;
pub mod config;
mod connection;
pub mod diffie_hellman;
pub mod keymaster;
pub mod mercury;
mod proxytunnel;
pub mod session;
pub mod spotify_id;
pub mod util;
pub mod version;
pub mod volume;