public void Record() { if (IsRecording) { return; } if (IsPlaying) { Stop(); } // Clear current sequence if any Clear(); // Start recording try { Clock.Start(); _midiInput.StartRecording(); _midiInput.MessageReceived += HandleChannelMessageReceived; IsRecording = true; CanPlay = true; CanRecord = false; CanStop = true; } catch (Exception ex) { Exceptions.ErrHandler(ex); } }
public ScoreControl(IUnityContainer container, IOutput output, IMidiInput midiInput, IInputEvents inputEvents, IMediaServiceHost mediaServiceHost, IVirtualKeyBoard virtualKeyboard, ILogger logger, XScore musicScore) : this() { _container = container; _output = output; _intputEvents = inputEvents; _midiInput = midiInput; _virtualKeyboard = virtualKeyboard; _musicScore = musicScore; _mediaServiceHost = mediaServiceHost; _logger = logger; _updateScrollTimer = new Timer(ScrollTimerHandler, null, Timeout.Infinite, _scrollTimingPerdiod); _scoreParser = new ScoreParser(_musicScore, ScoreGrid); _scoreParser.Render(); ScoreGrid.Width = _scoreParser.GetMaxHorizontalPosition(); nextBarDetails = new BarDetails(); nextBarDetails.NoteTime = 0; nextBarDetails.XCoord = 0; _intputEvents.MessageReceived += HandleInputEvent; _midiInput.StartRecording(); ConfigureSongEventController(); }