From c6bf921a7244e641797b55c819a3f43abcabb743 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Tue, 24 May 2022 10:28:19 -0500 Subject: [PATCH] Create correct source types based on presence of panning components. --- src/lib.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index ecf65cc..27b98e4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -256,6 +256,29 @@ pub fn update_sound_properties( .add_generator(generator) .expect("Unable to add generator"); sound.source = Some(source.into()); + } else if let Some(scalar_pan) = scalar_pan { + let source = syz::ScalarPannedSource::new( + &context, + syz::PannerStrategy::Delegate, + **scalar_pan, + ) + .expect("Failed to create source"); + source + .add_generator(generator) + .expect("Failed to add generator"); + sound.source = Some(source.into()); + } else if let Some(angular_pan) = angular_pan { + let source = syz::AngularPannedSource::new( + &context, + syz::PannerStrategy::Delegate, + angular_pan.azimuth, + angular_pan.elevation, + ) + .expect("Failed to create source"); + source + .add_generator(generator) + .expect("Failed to add generator"); + sound.source = Some(source.into()); } else { let source = syz::DirectSource::new(&context).expect("Failed to create source");