예제 #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public SequencerControllerUI()
        {
            this.InitializeComponent();

            // Get an instance to the sequencer controller.
            this.globalSequencerControllerInstance = GlobalSequencerController.GetInstance();

            // Get an instance to the event handler.
            this.globalEventHandlerInstance = GlobalEventHandler.GetInstance();

            // Subscribe to MIDI events.
            this.globalEventHandlerInstance.MidiEventReceived += this.MidiEventReceived;

            // Get an instance to the sequencer data handler.
            this.globalSequencerDataInstance = GlobalSequencerData.GetInstance();

            // Clear out the tap cache.
            for (int i = 0; i < 5; i++)
            {
                this.bpmTapTimer[i] = 0;
            }

            // Register for the keyboard input event to register taps.
            CoreWindow.GetForCurrentThread().KeyDown += Keyboard_KeyDown;

            // Store current theme button color.
            this.themeButtonColor = (SolidColorBrush)StartSequencerButton.Background;

            // Set the initial BPM to 60.
            CurrentBpmSlider.Value = 60;
        }
예제 #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public MainPage()
        {
            this.InitializeComponent();

            // Setting minimum window size.
            ApplicationView.PreferredLaunchViewSize      = new Size(this.minWindowWidth, this.minWindowHeight);
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;

            // Get an instance to the sequencer data handler.
            this.globalSequencerDataInstance = GlobalSequencerData.GetInstance();

            // Explicitly show the title bar.
            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = false;

            // Get an instance to the sequencer controller.
            this.globalSequencerControllerInstance = GlobalSequencerController.GetInstance();

            // Get an instance to the event handler and subscribe to the SequencerPositionChanged event.
            this.globalEventHandlerInstance = GlobalEventHandler.GetInstance();
            this.globalEventHandlerInstance.SequencerPositionChanged += this.SequencerTrigger;
            this.globalEventHandlerInstance.CurrentlyPlayingChanged  += this.SequencerPlayingChanged;

            // Store the current dispatcher to the global event handler.
            this.globalEventHandlerInstance.controllerDispatcher = Dispatcher;

            // Subscribe to the window resize event.
            Window.Current.CoreWindow.SizeChanged += UpdateUI;

            // Subscribe to window close event.
            ApplicationView.GetForCurrentView().Consolidated += MainWindowClosed;

            // Initially create the UI.
            CreateUI();
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        public FullScreenViewer()
        {
            this.InitializeComponent();

            // Hide the standard title bar by removing the title bar and making the buttons transparent.
            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
            ApplicationView.GetForCurrentView().TitleBar.ButtonBackgroundColor = Colors.Transparent;
            ApplicationView.GetForCurrentView().TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;

            // Get an instance to the sequencer controller.
            this.globalSequencerControllerInstance = GlobalSequencerController.GetInstance();

            // Get an instance to the event handler.
            this.globalEventHandlerInstance = GlobalEventHandler.GetInstance();

            // Bind the SequencerTrigger() function to the SequencerPositionChanged event.
            this.globalEventHandlerInstance.SequencerPositionChanged += this.SequencerTrigger;

            // Bind the StartSequencer() function to the CurrentlyPlayingChanged event.
            this.globalEventHandlerInstance.CurrentlyPlayingChanged += this.StartSequencer;

            // Bind the ChangeOpacity() function to the TrackOpacityChanged event.
            this.globalEventHandlerInstance.TrackOpacityChanged += this.ChangeOpacity;

            // Bind the ChangeOpacity() function to the TrackOpacityChanged event.
            this.globalEventHandlerInstance.TrackPlaybackRateChanged += this.ChangePlaybackRate;

            // Bind the ChangeOpacity() function to the TrackOpacityChanged event.
            this.globalEventHandlerInstance.FullscreenModeChanged += this.ChangeFullscreen;

            // Get an instance to the sequencer data handler.
            this.globalSequencerDataInstance = GlobalSequencerData.GetInstance();

            // Subscribe to window close event.
            ApplicationView.GetForCurrentView().Consolidated += PlayerWindowClosed;

            // Mute and elevate all media players.
            mediaPlayerElementTrack0.MediaPlayer.IsMuted          = true;
            mediaPlayerElementTrack0.MediaPlayer.RealTimePlayback = true;
            mediaPlayerElementTrack1.MediaPlayer.IsMuted          = true;
            mediaPlayerElementTrack1.MediaPlayer.RealTimePlayback = true;
            mediaPlayerElementTrack2.MediaPlayer.IsMuted          = true;
            mediaPlayerElementTrack2.MediaPlayer.RealTimePlayback = true;
            mediaPlayerElementTrack3.MediaPlayer.IsMuted          = true;
            mediaPlayerElementTrack3.MediaPlayer.RealTimePlayback = true;
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        public SequencerTrackUI()
        {
            this.InitializeComponent();

            // Get an instance to the sequencer controller.
            this.globalSequencerControllerInstance = GlobalSequencerController.GetInstance();

            // Get an instance to the event handler.
            this.globalEventHandlerInstance = GlobalEventHandler.GetInstance();

            // Get an instance to the sequencer data handler.
            this.globalSequencerDataInstance = GlobalSequencerData.GetInstance();

            this.globalEventHandlerInstance.MidiEventReceived += this.MidiEventReceived;

            // Store current theme button color.
            this.themeButtonColor = (SolidColorBrush)Slot0Button.Background;
        }
예제 #5
0
        public SequencerMidiUI()
        {
            this.InitializeComponent();

            // Get an instance to the sequencer controller.
            this.globalSequencerControllerInstance = GlobalSequencerController.GetInstance();

            // Get an instance to the event handler and subscribe to the SequencerPositionChanged event.
            this.globalEventHandlerInstance = GlobalEventHandler.GetInstance();

            // Store the current dispatcher to the global event handler.
            this.globalEventHandlerInstance.controllerDispatcher = Dispatcher;

            // Get an instance to the sequencer data handler.
            this.globalSequencerDataInstance = GlobalSequencerData.GetInstance();

            // Initialise MIDI controller and start watcher for new devices.
            midiController = new MidiController();
            midiController.StartWatcher();

            // Register event to toggle the MIDI control UI.
            this.globalEventHandlerInstance.MidiControlsVisibilityChanged += this.ToggleMidiControls;

            // Register events if the available MIDI devices have changed and if a MIDI message was received.
            this.globalEventHandlerInstance.AvailableMidiDevicesChanged += this.UpdateMidiDeviceList;
            this.globalEventHandlerInstance.MidiEventReceived           += this.MidiEventReceived;

            // Update the MIDI device list initially, assume no MIDI devices initially.
            this.UpdateMidiDeviceList(null, null);

            // Store current theme button color.
            this.themeButtonColor = (SolidColorBrush)MidiEventType4.Background;

            // Register event that a new MIDI event has been learned.
            this.globalEventHandlerInstance.MidiEventLearned += this.MidiEventLearned;
        }