|
|
@ -35,7 +35,7 @@ pub enum AudioFormat { |
|
|
|
/// Each member is made up of 2 values, the first is for the "left" channel, while the second is for the "right" channel.
|
|
|
|
/// Each member is made up of 2 values, the first is for the "left" channel, while the second is for the "right" channel.
|
|
|
|
#[derive(Copy, Clone, Debug)] |
|
|
|
#[derive(Copy, Clone, Debug)] |
|
|
|
pub struct AudioMix { |
|
|
|
pub struct AudioMix { |
|
|
|
raw: [f32;12] |
|
|
|
raw: [f32; 12], |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#[derive(Copy, Clone, Debug)] |
|
|
|
#[derive(Copy, Clone, Debug)] |
|
|
@ -317,9 +317,7 @@ impl AudioFormat { |
|
|
|
impl AudioMix { |
|
|
|
impl AudioMix { |
|
|
|
/// Creates a new [AudioMix] with all volumes set to 0.
|
|
|
|
/// Creates a new [AudioMix] with all volumes set to 0.
|
|
|
|
pub fn zeroed() -> Self { |
|
|
|
pub fn zeroed() -> Self { |
|
|
|
Self { |
|
|
|
Self { raw: [0.; 12] } |
|
|
|
raw: [0.;12], |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Returns a reference to the raw data.
|
|
|
|
/// Returns a reference to the raw data.
|
|
|
@ -350,7 +348,7 @@ impl AudioMix { |
|
|
|
|
|
|
|
|
|
|
|
let index = 4 + id * 4; |
|
|
|
let index = 4 + id * 4; |
|
|
|
|
|
|
|
|
|
|
|
&self.raw[index..index+2] |
|
|
|
&self.raw[index..index + 2] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Returns a reference to the "back" volume mix (left and right channel) for the specified auxiliary output device.
|
|
|
|
/// Returns a reference to the "back" volume mix (left and right channel) for the specified auxiliary output device.
|
|
|
@ -361,7 +359,7 @@ impl AudioMix { |
|
|
|
|
|
|
|
|
|
|
|
let index = 6 + id * 4; |
|
|
|
let index = 6 + id * 4; |
|
|
|
|
|
|
|
|
|
|
|
&self.raw[index..index+2] |
|
|
|
&self.raw[index..index + 2] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Returns a mutable reference to the "front" volume mix (left and right channel).
|
|
|
|
/// Returns a mutable reference to the "front" volume mix (left and right channel).
|
|
|
@ -382,7 +380,7 @@ impl AudioMix { |
|
|
|
|
|
|
|
|
|
|
|
let index = 4 + id * 4; |
|
|
|
let index = 4 + id * 4; |
|
|
|
|
|
|
|
|
|
|
|
&mut self.raw[index..index+2] |
|
|
|
&mut self.raw[index..index + 2] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Returns a mutable reference to the "back" volume mix (left and right channel) for the specified auxiliary output device.
|
|
|
|
/// Returns a mutable reference to the "back" volume mix (left and right channel) for the specified auxiliary output device.
|
|
|
@ -393,7 +391,7 @@ impl AudioMix { |
|
|
|
|
|
|
|
|
|
|
|
let index = 6 + id * 4; |
|
|
|
let index = 6 + id * 4; |
|
|
|
|
|
|
|
|
|
|
|
&mut self.raw[index..index+2] |
|
|
|
&mut self.raw[index..index + 2] |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -409,9 +407,7 @@ impl Default for AudioMix { |
|
|
|
|
|
|
|
|
|
|
|
impl From<[f32; 12]> for AudioMix { |
|
|
|
impl From<[f32; 12]> for AudioMix { |
|
|
|
fn from(value: [f32; 12]) -> Self { |
|
|
|
fn from(value: [f32; 12]) -> Self { |
|
|
|
Self { |
|
|
|
Self { raw: value } |
|
|
|
raw: value, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|