private static void Instance_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "ActiveStreamHandle" && !Player.Instance.NetStreamingConfigsLoaded) { if (Player.Instance.Wave != null) { //Bass booster BassBooster = new BassBoost(Player.Instance.Wave.Handle, prtBassBooster); BassBooster.SetBypass(!Settings.Default.afx | !Settings.Default.BassBoost); BassBooster.CutOff = Settings.Default.BassRatio; BassBooster.Bandwidth = 0.320f; BassBooster.d_vol = 1; BassBooster.p_vol = 1 - (Settings.Default.BassRatio / 80.0f); BassBooster.HighCutoff = Settings.Default.BassRatio; BassBooster.LowCutoff1 = Settings.Default.BassRatio; BassBooster.LowCutoff2 = Settings.Default.BassRatio; BassBooster.Start(); //Stereo Enhancer StereoEnhancer = new StereoEnhancer(Player.Instance.Wave.Handle, prtStereoEnhancer); StereoEnhancer.Width = (Settings.Default.StereoWidth / 50); StereoEnhancer.SetBypass(!Settings.Default.afx | !Settings.Default.StereoWiden); StereoEnhancer.Start(); //Equalizer //Already made a EQ DSP for this Handle MadeEq = false; //Create the EQ SetBFX_EQ(Player.Instance.Handle); Booster = new BEQA(Player.Instance.Wave.Handle, prtBooster); Booster.SetBypass(!Settings.Default.afx | !Settings.Default.boosters); Booster.Start(); Booster.Eq.lg = Settings.Default.lg; Booster.Eq.mg = Settings.Default.mg; Booster.Eq.hg = Settings.Default.hg; ////Treble booster //TrebleBooster = new TrebleBooster(Player.Instance.Wave.Handle, prtTrebleBooster); //TrebleBooster.SetBypass(!Settings.Default.BassBoost); //TrebleBooster.CutOff = Settings.Default.BassRatio * 30; //TrebleBooster.Bandwidth = Settings.Default.BassSelectivity / 1000f; //TrebleBooster.d_vol = 1; //TrebleBooster.p_vol = 1 - (Settings.Default.BassRatio / 80.0f); //TrebleBooster.Start(); ByPassAll(!Settings.Default.afx); } } else if (e.PropertyName == "Play") { } }
/// <summary> /// Set Bass Boost /// </summary> /// <param name="boost">Boost Mode</param> public void SetBassBoost(BassBoost boost) { byte[] buff = new byte[1]; int reg3; sensor.WriteRead(new byte[] { 0x04 }, buff); reg3 = buff[0]; reg3 &= 0xFC; reg3 |= (int)boost; sensor.Write(new byte[] { 0x04, (byte)reg3 }); }
/// <summary> /// Runs the filter on the image using the specific filter /// type's ProcessBlock method. /// </summary> private void RunFilter(String filter, EffectParameters param, ref FloatToInt[] input, ref FloatToInt[] output, int length) { switch (filter) { case "Echo": Echo echo = new Echo((EchoParameters)param); echo.ProcessBlock(ref input, ref output, input.Length); break; case "Amplify": Amplify amplify = new Amplify((AmplifyParameters)param); amplify.ProcessBlock(ref input, ref output, input.Length); break; case "Bass Boost": BassBoost BassBoost = new BassBoost((BassBoostParameters)param); BassBoost.ProcessBlock(ref input, ref output, input.Length); break; case "Phaser": Phaser Phaser = new Phaser((PhaserParameters)param); Phaser.ProcessBlock(ref input, ref output, input.Length); break; case "Fade In": FadeIn FadeIn = new FadeIn((FadeInParameters)param); FadeIn.ProcessBlock(ref input, ref output, input.Length); break; case "Fade Out": FadeOut FadeOut = new FadeOut((FadeOutParameters)param); FadeOut.ProcessBlock(ref input, ref output, input.Length); break; case "Distortion": Distortion distortion = new Distortion((DistortionParameters)param); distortion.ProcessBlock(ref input, ref output, input.Length); break; default: StatusText.Content = "Invalid filter"; break; } }