Update dependencies

This commit is contained in:
Kenny Levinsen
2019-08-29 01:30:36 +02:00
parent d41e338dfb
commit 2bad68a8cf
3 changed files with 74 additions and 72 deletions
+6 -5
View File
@@ -5,7 +5,6 @@ use crate::draw::{draw_bar, draw_box, Font, ROBOTO_REGULAR};
use crate::modules::module::{Input, ModuleImpl};
use std::cell::RefCell;
use std::cmp::{max, min};
use std::collections::HashMap;
use std::ops::Deref;
use std::rc::Rc;
@@ -23,7 +22,7 @@ use libpulse_binding::context::{
use libpulse_binding::mainloop::standard::IterateResult;
use libpulse_binding::mainloop::standard::Mainloop;
use libpulse_binding::proplist::{properties, Proplist};
use libpulse_binding::volume::{ChannelVolumes, VOLUME_MAX, VOLUME_NORM};
use libpulse_binding::volume::{ChannelVolumes, Volume, VOLUME_MAX, VOLUME_NORM};
struct PulseAudioConnection {
mainloop: Rc<RefCell<Mainloop>>,
@@ -68,7 +67,7 @@ impl PulseAudioConnection {
fn new() -> Result<Self, ::std::io::Error> {
let mut proplist = Proplist::new().unwrap();
proplist
.sets(properties::APPLICATION_NAME, "wldash")
.set_str(properties::APPLICATION_NAME, "wldash")
.unwrap();
let mainloop = Rc::new(RefCell::new(Mainloop::new().unwrap()));
@@ -405,8 +404,10 @@ impl PulseAudioSoundDevice {
// apply step to volumes
let step = (step * VOLUME_NORM.0 as f32).round() as i32;
for vol in volume.values.iter_mut() {
vol.0 = min(max(0, vol.0 as i32 + step) as u32, VOLUME_MAX.0);
if step > 0 {
volume.inc_clamp(Volume(step as u32), VOLUME_MAX);
} else {
volume.decrease(Volume(-step as u32));
}
let name = inner