Replace unwrap with ok.

There are odd issues where OpenAL sources get into broken states, though they should either be destroyed or fixed in the next frame, depending on the specifics.

Should probably replace this with better logging, but for now it seems to work and not introduce new issues.
This commit is contained in:
Nolan Darilek 2021-09-16 11:53:53 -05:00
parent 387a100541
commit e12fc0fb10

View File

@ -254,21 +254,21 @@ fn sync_source_and_components(
source.set_relative(false); source.set_relative(false);
source source
.set_position([translation.x, translation.y, translation.z]) .set_position([translation.x, translation.y, translation.z])
.unwrap(); .ok();
} else { } else {
source.set_relative(true); source.set_relative(true);
source.set_position([0., 0., 0.]).unwrap(); source.set_position([0., 0., 0.]).ok();
} }
source.set_gain(gain).unwrap(); source.set_gain(gain).ok();
source.set_pitch(pitch).unwrap(); source.set_pitch(pitch).ok();
source.set_looping(looping); source.set_looping(looping);
source.set_reference_distance(reference_distance).unwrap(); source.set_reference_distance(reference_distance).ok();
source.set_max_distance(max_distance).unwrap(); source.set_max_distance(max_distance).ok();
source.set_rolloff_factor(rolloff_factor).unwrap(); source.set_rolloff_factor(rolloff_factor).ok();
source.set_radius(radius).unwrap(); source.set_radius(radius).ok();
if !bypass_global_effects { if !bypass_global_effects {
for (send, effect) in global_effects.iter_mut().enumerate() { for (send, effect) in global_effects.iter_mut().enumerate() {
source.set_aux_send(send as i32, effect).unwrap(); source.set_aux_send(send as i32, effect).ok();
} }
} }
} }
@ -469,10 +469,8 @@ fn listener_update(
error!("Error setting listener orientation: {:?}", e); error!("Error setting listener orientation: {:?}", e);
} }
} else { } else {
context.set_position([0., 0., 0.]).unwrap(); context.set_position([0., 0., 0.]).ok();
context context.set_orientation(([0., 0., 1.], [0., 1., 0.])).ok();
.set_orientation(([0., 0., 1.], [0., 1., 0.]))
.unwrap();
} }
} }
} }