Skip to content

Commit

Permalink
Warn instead of panicking on HRTF.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdm committed Jul 7, 2020
1 parent beb8ce0 commit cefe165
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions audio/panner_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ pub(crate) struct PannerNode {

impl PannerNode {
pub fn new(options: PannerNodeOptions, channel_info: ChannelInfo) -> Self {
if options.panning_model == PanningModel::HRTF {
log::warn!("HRTF requested but not supported")
}
Self {
channel_info,
panning_model: options.panning_model,
Expand Down Expand Up @@ -304,9 +307,7 @@ impl AudioNodeEngine for PannerNode {

let distance_gain_fn = self.distance_gain_fn();

if self.panning_model == PanningModel::HRTF {
unimplemented!()
} else {
if self.panning_model == PanningModel::EqualPower {
let (l, r) = block.data_mut().split_at_mut(FRAMES_PER_BLOCK.0 as usize);
for frame in 0..FRAMES_PER_BLOCK.0 {
let frame = Tick(frame);
Expand Down Expand Up @@ -393,7 +394,12 @@ impl AudioNodeEngine for PannerNode {
fn message_specific(&mut self, message: AudioNodeMessage, _sample_rate: f32) {
match message {
AudioNodeMessage::PannerNode(p) => match p {
PannerNodeMessage::SetPanningModel(p) => self.panning_model = p,
PannerNodeMessage::SetPanningModel(p) => {
if p == PanningModel::HRTF {
log::warn!("HRTF requested but not supported");
}
self.panning_model = p;
}
PannerNodeMessage::SetDistanceModel(d) => self.distance_model = d,
PannerNodeMessage::SetRefDistance(val) => self.ref_distance = val,
PannerNodeMessage::SetMaxDistance(val) => self.max_distance = val,
Expand Down

0 comments on commit cefe165

Please sign in to comment.