internal BarDetails GetNextBarDetails(double noteTime) { var barDetails = new BarDetails(); //Get first bar note time and x coord where the noteTime is greater than current note time //I have a dictionary of // List<renderItems> // I need a predicate on renderItemType, while knowing the key that it pertains to. var barItems = _renderItemsDictionary.Where(ris => ris.Value.Any(ri => ri.ItemType == RenderItemType.BarDivision) && ris.Key > noteTime); if (barItems != null) { var firstItem = barItems.First(); barDetails.NoteTime = firstItem.Key; barDetails.XCoord = GetHorizontalPositionForNoteTime(firstItem.Key); } return(barDetails); }
internal BarDetails GetNextBarDetails(double noteTime) { var barDetails = new BarDetails(); //Get first bar note time and x coord where the noteTime is greater than current note time //I have a dictionary of // List<renderItems> // I need a predicate on renderItemType, while knowing the key that it pertains to. var barItems = _renderItemsDictionary.Where(ris => ris.Value.Any(ri => ri.ItemType == RenderItemType.BarDivision) && ris.Key > noteTime); if (barItems != null) { var firstItem = barItems.First(); barDetails.NoteTime = firstItem.Key; barDetails.XCoord = GetHorizontalPositionForNoteTime(firstItem.Key); } return barDetails; }
private void Controller_Stopping(object sender, EventArgs e) { _updateScrollTimer.Change(Timeout.Infinite, _scrollTimingPerdiod); _lastNoteTime = 0; ResetHorizontalScrollPosition(); nextBarDetails = new BarDetails(); }
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(); }
private void Controller_SongNoteEvent(object sender, SongEventArgs e) { _logger.Log(this, LogLevel.Debug, "Score control handling song note event. " + e); _virtualKeyboard.HandleIncomingMessage(this, e.NoteKeyStrokeEvenArguments); _output.Send(this, e.NoteKeyStrokeEvenArguments); if (e.NoteKeyStrokeEvenArguments.KeyStrokeType != Common.Events.KeyStrokeType.KeyPress) return; //Only handle this once per chord if (e.NoteTime <= _lastNoteTime) return; //update speed once per bar if (e.NoteTime > nextBarDetails.NoteTime) { _lastNoteTime = nextBarDetails.NoteTime; nextBarDetails = _scoreParser.GetNextBarDetails(e.NoteTime); SetScrollSpeed(nextBarDetails.XCoord, _lastNoteTime, nextBarDetails.NoteTime); } _logger.Log(this, LogLevel.Debug, "Score control finished handling song note event. " + e); }