Esempio n. 1
0
        public override void EffectAction()
        {
            UseEffect = true;
            ISpeakers speakers    = new Speakers();
            double    timer       = 0;
            int       refreshRate = RefreshRate;
            double    timerLimit  = 100000 / Tempo;
            double    tempo       = Tempo;

            while (UseEffect)
            {
                double spectrumDelta = (timer * tempo) / 1000;
                double r, g, b;
                (r, g, b) = GetSpectrumColorF(spectrumDelta);

                if (HasChroma)
                {
                    ChromaFX.Color coraleColor = new ChromaFX.Color(r, g, b);
                    //ChromaFX.Devices.Mouse.Mouse.Instance.SetAll(coraleColor);
                    //ChromaFX.Devices.ChromaLink.ChromaLink.Instance.SetAll(coraleColor);
                    ////ChromaFX.Devices.Mouse.Ch.SetAll(coraleColor);

                    //Custom custom = new Custom(coraleColor);
                    //speakers.SetStatic(custom, ChromaFX.Devices.Devices.Nommo);
                    //Chroma.Instance.SetAll(coraleColor);
                    //Chroma.Instance.Headset.SetAll(coraleColor);
                    //Chroma.Instance.Mouse.SetAll(coraleColor);
                    //Chroma.Instance.ChromaLink.SetAll(coraleColor);

                    //ChromaFX.Devices.Mouse.Mouse.Instance.SetAll(coraleColor);
                    //ChromaFX.Devices.ChromaLink.ChromaLink.Instance.SetAll(coraleColor);
                    //ChromaFX.Devices.Headset.Headset.Instance.SetAll(coraleColor);
                    //Custom custom = new Custom(coraleColor);
                    //speakers.SetStatic(custom, ChromaFX.Devices.Devices.Nommo);
                    Chroma.Instance.SetAll(coraleColor);
                }

                if (HasLightFX)
                {
                    AlienFXLightingControl.SetFXColour((byte)(r * 255), (byte)(g * 255), (byte)(b * 255));
                }

                if (HasHue)
                {
                    HueFX.Instance.SetColour(r, g, b);
                }

                Thread.Sleep(refreshRate);
                timer += refreshRate;

                if (timer > timerLimit)
                {
                    timer -= timerLimit;
                }
            }
        }
Esempio n. 2
0
        public override void EffectAction()
        {
            UseEffect = true;
            ISpeakers speakers    = new Speakers();
            int       refreshRate = RefreshRate;
            Rectangle bounds      = new Rectangle((int)MonitorRect.X, (int)MonitorRect.Y, (int)MonitorRect.Width, (int)MonitorRect.Height);

            while (UseEffect)
            {
                Color color = GetScreenColour(bounds);

                if (HasLightFX)
                {
                    AlienFXLightingControl.SetFXColour(color.R, color.G, color.B);
                }

                if (HasChroma)
                {
                    ChromaFX.Color coraleColor = new ChromaFX.Color(color.R, color.G, color.B);


                    //Chroma.Instance.Headset.SetAll(coraleColor);
                    //ChromaFX.Devices.Mouse.Mouse.Instance.SetAll(coraleColor);
                    //ChromaFX.Devices.ChromaLink.ChromaLink.Instance.SetAll(coraleColor);
                    Chroma.Instance.SetAll(coraleColor);

                    //Custom custom = new Custom(coraleColor);
                    //speakers.SetStatic(custom, ChromaFX.Devices.Devices.Nommo);
                }

                if (HasHue)
                {
                    HueFX.Instance.SetColour(color);
                }

                Thread.Sleep(refreshRate);
            }
        }
        public override void EffectAction()
        {
            if (Colours == null || !Colours.Any())
            {
                throw new InvalidOperationException("Can not start a custom effect with no colours");
            }

            UseEffect = true;

            int    refreshRate = RefreshRate;
            int    colourCount = Colours.Length;
            double timer       = 0;
            double tempo       = Tempo;
            double timerLimit  = 1 / Tempo;
            int    topIndex    = 1;
            int    bottomIndex = 0;

            Color[] colours = Colours.Select(x => x).ToArray();

            while (UseEffect)
            {
                if (colourCount == 1)
                {
                    Color color = Colours[0];
                    if (HasLightFX)
                    {
                        AlienFXLightingControl.SetFXColour(color.R, color.G, color.B);
                    }

                    if (HasChroma)
                    {
                        ChromaFX.Color coraleColor = new ChromaFX.Color(color.R, color.G, color.B);
                        Chroma.Instance.SetAll(coraleColor);
                    }

                    if (HasHue)
                    {
                        HueFX.Instance.SetColour(color);
                    }

                    Thread.Sleep(1000);
                }
                else
                {
                    double lerpValue = timer * tempo;
                    if (lerpValue >= 1)
                    {
                        topIndex++;
                        bottomIndex++;

                        if (topIndex == colours.Length)
                        {
                            topIndex = 0;
                        }

                        if (bottomIndex == colours.Length)
                        {
                            bottomIndex = 0;
                        }

                        lerpValue -= 1;
                        timer     -= timerLimit;
                    }

                    Color color = LerpRGB(colours[bottomIndex], colours[topIndex], lerpValue);

                    if (HasLightFX)
                    {
                        AlienFXLightingControl.SetFXColour(color.R, color.G, color.B);
                    }

                    if (HasChroma)
                    {
                        ChromaFX.Color coraleColor = new ChromaFX.Color(color.R, color.G, color.B);
                        Chroma.Instance.SetAll(coraleColor);
                    }

                    if (HasHue)
                    {
                        HueFX.Instance.SetColour(color);
                    }

                    timer += refreshRate;
                }

                Thread.Sleep(refreshRate);
            }
        }