NextState() public method

public NextState ( ) : IntStateMachine
return IntStateMachine
        private void ConfigureMusic1()
        {
            popOut1Piano     = new Effect.PopOut(S(0.4));
            popOut1Drums     = new Effect.PopOut(S(0.4));
            popOut1DrumsFast = new Effect.PopOut(S(0.3));
            popOut1Chord     = new Effect.PopOut(S(0.4));
            popOut1Solo      = new Effect.PopOut(S(0.3));
            popOut1Solo2     = new Effect.PopOut(S(0.2));
            popOut1Choir     = new Effect.PopOut(S(1.0));
            popOut1Voice     = new Effect.PopOut(S(1.0));
            popOut1Vocal2    = new Effect.PopOut(S(2.0));
            popOut1VocalLong = new Effect.PopOut(S(5.0));
            popOut1End       = new Effect.PopOut(S(5.0));

            popOut1Piano
            .AddDevice(lightString1)
            .AddDevice(lightString2)
            .AddDevice(lightTreeUp)
            .AddDevice(lightStar);

            popOut1Drums
            .AddDevice(lightDeerLarge);

            popOut1DrumsFast
            .AddDevice(lightDeerSmall)
            .AddDevice(lightGarland1)
            .AddDevice(lightGarland2)
            .AddDevice(lightGarland3)
            .AddDevice(lightGarland4)
            .AddDevice(allPixels);

            popOut1Chord
            .AddDevice(lightTopperSmall)
            .AddDevice(lightTopperLarge);
            //.AddDevice(lightTree)
            //.AddDevice(lightCeiling2)
            //.AddDevice(lightCeiling3);

            popOut1Solo
            .AddDevice(lightNet1)
            .AddDevice(lightNet2)
            //.AddDevice(lightCeiling1)
            //.AddDevice(lightCeiling3)
            .SetPriority(2);

            popOut1Solo2
            .AddDevice(lightTreeUp)
            //.AddDevice(lightCeiling1)
            //.AddDevice(lightCeiling3)
            .SetPriority(2);

            popOut1Choir
            .AddDevice(lightGarland1)
            .AddDevice(lightSnow1)
            .AddDevice(lightTopperLarge)
            .AddDevice(lightTopperSmall);
            //.AddDevice(lightCeiling1);

            popOut1Voice
            .AddDevice(lightGarland1)
            .AddDevice(lightGarland2)
            .AddDevice(lightSnow2);
            //.AddDevice(lightCeiling3);

            popOut1Vocal2
            //.AddDevice(lightReindeers)
            .AddDevice(allPixels)
            .SetPriority(10);

            popOut1VocalLong
            .AddDevice(lightSnow1)
            .AddDevice(lightSnow2)
            .AddDevice(lightGarland1)
            .AddDevice(lightGarland2)
            .AddDevice(lightGarland3)
            .AddDevice(lightGarland4)
            //.AddDevice(lightNetRight)
            //.AddDevice(lightGarlandRight)
            //.AddDevice(lightHatsRight)
            .SetPriority(10);

            popOut1End
            .AddDevice(lightStar)
            .AddDevice(lightHat1)
            .AddDevice(lightHat2)
            .AddDevice(lightHat3)
            .AddDevice(lightHat4)
            .AddDevice(lightSnow1)
            .AddDevice(lightSnow2)
            .AddDevice(lightStairs1)
            .AddDevice(lightStairs2)
            .AddDevice(lightGarland1)
            .AddDevice(lightGarland2)
            .AddDevice(lightGarland3)
            .AddDevice(lightGarland4)
            .AddDevice(lightString1)
            .AddDevice(lightString2)
            .AddDevice(lightXmasTree)
            .AddDevice(lightDeerLarge)
            .AddDevice(lightDeerSmall)
            .AddDevice(lightTreeUp)
            .AddDevice(lightTopperSmall)
            .AddDevice(lightTopperLarge)
            .AddDevice(lightNet1)
            .AddDevice(lightNet2)
            .AddDevice(allPixels)
            .SetPriority(100);

            timeline1.AddMs(0, "INIT");
            timeline1.PopulateFromCSV("Christmas Canon Rock All Labels.csv");
            int state    = 0;
            int halfSolo = 0;

            timeline1.TimelineTrigger += (sender, e) =>
            {
                switch (e.Step)
                {
                case 62:
                    // First drum
                    state = 1;
                    allPixels.TurnOff();
                    break;

                case 69:
                    state = 2;
                    //lightCeiling2.SetOnlyColor(Color.Green);
                    //lightCeiling3.SetOnlyColor(Color.Blue);
                    break;

                case 136:
                    // First solo
                    state = 3;
                    allPixels.TurnOff();
                    //lightCeiling2.SetOnlyColor(Color.White);
                    //lightCeiling3.SetOnlyColor(Color.Red);
                    break;

                case 265:
                    // First choir
                    allPixels.TurnOff();
                    state = 4;
                    break;

                case 396:
                    // Vocal 2
                    state = 5;
                    allPixels.SetAllOnlyColor(Color.Blue);
                    break;

                case 497:
                    // Second solo
                    state = 6;
                    allPixels.TurnOff();
                    //lightCeiling2.SetOnlyColor(Color.White);
                    //lightCeiling3.SetOnlyColor(Color.Red);
                    break;

                case 561:
                    // End second solo
                    state = 7;
                    allPixels.TurnOff();
                    break;

                case 585:
                    // End third solo
                    state = 8;
                    allPixels.TurnOff();
                    break;

                case 721:
                    // End third solo
                    state = 9;
                    allPixels.TurnOff();
                    break;
                }

                switch (e.Code)
                {
                case "INIT":
                    state    = 0;
                    halfSolo = 0;
                    //lightCeiling1.SetColor(Color.White, 0);
                    //lightCeiling2.SetColor(Color.Blue, 0);
                    //lightCeiling3.SetColor(Color.Red, 0);
                    break;

                case "N1":
                    hatLightState.NextState();
                    popOut1Piano.Pop(0.4);
                    if (state == 0)
                    {
                        allPixels.Inject(Color.Red, 0.5);
                    }
                    break;

                case "N2":
                    hatLightState.NextState();
                    popOut1Piano.Pop(0.6);
                    if (state == 0)
                    {
                        allPixels.Inject(Color.White, 0.5);
                    }
                    break;

                case "N3":
                    hatLightState.NextState();
                    popOut1Piano.Pop(0.8);
                    if (state == 0)
                    {
                        allPixels.Inject(Color.Blue, 0.5);
                    }
                    break;

                case "N4":
                    hatLightState.NextState();
                    popOut1Piano.Pop(1.0);
                    if (state == 0)
                    {
                        allPixels.Inject(Color.Black, 0.0);
                    }
                    break;

                case "Base":
                    popOut1Drums.Pop(1.0);
                    if (state < 3)
                    {
                        allPixels.SetAllOnlyColor(Color.Purple);
                        popOut1DrumsFast.Pop(1.0);
                    }
                    break;

                case "Cymbal":
                    popOut1Drums.Pop(1.0);
                    if (state < 3)
                    {
                        allPixels.SetAllOnlyColor(Color.Green);
                        popOut1DrumsFast.Pop(1.0);
                    }
                    break;

                case "Chord":
                    popOut1Chord.Pop(1.0);
                    break;

                case "Solo":
                    popOut1Solo.Pop(1.0);
                    if ((halfSolo++ % 2) == 0)
                    {
                        popOut1Solo2.Pop(0.8);
                    }
                    if (state == 3 || state == 6 || state == 8)
                    {
                        Color pixCol = Color.Black;
                        switch (e.Step % 4)
                        {
                        case 0:
                            pixCol = Color.Red;
                            break;

                        case 1:
                            pixCol = Color.Yellow;
                            break;

                        case 2:
                            pixCol = Color.Blue;
                            break;

                        case 3:
                            pixCol = Color.Pink;
                            break;
                        }
                        allPixels.Inject(pixCol, 1.0);
                    }
                    break;

                case "Choir":
                    popOut1Choir.Pop(1.0);
                    break;

                case "Voice":
                    popOut1Voice.Pop(1.0);
                    break;

                case "Vocal2":
                    popOut1Vocal2.Pop(1.0);
                    break;

                case "Long":
                    popOut1VocalLong.Pop(1.0);
                    break;

                case "LongUp":
                    // TODO
                    break;

                case "Down":
                    // TODO
                    break;

                case "End":
                    AllLightsOff();
                    popOut1End.Pop(1.0);
                    break;

                default:
                    this.log.Information("Unhandled code: " + e.Code);
                    break;
                }
            };
        }