From 7e2ea0edb3b305e5a5eeabd408821c6069d2d8a1 Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Sun, 15 Jan 2023 13:12:34 +0100 Subject: [PATCH] Channel Monopole filters added --- ctru-rs/src/services/ndsp/mod.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/ctru-rs/src/services/ndsp/mod.rs b/ctru-rs/src/services/ndsp/mod.rs index 8761978..255e0ff 100644 --- a/ctru-rs/src/services/ndsp/mod.rs +++ b/ctru-rs/src/services/ndsp/mod.rs @@ -111,6 +111,11 @@ impl Channel { unsafe { ctru_sys::ndspChnIsPaused(self.0.into()) } } + // Returns the channel's id + pub fn get_id(&self) -> u8 { + self.0 + } + /// Returns the channel's current sample's position. pub fn get_sample_position(&self) -> u32 { unsafe { ctru_sys::ndspChnGetSamplePos(self.0.into()) } @@ -179,7 +184,17 @@ impl Channel { // FILTERS - // TODO: Add Mono filters (and maybe setup the filter functions in a better way) + pub fn iir_mono_set_enabled(&self, enable: bool) { + unsafe { ctru_sys::ndspChnIirMonoSetEnable(self.0.into(), enable) }; + } + + pub fn iir_mono_set_params_high_pass_filter(&self, cut_off_freq: f32) { + unsafe { ctru_sys::ndspChnIirMonoSetParamsHighPassFilter(self.0.into(), cut_off_freq) }; + } + + pub fn iir_mono_set_params_low_pass_filter(&self, cut_off_freq: f32) { + unsafe { ctru_sys::ndspChnIirMonoSetParamsLowPassFilter(self.0.into(), cut_off_freq) }; + } pub fn iir_biquad_set_enabled(&self, enable: bool) { unsafe { ctru_sys::ndspChnIirBiquadSetEnable(self.0.into(), enable) };