mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-28 17:21:52 +00:00
rustfmt changes
This commit is contained in:
parent
9cd9737613
commit
41480e7085
4 changed files with 13 additions and 12 deletions
|
@ -200,7 +200,8 @@ fn calc_logarithmic_volume(volume: u16) -> u16 {
|
||||||
fn write_volume(volume: u16, filepath: Option<String>) {
|
fn write_volume(volume: u16, filepath: Option<String>) {
|
||||||
let volume = volume as i32 * 100 / 0xFFFF;
|
let volume = volume as i32 * 100 / 0xFFFF;
|
||||||
let mut file = File::create(filepath.unwrap()).expect("Could not create persistent volume");
|
let mut file = File::create(filepath.unwrap()).expect("Could not create persistent volume");
|
||||||
file.write_all(volume.to_string().as_bytes()).expect("Could not write persistent volume");
|
file.write_all(volume.to_string().as_bytes())
|
||||||
|
.expect("Could not write persistent volume");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn volume_to_mixer(volume: u16, linear_volume: bool, persist_volume: Option<String>) -> u16 {
|
fn volume_to_mixer(volume: u16, linear_volume: bool, persist_volume: Option<String>) -> u16 {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
use super::{Open, Sink};
|
use super::{Open, Sink};
|
||||||
use jack::prelude::{client_options, AsyncClient, AudioOutPort, AudioOutSpec, Client, JackControl, Port,
|
use jack::prelude::{
|
||||||
ProcessHandler, ProcessScope};
|
client_options, AsyncClient, AudioOutPort, AudioOutSpec, Client, JackControl, Port, ProcessHandler,
|
||||||
|
ProcessScope,
|
||||||
|
};
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::sync::mpsc::{sync_channel, Receiver, SyncSender};
|
use std::sync::mpsc::{sync_channel, Receiver, SyncSender};
|
||||||
|
|
||||||
|
|
14
src/main.rs
14
src/main.rs
|
@ -92,8 +92,11 @@ fn list_backends() {
|
||||||
fn read_volume(filepath: String) -> i32 {
|
fn read_volume(filepath: String) -> i32 {
|
||||||
let mut data = String::new();
|
let mut data = String::new();
|
||||||
let mut file = File::open(filepath).expect("Could not open persistent volume");
|
let mut file = File::open(filepath).expect("Could not open persistent volume");
|
||||||
file.read_to_string(&mut data).expect("Could not read persistent volume");
|
file.read_to_string(&mut data)
|
||||||
let volume = data.trim().parse::<i32>().expect("Persistent volume must be an integer");
|
.expect("Could not read persistent volume");
|
||||||
|
let volume = data.trim()
|
||||||
|
.parse::<i32>()
|
||||||
|
.expect("Persistent volume must be an integer");
|
||||||
if volume < 0 || volume > 100 {
|
if volume < 0 || volume > 100 {
|
||||||
panic!("Initial volume must be in the range 0-100");
|
panic!("Initial volume must be in the range 0-100");
|
||||||
}
|
}
|
||||||
|
@ -163,12 +166,7 @@ fn setup(args: &[String]) -> Setup {
|
||||||
"Initial volume in %, once connected (must be from 0 to 100)",
|
"Initial volume in %, once connected (must be from 0 to 100)",
|
||||||
"VOLUME",
|
"VOLUME",
|
||||||
)
|
)
|
||||||
.optopt(
|
.optopt("", "persist-volume", "Persist software volume to file", "FILE")
|
||||||
"",
|
|
||||||
"persist-volume",
|
|
||||||
"Persist software volume to file",
|
|
||||||
"FILE"
|
|
||||||
)
|
|
||||||
.optopt(
|
.optopt(
|
||||||
"",
|
"",
|
||||||
"zeroconf-port",
|
"zeroconf-port",
|
||||||
|
|
Loading…
Reference in a new issue