Ejemplo n.º 1
0
        private void Navigation_Completed(WebView sender, WebViewNavigationCompletedEventArgs args)
        {
            // Add JS functions to Chaos Controls
            ChaosControl.GetAllControls()[0].AddJSFunction(sender, "changeAttackRelease");
            ChaosControl.GetAllControls()[0].SetEllipsePosition(0.15, 0.5);

            ChaosControl.GetAllControls()[1].AddJSFunction(sender, "changeDelayFeedbackVolume");
            ChaosControl.GetAllControls()[1].SetEllipsePosition(0, 1);

            ChaosControl.GetAllControls()[2].AddJSFunction(sender, "changeAccentFilter");
            ChaosControl.GetAllControls()[2].SetEllipsePosition(0.5, 0.5);

            ChaosControl.GetAllControls()[3].AddJSFunction(sender, "changeChorusCrush");
            ChaosControl.GetAllControls()[3].SetEllipsePosition(0.5, 1);

            ChaosControl.GetAllControls()[0].ControlActivatedOrDeactivated += delegate(object s, EventArgs ea) { ToggleEffectsVisibility(EffectsSettingButton, true); };
            ChaosControl.GetAllControls()[1].ControlActivatedOrDeactivated += delegate(object s, EventArgs ea) { ToggleEffectsVisibility(EffectsSettingButton, true); };
            ChaosControl.GetAllControls()[2].ControlActivatedOrDeactivated += delegate(object s, EventArgs ea) { ToggleEffectsVisibility(EffectsSettingButton, true); };
            ChaosControl.GetAllControls()[3].ControlActivatedOrDeactivated += delegate(object s, EventArgs ea) { ToggleEffectsVisibility(EffectsSettingButton, true); };

            // Set up the Trigger for handling all sequencing and timing
            GlobalMusicTrigger = new MusicTrigger(sender);
            GlobalMusicTrigger.TurnOnJS();

            // Associate the visual element in the bottom of the screen with the Pitch Number Sequence
            Bumperz.SetPitches(GlobalMusicTrigger.PitchNumSequence);

            // Add UI event listeners to respond to musical events/changes
            GlobalMusicTrigger.OnStopLoop                 += delegate(object s, EventArgs ea) { Bumperz.BumpUp(); };
            GlobalMusicTrigger.OnAttackSequencerOff       += delegate(object s, EventArgs ea) { Bumperz.BumpDown(GlobalMusicTrigger.CurrentPitchBeat); };
            GlobalMusicTrigger.OnRelease                  += delegate(object s, EventArgs ea) { Bumperz.BumpUp(); };
            GlobalMusicTrigger.OnRelease                  += delegate(object s, EventArgs ea) { Bumperz.SetActive(GlobalMusicTrigger.CurrentPitchBeat); };
            GlobalMusicTrigger.OnScriptNotify             += delegate(object s, EventArgs ea) { Bumperz.Bump(GlobalMusicTrigger.CurrentPitchBeat); };
            GlobalMusicTrigger.OnGenerateRandomSequence   += delegate(object s, EventArgs ea) { Bumperz.ResetPositions(); };
            GlobalMusicTrigger.OnPitchPatternLengthChange += delegate(object s, EventArgs ea) { Bumperz.SetNumberOfBumpers(GlobalMusicTrigger.PitchPatternLength); };

            GlobalMusicTrigger.OnRhythmPatternLengthChange += delegate(object s, EventArgs ea) { RhythmPatternStatus.SetSequenceLength(GlobalMusicTrigger.RhythmPatternLength); };
            GlobalMusicTrigger.OnRhythmPatternLengthChange += delegate(object s, EventArgs ea) { rhythmGrid.SetSequenceLength(GlobalMusicTrigger.RhythmPatternLength); };
            GlobalMusicTrigger.OnBeatChange += delegate(object s, EventArgs ea) { RhythmPatternStatus.Flash(GlobalMusicTrigger.CurrentRhythmBeat); };
            GlobalMusicTrigger.OnBeatChange += delegate(object s, EventArgs ea) { rhythmGrid.Bump(GlobalMusicTrigger.CurrentRhythmBeat); };

            GlobalMusicTrigger.OnPitchPatternLengthChange += delegate(object s, EventArgs ea) { PitchPatternStatus.SetSequenceLength(GlobalMusicTrigger.PitchPatternLength); };
            GlobalMusicTrigger.OnBeatChange += delegate(object s, EventArgs ea) { PitchPatternStatus.Flash(GlobalMusicTrigger.CurrentPitchBeat); };

            // Start the user off with a random pitch sequence
            GlobalMusicTrigger.GenerateRandomSequence();
        }
Ejemplo n.º 2
0
        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            // Don't show animation when the app is first loaded - this still goes into effect too soon
            Implicit.SetShowAnimations(instrument, (AnimationCollection)Resources["PullFromLeft"]);

            chaosColors = new List <SolidColorBrush>()
            {
                (SolidColorBrush)Resources["red"], (SolidColorBrush)Resources["orange"],
                (SolidColorBrush)Resources["yellow"], (SolidColorBrush)Resources["lime"],
            };

            List <(string, string, string)> chaosText = new List <(string, string, string)>()
            {
                ("Attack + Release", "Attack", "Release"), ("Delay", "Delay Feedback", "Delay Volume"),
                ("Volume + Filter", "Volume", "Filter Cutoff"), ("Chorus + Crush", "Chorus", "Crush")
            };

            for (int i = 0; i < 4; i++)
            {
                ChaosControl cc = new ChaosControl(500, 80, chaosColors[i], new SolidColorBrush((Windows.UI.Color)Application.Current.Resources["SystemBaseMediumColor"]), chaosText[i].Item1, chaosText[i].Item2, chaosText[i].Item3);
                Implicit.SetShowAnimations(cc.ChaosCanvas, (AnimationCollection)Resources["Shower"]);
                Implicit.SetHideAnimations(cc.ChaosCanvas, (AnimationCollection)Resources["Hider"]);
                Implicit.SetShowAnimations(cc.GhostCanvas, (AnimationCollection)Resources["Ghost-Shower"]);
                Implicit.SetHideAnimations(cc.GhostCanvas, (AnimationCollection)Resources["Ghost-Hider"]);

                Chaos.Children.Add(cc.GhostCanvas);
                Chaos.Children.Add(cc.ChaosCanvas);

                ChaosControlsPanel.Children.Add(cc.ChaosButtons);
            }

            // Navigate to the Web Synth
            // Since this only hanldes audio processing - it does not get added to the grid
            string src = "ms-appx-web:///Assets/web/index.html";

            WebSynth = new WebView(WebViewExecutionMode.SeparateProcess); // This seems to help reduce UI/Audio hangs
            WebSynth.NavigationCompleted += Navigation_Completed;
            WebSynth.Navigate(new Uri(src));
        }
Ejemplo n.º 3
0
 // -------------------- Effects Page --------------------
 private void GazeMoved(GazeInputSourcePreview sender, GazeMovedPreviewEventArgs args)
 {
     ChaosControl.GetActiveControl().MoveEllipse(args.CurrentPoint.EyeGazePosition.Value.X, args.CurrentPoint.EyeGazePosition.Value.Y);
 }