void SetupAnimation1D(string path, Device1D device)
    {
        int animationId = ChromaAnimationAPI.GetAnimation(path);

        if (animationId == -1)
        {
            animationId = ChromaAnimationAPI.CreateAnimationInMemory((int)DeviceType.DE_1D, (int)device);
            ChromaAnimationAPI.CopyAnimation(animationId, path);
            ChromaAnimationAPI.CloseAnimation(animationId);
            ChromaAnimationAPI.MakeBlankFramesName(path, 1, 0.1f, 0);
        }
    }
    void SetAmbientColor1D(Device1D device, int[] colors, int ambientColor)
    {
        int size = GetColorArraySize1D(device);

        for (int i = 0; i < size; ++i)
        {
            if (colors[i] == 0)
            {
                colors[i] = ambientColor;
            }
        }
    }
    void BlendAnimation1D(Effect effect, DeviceFrameIndex deviceFrameIndex, int device, Device1D device1d, string animationName,
                          int[] colors, int[] tempColors)
    {
        int size       = GetColorArraySize1D(device1d);
        int frameId    = deviceFrameIndex._mFrameIndex[device];
        int frameCount = ChromaAnimationAPI.GetFrameCountName(animationName);

        if (frameId < frameCount)
        {
            //cout << animationName << ": " << (1 + frameId) << " of " << frameCount << endl;
            float duration;
            int   animationId = ChromaAnimationAPI.GetAnimation(animationName);
            ChromaAnimationAPI.GetFrame(animationId, frameId, out duration, tempColors, size);
            for (int i = 0; i < size; ++i)
            {
                int color1    = colors[i];     //target
                int tempColor = tempColors[i]; //source

                // BLEND
                int color2;
                if (effect._mBlend == "none")
                {
                    color2 = tempColor; //source
                }
                else if (effect._mBlend == "invert")
                {
                    if (tempColor != 0)                  //source
                    {
                        color2 = InvertColor(tempColor); //source inverted
                    }
                    else
                    {
                        color2 = 0;
                    }
                }
                else if (effect._mBlend == "thresh")
                {
                    color2 = Thresh(effect._mPrimaryColor, effect._mSecondaryColor, tempColor); //source
                }
                else // if (effect._mBlend == "lerp") //default
                {
                    color2 = MultiplyNonZeroTargetColorLerp(effect._mPrimaryColor, effect._mSecondaryColor, tempColor); //source
                }

                // MODE
                if (effect._mMode == "max")
                {
                    colors[i] = MaxColor(color1, color2);
                }
                else if (effect._mMode == "min")
                {
                    colors[i] = MinColor(color1, color2);
                }
                else if (effect._mMode == "average")
                {
                    colors[i] = AverageColor(color1, color2);
                }
                else if (effect._mMode == "multiply")
                {
                    colors[i] = MultiplyColor(color1, color2);
                }
                else if (effect._mMode == "add")
                {
                    colors[i] = AddColor(color1, color2);
                }
                else if (effect._mMode == "subtract")
                {
                    colors[i] = SubtractColor(color1, color2);
                }
                else // if (effect._mMode == "replace") //default
                {
                    if (color2 != 0)
                    {
                        colors[i] = color2;
                    }
                }
            }
            deviceFrameIndex._mFrameIndex[device] = (frameId + frameCount + effect._mSpeed) % frameCount;
        }
    }
    int GetColorArraySize1D(Device1D device)
    {
        int maxLeds = ChromaAnimationAPI.GetMaxLeds(device);

        return(maxLeds);
    }