use ears::listener;
#[derive(Clone)]
pub struct AudioContext;
impl AudioContext {
pub fn set_position(&mut self, x: f32, y: f32, z: f32) {
listener::set_position([x, y, z]);
}
pub fn set_orientation(&mut self, fw_x: f32, fw_y: f32, fw_z: f32, up_x: f32, up_y: f32, up_z: f32) {
listener::set_orientation([fw_x, fw_y, fw_z], [up_x, up_y, up_z]);
}
pub fn set_volume(&mut self, volume: f32) {
listener::set_volume(volume);
}
pub fn position(&self) -> (f32, f32, f32) {
let pos = listener::get_position();
(pos[0], pos[1], pos[2])
}
pub fn orientation(&self) -> (f32, f32, f32, f32, f32, f32) {
let (fw, up) = listener::get_orientation();
(fw[0], fw[1], fw[2], up[0], up[1], up[2])
}
pub fn volume(&self) -> f32 {
listener::get_volume()
}
}