SeeScore.PlayData.IPlayData CreateMidiPlayData() { SeeScore.PlayData.IPlayData pd = SeeScore.PlayData.PD.Create(score, new UTempo(this)); double rate = pd.HasDefinedTempo() ? pd.TempoAtStart().bpm : kDefaultTempoBPM; // use default 80 if no tempo defined in file bpmLabel.Text = "" + rate.ToString("F0"); notifier = new SeeScore.Notifier(pd); if (kUsingNoteCursor) { notifier.SetNoteHandler(new NoteHandler(this)); // note cursor } notifier.SetBarChangeHandler(new BarEventHandler(this)); // bar cursor notifier.SetBeatHandler(new BeatHandler(this)); notifier.SetEndHandler(new EndHandler(this)); return(pd); }
private void UpdateTempo(float tempoScaling) { if (score != null) { bool isPlaying = axWindowsMediaPlayer1.playState == WMPPlayState.wmppsPlaying; if (isPlaying) { axWindowsMediaPlayer1.Ctlcontrols.stop(); notifier.Stop(); } axWindowsMediaPlayer1.URL = null; SeeScore.PlayData.IPlayData playData = GetMIDIPlayData(); double rate = (playData.HasDefinedTempo() ? playData.TempoAtStart().bpm : kDefaultTempoBPM) * tempoScaling; bpmLabel.Text = "" + rate.ToString("F0"); playData.UpdateTempo(); playData.ScaleMidiFileTempo(GetMIDIFile(), tempoScaling); if (isPlaying) { int barIndex = seeScoreView.CursorBarIndex(); StartPlayAt(barIndex, false); } } }