mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +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>) {
|
||||
let volume = volume as i32 * 100 / 0xFFFF;
|
||||
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 {
|
||||
|
|
|
@ -36,7 +36,7 @@ fn main() {
|
|||
let session = core.run(Session::connect(session_config, credentials, None, handle))
|
||||
.unwrap();
|
||||
|
||||
let (player, _)= Player::new(player_config, session.clone(), None, move || (backend)(None));
|
||||
let (player, _) = Player::new(player_config, session.clone(), None, move || (backend)(None));
|
||||
|
||||
println!("Playing...");
|
||||
core.run(player.load(track, true, 0)).unwrap();
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
use super::{Open, Sink};
|
||||
use jack::prelude::{client_options, AsyncClient, AudioOutPort, AudioOutSpec, Client, JackControl, Port,
|
||||
ProcessHandler, ProcessScope};
|
||||
use jack::prelude::{
|
||||
client_options, AsyncClient, AudioOutPort, AudioOutSpec, Client, JackControl, Port, ProcessHandler,
|
||||
ProcessScope,
|
||||
};
|
||||
use std::io;
|
||||
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 {
|
||||
let mut data = String::new();
|
||||
let mut file = File::open(filepath).expect("Could not open persistent volume");
|
||||
file.read_to_string(&mut data).expect("Could not read persistent volume");
|
||||
let volume = data.trim().parse::<i32>().expect("Persistent volume must be an integer");
|
||||
file.read_to_string(&mut data)
|
||||
.expect("Could not read persistent volume");
|
||||
let volume = data.trim()
|
||||
.parse::<i32>()
|
||||
.expect("Persistent volume must be an integer");
|
||||
if volume < 0 || volume > 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)",
|
||||
"VOLUME",
|
||||
)
|
||||
.optopt(
|
||||
"",
|
||||
"persist-volume",
|
||||
"Persist software volume to file",
|
||||
"FILE"
|
||||
)
|
||||
.optopt("", "persist-volume", "Persist software volume to file", "FILE")
|
||||
.optopt(
|
||||
"",
|
||||
"zeroconf-port",
|
||||
|
|
Loading…
Reference in a new issue