- 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
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
* 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