Simplify SoundPlayer's hit_event().
authorBernie Innocenti <bernie@codewiz.org>
Wed, 21 Jun 2017 22:20:32 +0000 (18:20 -0400)
committerBernie Innocenti <bernie@codewiz.org>
Wed, 21 Jun 2017 22:20:32 +0000 (18:20 -0400)
sound.rs

index 859decf8bd42cf3fff97b6a36a32dc31b6e9ce02..ca313b875e03e6dbe528b6fb5625fb7b5daa8447 100644 (file)
--- a/sound.rs
+++ b/sound.rs
@@ -64,9 +64,7 @@ pub fn start() -> SoundPlayer {
 
 pub fn hit_event(player: &mut SoundPlayer) -> f32 {
     use std::ops::Deref;
-    let maybe_audio_device = &mut player.device;
-    let audio_device = &mut maybe_audio_device.as_mut().unwrap();
-    let audio_device_lock = audio_device.lock();
+    let audio_device_lock = player.device.as_mut().unwrap().lock();
     let xm_callback = audio_device_lock.deref();
     let xm = &xm_callback.xm;
     let n_samples = xm.latest_trigger_of_instrument(0x1D);