Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pulse-ffi/src/ffi_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ pub const PA_SAMPLE_MAX: c_int = 13;
pub const PA_SAMPLE_INVALID: c_int = -1;
pub type pa_sample_format_t = c_int;

pub const PA_VOLUME_MUTED: c_uint = 0;
pub const PA_VOLUME_NORM: c_uint = 0x10000;
pub const PA_VOLUME_MAX: c_uint = 0x7fffffff;


#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub struct Struct_pa_sample_spec {
Expand Down
4 changes: 2 additions & 2 deletions src/backend/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -757,8 +757,8 @@ impl<'ctx> StreamOps for PulseStream<'ctx> {
self.volume = volume;
} else {
let channels = stm.get_sample_spec().channels;
let vol = pulse::sw_volume_from_linear(f64::from(volume));
cvol.set(u32::from(channels), vol);
let vol = volume * (PA_VOLUME_NORM as f32);
cvol.set(u32::from(channels), vol as pa_volume_t);

let index = stm.get_index();

Expand Down