// Loops the clip by lerping between the main and the copy clip
    private void playLoopMainToStart()
    {
        // Init
        if (fInitLoopMain)
        {
            mixerEmotionPlayable.GetInput(playablesDict[playablesEmotionKey]).GetInput(mainMixerCopyIndex).SetTime(0f);
            fInitLoopMain = false;
        }

        // LERP Init
        mainLoopCurrentTime += Time.deltaTime;
        float mu = mainLoopCurrentTime / mainLoopTriggerTime;
        //float t;
        float upcomingBlendWeight = 0;
        float pStart = 0f;
        float pEnd   = 1f;

        // Linear
        upcomingBlendWeight = IFALerp.linear(pStart, pEnd, mu);

        // Set Weights
        mixerEmotionPlayable.GetInput(playablesDict[playablesEmotionKey]).SetInputWeight(mainMixerMainIndex, 1f - upcomingBlendWeight);
        mixerEmotionPlayable.GetInput(playablesDict[playablesEmotionKey]).SetInputWeight(mainMixerCopyIndex, upcomingBlendWeight);

        // CleanUp
        if (upcomingBlendWeight >= mainLoopTriggerTime)
        {
            float timeElapsed = (float)mixerEmotionPlayable.GetInput(playablesDict[playablesEmotionKey]).GetInput(mainMixerCopyIndex).GetTime();
            mixerEmotionPlayable.GetInput(playablesDict[playablesEmotionKey]).GetInput(mainMixerMainIndex).SetTime(timeElapsed);
            interruptLoop();
        }
    }
    // Function that handles the actual blending. Called each frame in update
    private void playTransition()
    {
        // Initialize Transition when it begins
        if (fInitTransition)
        {
            newMainClip.reset();  // TODO: Might need to comment this back in if auto-main-loop doesnt work

            fInitTransition = false;
        }

        // LERP Transition and currently playing emotion
        // Interpolation website: http://paulbourke.net/miscellaneous/interpolation/
        currentTime += Time.deltaTime;
        float mu = currentTime / blendDuration;
        //float t;
        float upcomingBlendWeight = 0;
        float pStart = 0f;
        float pEnd   = 1f;

        switch (interpolationMode)
        {
        case "Linear":
            upcomingBlendWeight = IFALerp.linear(pStart, pEnd, mu);
            break;

        case "Cubic":
            upcomingBlendWeight = IFALerp.cubic(pStart, pEnd, mu);
            break;

        case "Bezier":
            upcomingBlendWeight = IFALerp.bezier(pStart, pEnd, mu, pBezierP1, pBezierP2);
            break;

        default:
            break;
        }

        // Draw for display purposes
        if (drawGraphOnImage)
        {
            drawGraphOnImage.drawPoint(0, pStart, Color.red);
            drawGraphOnImage.drawPoint(1, pEnd, Color.green);
            drawGraphOnImage.drawPoint(mu, upcomingBlendWeight, Color.black);
        }



        // Set Blend Weights
        if (oldMainClips != null)
        {
            for (int i = 0; i < oldMainClips.Count; i++)
            {
                oldMainClips[i].setWeight((1f - upcomingBlendWeight) * oldMainClipsInitialWeight[i]);
            }
        }
        newMainClip.setWeight(upcomingBlendWeight);

        // TODO: Update Clips?
        foreach (IFAClip clip in allClips)
        {
            clip.update();
        }


        // End Transition CleanUp, Prepare playing Main
        if (currentTime >= blendDuration)
        {
            blendingDone = true;
        }
    }
    // Function that handles the actual blending. Called each frame in update
    private void playTransition()
    {
        // Initialize Transition when it begins
        if (fInitTransition)
        {
            transitionClip.reset();

            fInitTransition          = false;
            fPlayMainAfterTransition = false;   // In case a new transition starts while a transitionIn animation is still playing
        }

        // LERP Transition and currently playing emotion
        // Interpolation website: http://paulbourke.net/miscellaneous/interpolation/
        currentTime += Time.deltaTime;
        float mu = currentTime / blendDuration;
        //float t;
        float upcomingBlendWeight = 0;
        float pStart = 0f;
        float pEnd   = 1f;

        switch (interpolationMode)
        {
        case "Linear":
            upcomingBlendWeight = IFALerp.linear(pStart, pEnd, mu);
            break;

        case "Cubic":
            upcomingBlendWeight = IFALerp.cubic(pStart, pEnd, mu);
            break;

        case "Bezier":
            upcomingBlendWeight = IFALerp.bezier(pStart, pEnd, mu, pBezierP1, pBezierP2);
            break;

        default:
            break;
        }

        // Draw for display purposes
        if (drawGraphOnImage)
        {
            drawGraphOnImage.drawPoint(0, pStart, Color.red);
            drawGraphOnImage.drawPoint(1, pEnd, Color.green);
            drawGraphOnImage.drawPoint(mu, upcomingBlendWeight, Color.black);
        }


        // Set Blend Weights
        if (oldMainClips != null)
        {
            for (int i = 0; i < oldMainClips.Count; i++)
            {
                oldMainClips[i].setWeight((1f - upcomingBlendWeight) * oldMainClipsInitialWeight[i]);
            }
        }
        transitionClip.setWeight(upcomingBlendWeight);

        // Update Clips?
        foreach (IFAClip clip in allClips)
        {
            clip.update();
        }


        // End Transition CleanUp, Prepare playing Main
        if (currentTime >= blendDuration)
        {
            fPlayMainAfterTransition = true;
            fInitTransition          = true;
            currentTime = 0;
            //previousEmotionNumber = emotionNumber;
            transitionDone = true;
        }
        //normalize = true;
    }