Exemplo n.º 1
0
 private void UpdateUI(object sender, EventArgs e)
 {
     if (stopUI)
     {
         stopUI = false;
         if (playlistPlaying)
         {
             playedSongs.Add(curSong);
             SetAndLoadNextPlaylistSong();
         }
         else
         {
             Stop();
         }
     }
     else
     {
         if (WindowState != FormWindowState.Minimized)
         {
             SongInfoControl.SongInfo info = songInfo.Info;
             Engine.Instance.Player.GetSongState(info);
             piano.UpdateKeys(info, PianoTracks);
             songInfo.Invalidate();
         }
         UpdatePositionIndicators(Engine.Instance.Player.ElapsedTicks);
     }
 }
Exemplo n.º 2
0
 public void UpdateKeys(SongInfoControl.SongInfo info, bool[] enabledTracks)
 {
     for (int k = 0; k <= 0x7F; k++)
     {
         PianoKey key = Keys[k];
         key.Dirty   = key.Pressed;
         key.Pressed = false;
     }
     for (int i = SongInfoControl.SongInfo.MaxTracks - 1; i >= 0; i--)
     {
         if (enabledTracks[i])
         {
             SongInfoControl.SongInfo.Track tin = info.Tracks[i];
             for (int nk = 0; nk < SongInfoControl.SongInfo.MaxKeys; nk++)
             {
                 byte k = tin.Keys[nk];
                 if (k == byte.MaxValue)
                 {
                     break;
                 }
                 else
                 {
                     PianoKey key = Keys[k];
                     key.OnBrush.Color = GlobalConfig.Instance.Colors[tin.Voice];
                     key.Pressed       = key.Dirty = true;
                 }
             }
         }
     }
     for (int k = 0; k <= 0x7F; k++)
     {
         PianoKey key = Keys[k];
         if (key.Dirty)
         {
             key.Invalidate();
         }
     }
 }