Beispiel #1
0
 private static void SetVolumeScale(ref MouseCustom mouseGrid, List <GridLed> Keys, ColoreColor color)
 {
     for (var i = 0; i < (player.PlayerEngine.SoundVolume * Keys.Count) / 100; i++) //volume bar (D0-D9)
     {
         mouseGrid[Keys[i]] = color;
     }
 }
Beispiel #2
0
        public static MouseCustom Max(this MouseCustom mouse, Color c)
        {
            for (var i = 0; i < MouseConstants.MaxLeds; i++)
            {
                mouse[i] = mouse[i].Max(c);
            }

            return(mouse);
        }
Beispiel #3
0
        public static MouseCustom Combine(this MouseCustom mouse, Color c, double cPct = 0.5)
        {
            for (var i = 0; i < MouseConstants.MaxLeds; i++)
            {
                mouse[i] = mouse[i].Combine(c, cPct);
            }

            return(mouse);
        }
Beispiel #4
0
        private static void SetPlayingPosition(ref MouseCustom mouseGrid, double Position, List <GridLed> Strip, ColoreColor pos, ColoreColor background)
        {
            var currentPlayPosition = (int)Math.Round(Position * 0.6, 0); //can replace 1.1 with ((double)(leftStrip.Count - 1) / 10) for safe calculation

            for (var i = 0; i < currentPlayPosition + 1; i++)
            {
                mouseGrid[Strip[i]] = background;
            }
            mouseGrid[Strip[currentPlayPosition]] = pos;
        }
Beispiel #5
0
        private static async void ChromaUpdateAsync()
        {
            AllKeys.Remove(Key.Invalid); // no idea why this key is inside the enum?
            var opacity      = 0.5;
            var keyboardGrid = KeyboardCustom.Create();
            var mouseGrid    = MouseCustom.Create();
            var chroma       = await ColoreProvider.CreateNativeAsync();

            var bg_playing      = new ColoreColor((byte)Properties.Settings.Default.Background_Playing.R, (byte)Properties.Settings.Default.Background_Playing.G, (byte)Properties.Settings.Default.Background_Playing.B);
            var bg_pause        = new ColoreColor((byte)Properties.Settings.Default.Background_Pause.R, (byte)Properties.Settings.Default.Background_Pause.G, (byte)Properties.Settings.Default.Background_Pause.B);
            var pos_fore        = new ColoreColor((byte)Properties.Settings.Default.Position_Foreground.R, (byte)Properties.Settings.Default.Position_Foreground.G, (byte)Properties.Settings.Default.Position_Foreground.B);
            var pos_back        = new ColoreColor((byte)Properties.Settings.Default.Position_Background.R, (byte)Properties.Settings.Default.Position_Background.G, (byte)Properties.Settings.Default.Position_Background.B);
            var vol             = new ColoreColor((byte)Properties.Settings.Default.Volume.R, (byte)Properties.Settings.Default.Volume.G, (byte)Properties.Settings.Default.Volume.B);
            var backgroundColor = ColoreColor.Black;

            while (true)
            {
                var backgroundDetermine = player.PlayerEngine.PlayerState == ITPlayerState.ITPlayerStatePlaying ? bg_playing : bg_pause;
                backgroundColor = BackgroundColorDecision(ref opacity, Properties.Settings.Default.AdaptiveDensity ? ActiveDevice.AudioMeterInformation.MasterPeakValue : 1, backgroundDetermine);// (10 - Properties.Settings.Default.RefreshRate) + 1, backgroundDetermine);
                ColorsVariableDecision(ref bg_playing, ref bg_pause, ref pos_fore, ref pos_back, ref vol);
                try
                {
                    var currentTime = TimeSpan.FromSeconds(player.PlayerEngine.PlayerPosition);
                    var position    = player.CalculatedPosition;
                    keyboardGrid.Set(backgroundColor);
                    mouseGrid.Set(backgroundColor);
                    SetIndividualKeys(ref keyboardGrid);
                    SetPlayingTime(ref keyboardGrid, currentTime, ColoreColor.Red, ThisIsWhatCalledOrange, ColoreColor.Yellow);
                    SetPlayingPosition(ref keyboardGrid, position, FunctionKeys, pos_fore, pos_back);
                    SetPlayingPosition(ref mouseGrid, position, Properties.Settings.Default.ReverseLEDRender ? RightStrip : LeftStrip, pos_fore, pos_back);
                    SetVolumeScale(ref mouseGrid, Properties.Settings.Default.ReverseLEDRender ? LeftStrip : RightStrip, vol);
                    SetVolumeScale(ref keyboardGrid, DPadKeys, vol);
                }
                catch
                {
                    continue; //in case the music is not playing yet, the position is unobtainable.
                }
                finally
                {
                    await chroma.Keyboard.SetCustomAsync(keyboardGrid);

                    await chroma.Mouse.SetGridAsync(mouseGrid);

                    await chroma.Headset.SetAllAsync(backgroundColor);

                    await chroma.Mousepad.SetAllAsync(backgroundColor);

                    Thread.Sleep(500 * (Properties.Settings.Default.AdaptiveDensity ? Properties.Settings.Default.RefreshRate / 10 : 1));
                }
            }
        }