Pop() public method

public Pop ( double startBrightness ) : PopOut
startBrightness double
return PopOut
Ejemplo n.º 1
0
        private void TriggerThunderTimeline(object sender, Animatroller.Framework.Controller.Timeline <string> .TimelineEventArgs e)
        {
            switch (e.Code)
            {
            case "A":
                popOut3.Pop(1.0);
                popOut4.Pop(1.0);
                break;

            case "B":
                popOut2.Pop(0.5);
                break;

            case "C":
                popOut1.Pop(1.0);
                break;
            }
        }
Ejemplo n.º 2
0
        private void ConfigureMusic1()
        {
            popOut1Piano = new Effect.PopOut("Piano", S(0.4));
            popOut1Drums = new Effect.PopOut("Drums", S(0.4));
            popOut1DrumsFast = new Effect.PopOut("Drums Fast", S(0.3));
            popOut1Chord = new Effect.PopOut("Chord", S(0.4));
            popOut1Solo = new Effect.PopOut("Solo", S(0.3));
            popOut1Solo2 = new Effect.PopOut("Solo 2", S(0.2));
            popOut1Choir = new Effect.PopOut("Choir", S(1.0));
            popOut1Voice = new Effect.PopOut("Voice", S(1.0));
            popOut1Vocal2 = new Effect.PopOut("Vocal 2", S(2.0));
            popOut1VocalLong = new Effect.PopOut("Vocal Long", S(5.0));
            popOut1End = new Effect.PopOut("End", 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:
                        log.Info("Unhandled code: " + e.Code);
                        break;
                }
            };
        }
Ejemplo n.º 3
0
        public XmasScene2(IEnumerable<string> args, System.Collections.Specialized.NameValueCollection settings)
        {
            hours = new OperatingHours("Hours");
            if (!args.Contains("TEST"))
            {
                hours.AddRange("5:00 pm", "10:00 pm");
                hours.AddRange("5:00 am", "7:00 am");
            }

            lightNetRight = new Dimmer("Net Right");
            lightGarlandRight = new Dimmer("Garland Right");
            lightHatsRight = new Dimmer("Hats Right");
            lightTreesRight = new Dimmer("Trees Right");
            lightReindeers = new Dimmer("Reindeers");
            lightIcicles = new Dimmer("Icicles");
            lightNetLeft = new Dimmer("Net Left");
            lightTree = new Dimmer("Tree");
            lightGarlandLeft = new Dimmer("Garland Left");
            lightUnused1 = new Dimmer("Unused 1");
            lightUnused2 = new Dimmer("Unused 2");
            lightJesus = new StrobeColorDimmer("Jesus");
            lightCeiling1 = new StrobeColorDimmer("Ceiling 1");
            lightCeiling2 = new StrobeColorDimmer("Ceiling 2");
            lightCeiling3 = new StrobeColorDimmer("Ceiling 3");
            lightVader = new StrobeColorDimmer("Vader");
            buttonLightRed = new Switch("Button Red");
            buttonLightBlue = new Switch("Button Blue");
            elLightsaber = new Switch("Lightsaber");
            elJesus = new Switch("Jesus Halo");
            bigReindeer = new Switch("Big Reindeer");

            buttonBlue = new DigitalInput("Button Blue");
            buttonRed = new DigitalInput("Button Red");
            buttonStartReindeer = new DigitalInput("Start Reindeer");

            timeline = new Controller.Timeline<string>(1);
            stateMachine = new Controller.EnumStateMachine<States>("Main");
            candyCane = new Controller.Sequence("Candy Cane");
            starwarsCane = new Controller.Sequence("Starwars Cane");
            backgroundLoop = new Controller.Sequence("Background");
            musicSeq = new Controller.Sequence("Christmas Canon");
            buttonSeq = new Controller.Sequence("Buttons");
            fatherSeq = new Controller.Sequence("Father");
            breathSeq = new Controller.Sequence("Breath");
            laserSeq = new Controller.Sequence("Laser");

            allPixels = new VirtualPixel1D(100);

            pulsatingEffect1 = new Effect.Pulsating(S(2), 0.3, 1.0, false);
            pulsatingEffect2 = new Effect.Pulsating(S(2), 0.3, 1.0, false);

            popOutPiano = new Effect.PopOut(S(0.4));
            popOutDrums = new Effect.PopOut(S(0.4));
            popOutDrumsFast = new Effect.PopOut(S(0.3));
            popOutChord = new Effect.PopOut(S(0.4));
            popOutSolo = new Effect.PopOut(S(0.3));
            popOutSolo2 = new Effect.PopOut(S(0.2));
            popOutChoir = new Effect.PopOut(S(1.0));
            popOutVoice = new Effect.PopOut(S(1.0));
            popOutVocal2 = new Effect.PopOut(S(2.0));
            popOutVocalLong = new Effect.PopOut(S(5.0));
            popOutEnd = new Effect.PopOut(S(5.0));

            popOutPiano
                .AddDevice(lightIcicles);

            popOutDrums
                .AddDevice(lightReindeers)
                .AddDevice(lightHatsRight);

            popOutDrumsFast
                .AddDevice(lightCeiling1)
                .AddDevice(allPixels);

            popOutChord
                .AddDevice(lightTree)
                .AddDevice(lightCeiling2)
                .AddDevice(lightCeiling3);

            popOutSolo
                .AddDevice(lightNetLeft)
                .AddDevice(lightNetRight)
                .AddDevice(lightCeiling1)
                .AddDevice(lightCeiling3)
                .SetPriority(2);

            popOutSolo2
                .AddDevice(lightCeiling1)
                .AddDevice(lightCeiling3)
                .SetPriority(2);

            popOutChoir
                .AddDevice(lightGarlandRight)
                .AddDevice(lightTreesRight)
                .AddDevice(lightCeiling1);

            popOutVoice
                .AddDevice(lightGarlandLeft)
                .AddDevice(lightCeiling3);

            popOutVocal2
                .AddDevice(lightReindeers)
                .AddDevice(allPixels)
                .SetPriority(10);

            popOutVocalLong
                .AddDevice(lightNetRight)
                .AddDevice(lightGarlandRight)
                .AddDevice(lightHatsRight)
                .SetPriority(10);

            popOutEnd
                .AddDevice(lightIcicles)
                .AddDevice(lightReindeers)
                .AddDevice(lightHatsRight)
                .AddDevice(lightCeiling1)
                .AddDevice(lightCeiling2)
                .AddDevice(lightCeiling3)
                .AddDevice(lightGarlandRight)
                .AddDevice(lightGarlandLeft)
                .AddDevice(lightTreesRight)
                .AddDevice(lightNetRight)
                .AddDevice(lightNetLeft)
                .AddDevice(allPixels)
                .SetPriority(100);

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

            timeline.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":
                            popOutPiano.Pop(0.4);
                            if (state == 0)
                                allPixels.Inject(Color.Red, 0.5);
                            break;

                        case "N2":
                            popOutPiano.Pop(0.6);
                            if (state == 0)
                                allPixels.Inject(Color.White, 0.5);
                            break;

                        case "N3":
                            popOutPiano.Pop(0.8);
                            if (state == 0)
                                allPixels.Inject(Color.Blue, 0.5);
                            break;

                        case "N4":
                            popOutPiano.Pop(1.0);
                            if (state == 0)
                                allPixels.Inject(Color.Black, 0.0);
                            break;

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

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

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

                        case "Solo":
                            popOutSolo.Pop(1.0);
                            if ((halfSolo++ % 2) == 0)
                                popOutSolo2.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":
                            popOutChoir.Pop(1.0);
                            break;

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

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

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

                        case "LongUp":
                            // TODO
                            break;

                        case "Down":
                            // TODO
                            break;

                        case "End":
                            EverythingOff();
                            popOutEnd.Pop(1.0);
                            break;

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

            audioPlayer = new Physical.NetworkAudioPlayer(
                settings["NetworkAudioPlayerIP"],
                int.Parse(settings["NetworkAudioPlayerPort"]));
        }
Ejemplo n.º 4
0
        public Halloween2014(IEnumerable <string> args)
        {
            hoursSmall.AddRange("5:00 pm", "9:00 pm");
            hoursInside.AddRange("6:00 pm", "10:00 pm");
            hoursInside.SetForced(false);

            // Logging
            hoursSmall.Output.Log("Hours small");
            hoursInside.Output.Log("Hours inside");
            movingHead.OutputPan.Log("Pan");
            movingHead.OutputTilt.Log("Tilt");


            hoursSmall
            .ControlsMasterPower(catAir)
            .ControlsMasterPower(catLights)
            .ControlsMasterPower(eyes);

            hoursInside.Output.Subscribe(x =>
            {
                lightInside.Brightness         = x ? 1.0 : 0.0;
                lightMirrorSkeleton.Brightness = x ? 1.0 : 0.0;
            });

            flickerEffect.ConnectTo(lightStairs1.InputBrightness);
            flickerEffect.ConnectTo(lightStairs2.InputBrightness);
            //            pulsatingEffect1.ConnectTo(lightBehindHeads.InputBrightness);
            //            pulsatingEffect1.ConnectTo(lightBehindSheet.InputBrightness);
            pulsatingEffect1.ConnectTo(candySpot.InputBrightness);
            pulsatingEffect2.ConnectTo(lightSpiderWeb.InputBrightness);
            //            pulsatingEffect2.ConnectTo(lightMirrorSkeleton.InputBrightness);
            //            pulsatingEffect2.ConnectTo(lightWindow.InputBrightness);
            //            pulsatingEffect2.ConnectTo(lightInside.InputBrightness);
            //            flickerEffect2.ConnectTo(lightInside.InputBrightness);
            //            pulsatingEffect1.ConnectTo(movingHead.InputBrightness);

            //            movingHead.InputBrightness.Log("Moving Head Brightness");

            //            popOut1.AddDevice(lightning1.InputBrightness);
            //            popOut2.ConnectTo(light.InputBrightness);
            popOut1.ConnectTo(lightBehindHeads.InputBrightness);
            popOut1.ConnectTo(lightBehindSheet.InputBrightness);
            //            popOut1 ConnectTo(lightFlash1.InputBrightness);
            //            popOut2.ConnectTo(lightFlash1.InputBrightness);
            popOut2.ConnectTo(lightBehindSheet.InputBrightness);
            popOut2.ConnectTo(lightning1.InputBrightness);
            popOut3.ConnectTo(lightBehindHeads.InputBrightness);
            popOut3.ConnectTo(lightBehindSheet.InputBrightness);
            popOut3.ConnectTo(lightEntranceR.InputBrightness);
            popOut3.ConnectTo(lightEntranceL.InputBrightness);
            popOut3.ConnectTo(new BrightnessPowerAdapter(lightFlash1).InputBrightness);
            //            popOut3.ConnectTo(lightFlash1.InputBrightness);
            //            popOut4.ConnectTo(lightEntranceL.InputBrightness);
            popOut4.ConnectTo(new BrightnessPowerAdapter(lightFlash1).InputBrightness);
            popOut4.ConnectTo(new BrightnessPowerAdapter(lightFlash2).InputBrightness);

            popOutBehindHeads.ConnectTo(lightBehindHeads.InputBrightness);
            //popOut3.ConnectTo(movingHead.InputBrightness);

            raspberryReaper.DigitalInputs[7].Connect(finalBeam, false);
            raspberryReaper.DigitalOutputs[2].Connect(spiderEyes1);
            raspberryReaper.DigitalOutputs[3].Connect(spiderEyes2);

            raspberryCat.DigitalInputs[4].Connect(catMotion, true);
            raspberryCat.DigitalInputs[5].Connect(firstBeam, false);
            raspberryCat.DigitalOutputs[7].Connect(deadEnd);
            raspberryCat.Connect(audioCat);
            raspberryCat.Motor.Connect(georgeMotor);

            raspberryReaper.Connect(audioReaper);
            raspberryOla.Connect(audioOla);

            raspberryGeorge.DigitalOutputs[7].Connect(fog);
            raspberryGeorge.Connect(audioGeorge);

            inputBrightness.ConnectTo(movingHead);

            // Map Physical lights
            acnOutput.Connect(new Physical.SmallRGBStrobe(reaperLight, 1), 20);
            acnOutput.Connect(new Physical.MonopriceRGBWPinSpot(candySpot, 20), 20);
            acnOutput.Connect(new Physical.MonopriceMovingHeadLight12chn(movingHead, 200), 20);
            acnOutput.Connect(new Physical.GenericDimmer(catAir, 11), 20);
            acnOutput.Connect(new Physical.GenericDimmer(eyes, 12), 20);
            acnOutput.Connect(new Physical.GenericDimmer(catLights, 10), 20);
            //BROKEN            acnOutput.Connect(new Physical.GenericDimmer(testLight3, 103), 20);
            //            acnOutput.Connect(new Physical.GenericDimmer(lightning2, 100), 20);
            acnOutput.Connect(new Physical.GenericDimmer(lightStairs1, 101), 20);
            acnOutput.Connect(new Physical.GenericDimmer(lightStairs2, 102), 20);
            acnOutput.Connect(new Physical.AmericanDJStrobe(lightning1, 5), 20);
            acnOutput.Connect(new Physical.RGBStrobe(lightBehindHeads, 40), 20);
            acnOutput.Connect(new Physical.RGBStrobe(lightBehindSheet, 60), 20);
            acnOutput.Connect(new Physical.RGBStrobe(lightEntranceR, 70), 20);
            acnOutput.Connect(new Physical.RGBStrobe(lightEntranceL, 80), 20);
            acnOutput.Connect(new Physical.GenericDimmer(lightTree, 50), 20);
            acnOutput.Connect(new Physical.GenericDimmer(lightSpiderWeb, 2), 21);
            acnOutput.Connect(new Physical.GenericDimmer(lightMirrorSkeleton, 1), 22);
            acnOutput.Connect(new Physical.GenericDimmer(lightInside, 2), 22);
            acnOutput.Connect(new Physical.GenericDimmer(lightWindow, 3), 22);
            acnOutput.Connect(new Physical.GenericDimmer(lightFlash1, 1), 21);
            acnOutput.Connect(new Physical.GenericDimmer(lightFlash2, 4), 22);

            candySpot.SetOnlyColor(Color.Green);

            oscServer.RegisterAction <int>("/mrmr/pushbutton/0/Hakan-iPhone-6", (msg, data) =>
            {
                if (data.First() != 0)
                {
                    audioOla.PlayTrack("12 Fear of the Dark");
                    //                    popOut4.Pop(1.0);
                    //                    stateMachine.SetState(States.Stair);
                    //                    Exec.Execute(testSeq);
                    //                    Exec.Execute(reaperSeq);
                    //                    popOut4.Pop(1.0);
                    //                    pulsatingEffect2.Start();
                }
            });

            oscServer.RegisterAction <int>("/mrmr/pushbutton/1/Hakan-iPhone-6", (msg, data) =>
            {
                if (data.Any() && data.First() != 0)
                {
                    audioOla.NextBackgroundTrack();
                    //                    stateMachine.SetState(States.George);
                    //                    Exec.Execute(georgeSeq);
                }
            });

            oscServer.RegisterAction <int>("/mrmr/pushbutton/2/Hakan-iPhone-6", (msg, data) =>
            {
                if (data.First() != 0)
                {
                    Exec.Execute(reaperPopSeq);
                }
            });

            oscServer.RegisterAction <int>("/mrmr/pushbutton/3/Hakan-iPhone-6", (msg, data) =>
            {
                if (data.First() != 0)
                {
                    catLights.Value = true;
                    switch (random.Next(3))
                    {
                    case 0:
                        audioCat.PlayEffect("386 Demon Creature Growls");
                        break;

                    case 1:
                        audioCat.PlayEffect("348 Spider Hiss");
                        break;

                    case 2:
                        audioCat.PlayEffect("death-scream");
                        break;
                    }
                    Thread.Sleep(2000);
                    catLights.Value = false;
                }
            });


            finalBeam.WhenOutputChanges(x =>
            {
                if (x && hoursSmall.IsOpen)
                {
                    Exec.Execute(finalSeq);
                }
                //                    lightning1.Brightness = x ? 1.0 : 0.0;
                //if (x)
                //{
                //    Exec.Execute(thunderSeq);
                //}
            });

            firstBeam.WhenOutputChanges(x =>
            {
                if (x && hoursSmall.IsOpen)
                {
                    //                    Exec.Execute(reaperSeq);
                    if (stateMachine.CurrentState == States.Background ||
                        stateMachine.CurrentState == States.StepForward)
                    {
                        stateMachine.SetState(States.Stair);
                    }
                }
            });

            buttonTest2.WhenOutputChanges(x =>
            {
                if (x)
                {
                    audioOla.NextBackgroundTrack();
                    //                        Exec.Execute(georgeSeq);
                }
            });

            raspberryOla.AudioTrackStart.Subscribe(x =>
            {
                // Next track
                switch (x)
                {
                case "12 Fear of the Dark":
                    // Do nothing
                    break;

                case "Thunder1":
                    timelineThunder1.Start();
                    break;

                case "Thunder2":
                    timelineThunder2.Start();
                    break;

                case "Thunder3":
                    timelineThunder3.Start();
                    break;

                case "Thunder4":
                    timelineThunder4.Start();
                    break;

                case "Thunder5":
                    timelineThunder5.Start();
                    break;

                case "Thunder6":
                    timelineThunder6.Start();
                    break;

                case "Thunder7":
                    timelineThunder7.Start();
                    break;

                case "Thunder8":
                    timelineThunder8.Start();
                    break;
                }
            });

            buttonTest4.WhenOutputChanges(x =>
            {
                if (x)
                {
                    audioOla.PlayEffect("125919__klankbeeld__horror-what-are-you-doing-here-cathedral");
                }
                //                        Exec.Execute(reaperSeq);
                //                    lightning2.Brightness = x ? 1.0 : 0.0;
                //                    if (x)
                //                        popOut1.Pop(1.0);
                //                    if (x)
                //                    lightStairs1.Brightness = x ? 1.0 : 0.0;
                //                    testLight3.Brightness = x ? 1.0 : 0.0;
                //                        audioSpider.PlayEffect("348 Spider Hiss");
                //                    Exec.Execute(thunderSeq);
            });

            buttonTest3.WhenOutputChanges(x =>
            {
                //                fog.Power = x;
                if (x)
                {
                    Exec.Execute(reaperPopSeq);

                    //for (int i = 0; i < 100; i++)
                    //{
                    //    raspberryReaper.Test(i);
                    //}
                }
                //                    audioGeorge.PlayEffect("242004__junkfood2121__fart-01");
            });

            raspberryReaper.DigitalOutputs[7].Connect(reaperPopUp);
            raspberryReaper.DigitalOutputs[6].Connect(reaperEyes);
            raspberryReaper.DigitalOutputs[5].Connect(skullEyes);

            forceOpen.WhenOutputChanges(x =>
            {
                if (x)
                {
                    hoursSmall.SetForced(true);
                }
                else
                {
                    hoursSmall.SetForced(null);
                }
            });

            inputH.WhenOutputChanges(x =>
            {
                movingHead.SetOnlyColor(HSV.ColorFromHSV(x.Value.GetByteScale(), inputS.Value, 1.0));
            });

            inputS.Output.Subscribe(x =>
            {
                movingHead.SetOnlyColor(HSV.ColorFromHSV(inputH.Value.GetByteScale(), x.Value, 1.0));
            });

            inputStrobe.Output.Controls(x => movingHead.StrobeSpeed = x);

            //midiInput.Controller(midiChannel, 1).Controls(inputBrightness.Control);
            //midiInput.Controller(midiChannel, 2).Controls(inputH.Control);
            //midiInput.Controller(midiChannel, 3).Controls(inputS.Control);
            //midiInput.Controller(midiChannel, 4).Controls(inputStrobe.Control);

            //midiInput.Controller(midiChannel, 5).Controls(Observer.Create<double>(x =>
            //    {
            //        inputPan.Control.OnNext(new DoubleZeroToOne(x * 540));
            //    }));
            //midiInput.Controller(midiChannel, 6).Controls(Observer.Create<double>(x =>
            //{
            //    inputTilt.Control.OnNext(new DoubleZeroToOne(x * 270));
            //}));

            //midiInput.Note(midiChannel, 36).Controls(buttonTest1.Control);
            //midiInput.Note(midiChannel, 37).Controls(buttonTest2.Control);
            //midiInput.Note(midiChannel, 38).Controls(buttonTest3.Control);
            //midiInput.Note(midiChannel, 39).Controls(buttonTest4.Control);

            //midiInput.Note(midiChannel, 40).Controls(buttonCatTrigger.Control);


            //buttonTest4.Output.Subscribe(x =>
            //    {
            //        if (x)
            //        {
            //            audioOla.NextBackgroundTrack();
            //        }
            //    });

            manualHeadMovement.Output.Subscribe(x =>
            {
                if (x)
                {
                    inputPan.Output.Controls(p => movingHead.Pan   = p.Value);
                    inputTilt.Output.Controls(t => movingHead.Tilt = t.Value);
                }
                else
                {
                    //                        inputPan.Output.Dis
                }
            });

            //            buttonTest2.Output.Subscribe(reaperPopUp.PowerControl);
            catMotion.Output.Subscribe(catLights.Control);

            /*
             *          finalBeam.Output.Subscribe(x =>
             *              {
             *                  lightning1.Brightness = x ? 1.0 : 0.0;
             *              });
             */

            //            buttonTest1.Output.Subscribe(pulsatingEffect2.InputRun);

            //buttonTest1.Output.Subscribe(x =>
            //    {
            //        pulsatingEffect2.Start
            //        if(x)

            //        if (x)
            //        {
            //            movingHead.Brightness = 1;
            //            movingHead.Color = Color.Red;
            //            //                        testLight4.StrobeSpeed = 1.0;
            //        }
            //        else
            //        {
            //            movingHead.TurnOff();
            //        }
            //    });

            catMotion.Output.Subscribe(x =>
            {
                if (x && hoursSmall.IsOpen)
                {
                    Executor.Current.Execute(catSeq);
                }
            });

            buttonCatTrigger.Output.Subscribe(x =>
            {
                if (x)
                {
                    catLights.Value = true;
                    switch (random.Next(3))
                    {
                    case 0:
                        audioCat.PlayEffect("386 Demon Creature Growls");
                        break;

                    case 1:
                        audioCat.PlayEffect("348 Spider Hiss");
                        break;

                    case 2:
                        audioCat.PlayEffect("death-scream");
                        break;
                    }
                    Thread.Sleep(2000);
                    catLights.Value = false;
                }
            });

            buttonTest1.Output.Subscribe(x =>
            {
                if (x)
                {
                    audioOla.PlayTrack("12 Fear of the Dark");
                }

                //if(x)
                //    georgeMotor.SetVector(0.9, 0, S(15));

                //                deadEnd.Power = x;
            });

            //            hoursSmall.Output.Subscribe(catAir.InputPower);
            //            hoursSmall.Output.Subscribe(flickerEffect.InputRun);
            //hoursSmall.Output.Subscribe(pulsatingEffect1.InputRun);
            //hoursSmall.Output.Subscribe(pulsatingEffect2.InputRun);
            hoursSmall.Output.Subscribe(lightTree.Control);

            hoursSmall.Output.Subscribe(x =>
            {
                if (x)
                {
                    stateMachine.SetBackgroundState(States.Background);
                    stateMachine.SetState(States.Background);
                }
                else
                {
                    stateMachine.Hold();
                    stateMachine.SetBackgroundState(null);
                }
            });

            timelineThunder1.AddMs(500, "A");
            timelineThunder1.AddMs(3500, "B");
            timelineThunder1.AddMs(4500, "C");
            timelineThunder1.TimelineTrigger += TriggerThunderTimeline;

            timelineThunder2.AddMs(500, "A");
            timelineThunder2.AddMs(1500, "B");
            timelineThunder2.AddMs(1600, "C");
            timelineThunder2.AddMs(3700, "C");
            timelineThunder2.TimelineTrigger += TriggerThunderTimeline;

            timelineThunder3.AddMs(100, "A");
            timelineThunder3.AddMs(200, "B");
            timelineThunder3.AddMs(300, "C");
            timelineThunder3.TimelineTrigger += TriggerThunderTimeline;

            timelineThunder4.AddMs(0, "A");
            timelineThunder4.AddMs(3500, "B");
            timelineThunder4.AddMs(4500, "C");
            timelineThunder4.TimelineTrigger += TriggerThunderTimeline;

            timelineThunder5.AddMs(1100, "A");
            timelineThunder5.AddMs(3500, "B");
            timelineThunder5.AddMs(4700, "C");
            timelineThunder5.TimelineTrigger += TriggerThunderTimeline;

            timelineThunder6.AddMs(1000, "A");
            timelineThunder6.AddMs(1800, "B");
            timelineThunder6.AddMs(6200, "C");
            timelineThunder6.TimelineTrigger += TriggerThunderTimeline;

            timelineThunder7.AddMs(0, "A");
            timelineThunder7.AddMs(200, "B");
            timelineThunder7.AddMs(300, "C");
            timelineThunder7.TimelineTrigger += TriggerThunderTimeline;

            timelineThunder8.AddMs(500, "A");
            timelineThunder8.AddMs(4000, "B");
            timelineThunder8.AddMs(4200, "C");
            timelineThunder8.TimelineTrigger += TriggerThunderTimeline;

            stateMachine.ForFromSequence(States.Background, backgroundSeq);
            stateMachine.ForFromSequence(States.Stair, reaperSeq);
            stateMachine.ForFromSequence(States.George, georgeSeq);
            stateMachine.ForFromSequence(States.StepForward, stepForwardSeq);


            georgeSeq.WhenExecuted
            .Execute(instance =>
            {
                var controlPan  = new Effect.Fader(S(3.8), 106, 150, false);
                var controlTilt = new Effect.Fader(S(3.8), 231.8823531, 168.3529407, false);

                controlPan.ConnectTo(x => movingHead.Pan   = x);
                controlTilt.ConnectTo(x => movingHead.Tilt = x);

                controlPan.Prime();
                controlTilt.Prime();
                movingHead.Brightness = 0;
                // Make sure George isn't moving
                georgeMotor.WaitForVectorReached();

                instance.WaitFor(S(1.5));

                controlPan.Start();
                controlTilt.Start();

                georgeMotor.SetVector(1.0, 450, S(10));
                instance.WaitFor(S(1.2));
                movingHead.SetColor(Color.Red, 0.1);
                instance.WaitFor(S(1.0));
                audioGeorge.PlayEffect("162 Blood Curdling Scream of Terror");
                georgeMotor.WaitForVectorReached();

                instance.WaitFor(S(4));
                movingHead.Brightness = 0;

                georgeMotor.SetVector(0.9, 0, S(15));
                movingHead.Pan  = 106;
                movingHead.Tilt = 31;
                //georgeMotor.WaitForVectorReached();

                //                        deadEnd.Power = true;
                instance.WaitFor(S(0.5));
                //                        deadEnd.Power = false;
                //                        Exec.Execute(thunderSeq);
                stateMachine.NextState();
            });

            stepForwardSeq.WhenExecuted
            .SetUp(() =>
            {
                audioOla.PlayTrack("152 Haunted Castle");
                candySpot.SetOnlyColor(Color.Green);
                pulsatingEffect1.Start();
                pulsatingEffect2.Start();
            })
            .Execute(i =>
            {
                i.WaitFor(S(30.0));
            })
            .TearDown(() =>
            {
                audioOla.PauseTrack();
                pulsatingEffect1.Stop();
                pulsatingEffect2.Stop();
            });

            reaperSeq.WhenExecuted
            .SetUp(() =>
            {
                flickerEffect.Stop();
                pulsatingEffect2.Stop();
            })
            .Execute(instance =>
            {
                //                    switchFog.SetPower(true);
                //                    this.lastFogRun = DateTime.Now;
                //                    Executor.Current.Execute(deadendSeq);
                //                    audioGeorge.PlayEffect("ghostly");
                //                    instance.WaitFor(S(0.5));
                //                    popOutEffect.Pop(1.0);

                //                    instance.WaitFor(S(1.0));



                movingHead.Pan  = 106;
                movingHead.Tilt = 31;
                fog.Value       = true;
                this.lastFogRun = DateTime.Now;
                instance.WaitFor(S(0.05));
                audioReaper.PlayEffect("348 Spider Hiss", 1.0, 0.0);
                instance.WaitFor(S(0.05));
                spiderEyes1.Value = true;
                instance.WaitFor(S(0.5));

                movingHead.SetColor(Color.Turquoise, 0.2);
                movingHead.StrobeSpeed = 0.8;

                deadEnd.Value = true;
                instance.WaitFor(S(0.3));
                deadEnd.Value = false;

                instance.WaitFor(S(2.5));
                movingHead.StrobeSpeed = 0;
                movingHead.Brightness  = 0;

                movingHead.Pan  = 80;
                movingHead.Tilt = 26;
                instance.WaitFor(S(1.0));
                audioReaper.PlayNewEffect("laugh", 0.0, 1.0);
                instance.WaitFor(S(0.1));
                spiderEyes1.Value       = false;
                reaperPopUp.Value       = true;
                reaperLight.Color       = Color.Red;
                reaperLight.Brightness  = 1;
                reaperLight.StrobeSpeed = 1;
                instance.WaitFor(S(0.5));
                reaperEyes.Value = true;
                instance.WaitFor(S(2.0));

                reaperPopUp.Value = false;
                reaperEyes.Value  = false;
                reaperLight.TurnOff();
                instance.WaitFor(S(2.0));
                audioOla.PlayEffect("424 Coyote Howling", 0.0, 1.0);
                audioGeorge.PlayEffect("424 Coyote Howling");
                movingHead.SetColor(Color.Orange, 0.2);
                instance.WaitFor(S(2.0));
                spiderEyes2.Value = true;
                popOut2.Pop(0.4);
                audioGeorge.PlayEffect("348 Spider Hiss");
                audioReaper.PlayEffect("348 Spider Hiss");

                movingHead.Brightness  = 0.7;
                movingHead.Color       = Color.Red;
                movingHead.StrobeSpeed = 0.8;
                movingHead.Pan         = 51;
                movingHead.Tilt        = 61;
                instance.WaitFor(S(2.0));
                movingHead.StrobeSpeed = 0.0;
                movingHead.Brightness  = 0;
                spiderEyes2.Value      = false;
                instance.WaitFor(S(2.0));

                movingHead.Pan  = 106;
                movingHead.Tilt = 231;

                stateMachine.NextState();
            })
            .TearDown(() =>
            {
                flickerEffect.Start();
                pulsatingEffect2.Start();
                fog.Value = false;
            });

            reaperPopSeq.WhenExecuted
            .Execute(instance =>
            {
                audioReaper.PlayNewEffect("laugh", 0.0, 1.0);
                instance.WaitFor(S(0.1));
                reaperPopUp.Value       = true;
                reaperLight.Color       = Color.Red;
                reaperLight.Brightness  = 1;
                reaperLight.StrobeSpeed = 1;
                instance.WaitFor(S(0.5));
                reaperEyes.Value = true;
                instance.WaitFor(S(2.0));

                reaperPopUp.Value = false;
                reaperEyes.Value  = false;
                reaperLight.TurnOff();
                instance.WaitFor(S(0.5));
            });

            finalSeq.WhenExecuted
            .SetUp(() =>
            {
                audioOla.PauseTrack();
                pulsatingEffect1.Stop();
                pulsatingEffect2.Stop();
            })
            .Execute(i =>
            {
                skullEyes.Value = true;
                candySpot.SetColor(Color.Red);

                i.WaitFor(S(1.0));
                lightBehindHeads.SetOnlyColor(Color.White);
                popOutBehindHeads.Pop(1.0);
                audioOla.PlayEffect("125919__klankbeeld__horror-what-are-you-doing-here-cathedral", 0.0, 0.7);
                i.WaitFor(S(10));
            })
            .TearDown(() =>
            {
                audioOla.PlayBackground();
                skullEyes.Value = false;
                candySpot.SetOnlyColor(Color.Green);
                pulsatingEffect1.Start();
                pulsatingEffect2.Start();
                //                        candySpot.SetColor(Color.Green);

                //                        audioOla.PlayBackground();

                if (stateMachine.CurrentState == States.StepForward)
                {
                    stateMachine.SetState(States.Background);
                }
            });

            thunderSeq.WhenExecuted
            .SetUp(() =>
            {
                audioOla.PauseBackground();
                //                        movingHead.Pan = 0.25;
                //                        movingHead.Tilt = 0.5;
                Thread.Sleep(200);
            })
            .Execute(i =>
            {
                audioOla.PlayTrack("08 Weather-lightning-strike2");
                //                        movingHead.SetOnlyColor(Color.White);
                popOut1.Pop(1.0);
                popOut2.Pop(1.0);
                popOut3.Pop(1.0);

                i.WaitFor(S(4));
            })
            .TearDown(() =>
            {
                audioOla.PauseTrack();
                audioOla.PlayBackground();
            });

            backgroundSeq.WhenExecuted
            .SetUp(() =>
            {
                audioOla.NextBackgroundTrack();
                flickerEffect.Start();
                pulsatingEffect1.Start();
                pulsatingEffect2.Start();
            })
            .Execute(i =>
            {
                while (!i.IsCancellationRequested)
                {
                    i.WaitFor(S(1));
                    if (!this.lastFogRun.HasValue || (DateTime.Now - this.lastFogRun.Value).TotalMinutes > 10)
                    {
                        // Run the fog for a little while
                        fog.Value = true;
                        i.WaitFor(S(4));
                        fog.Value       = false;
                        this.lastFogRun = DateTime.Now;
                    }
                }
            })
            .TearDown(() =>
            {
                flickerEffect.Stop();
                pulsatingEffect1.Stop();
                pulsatingEffect2.Stop();
                audioOla.PauseTrack();
                audioOla.PauseBackground();
            });

            catSeq.WhenExecuted
            .Execute(instance =>
            {
                var maxRuntime = System.Diagnostics.Stopwatch.StartNew();

                catLights.Value = true;

                while (true)
                {
                    switch (random.Next(4))
                    {
                    case 0:
                        audioCat.PlayEffect("266 Monster Growl 7", 1.0, 1.0);
                        instance.WaitFor(TimeSpan.FromSeconds(2.0));
                        break;

                    case 1:
                        audioCat.PlayEffect("285 Monster Snarl 2", 1.0, 1.0);
                        instance.WaitFor(TimeSpan.FromSeconds(3.0));
                        break;

                    case 2:
                        audioCat.PlayEffect("286 Monster Snarl 3", 1.0, 1.0);
                        instance.WaitFor(TimeSpan.FromSeconds(2.5));
                        break;

                    case 3:
                        audioCat.PlayEffect("287 Monster Snarl 4", 1.0, 1.0);
                        instance.WaitFor(TimeSpan.FromSeconds(1.5));
                        break;

                    default:
                        instance.WaitFor(TimeSpan.FromSeconds(3.0));
                        break;
                    }

                    instance.CancelToken.ThrowIfCancellationRequested();

                    if (maxRuntime.Elapsed.TotalSeconds > 10)
                    {
                        break;
                    }
                }
            })
            .TearDown(() =>
            {
                catLights.Value = false;
            });
        }
Ejemplo n.º 5
0
        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;
                }
            };
        }
Ejemplo n.º 6
0
        public XmasScene2(IEnumerable <string> args, System.Collections.Specialized.NameValueCollection settings)
        {
            hours = new OperatingHours("Hours");
            if (!args.Contains("TEST"))
            {
                hours.AddRange("5:00 pm", "10:00 pm");
                hours.AddRange("5:00 am", "7:00 am");
            }

            lightNetRight     = new Dimmer("Net Right");
            lightGarlandRight = new Dimmer("Garland Right");
            lightHatsRight    = new Dimmer("Hats Right");
            lightTreesRight   = new Dimmer("Trees Right");
            lightReindeers    = new Dimmer("Reindeers");
            lightIcicles      = new Dimmer("Icicles");
            lightNetLeft      = new Dimmer("Net Left");
            lightTree         = new Dimmer("Tree");
            lightGarlandLeft  = new Dimmer("Garland Left");
            lightUnused1      = new Dimmer("Unused 1");
            lightUnused2      = new Dimmer("Unused 2");
            lightJesus        = new StrobeColorDimmer("Jesus");
            lightCeiling1     = new StrobeColorDimmer("Ceiling 1");
            lightCeiling2     = new StrobeColorDimmer("Ceiling 2");
            lightCeiling3     = new StrobeColorDimmer("Ceiling 3");
            lightVader        = new StrobeColorDimmer("Vader");
            buttonLightRed    = new Switch("Button Red");
            buttonLightBlue   = new Switch("Button Blue");
            elLightsaber      = new Switch("Lightsaber");
            elJesus           = new Switch("Jesus Halo");
            bigReindeer       = new Switch("Big Reindeer");

            buttonBlue          = new DigitalInput("Button Blue");
            buttonRed           = new DigitalInput("Button Red");
            buttonStartReindeer = new DigitalInput("Start Reindeer");

            timeline       = new Controller.Timeline <string>(1);
            stateMachine   = new Controller.EnumStateMachine <States>("Main");
            candyCane      = new Controller.Sequence("Candy Cane");
            starwarsCane   = new Controller.Sequence("Starwars Cane");
            backgroundLoop = new Controller.Sequence("Background");
            musicSeq       = new Controller.Sequence("Christmas Canon");
            buttonSeq      = new Controller.Sequence("Buttons");
            fatherSeq      = new Controller.Sequence("Father");
            breathSeq      = new Controller.Sequence("Breath");
            laserSeq       = new Controller.Sequence("Laser");

            allPixels = new VirtualPixel1D(100);

            pulsatingEffect1 = new Effect.Pulsating(S(2), 0.3, 1.0, false);
            pulsatingEffect2 = new Effect.Pulsating(S(2), 0.3, 1.0, false);

            popOutPiano     = new Effect.PopOut(S(0.4));
            popOutDrums     = new Effect.PopOut(S(0.4));
            popOutDrumsFast = new Effect.PopOut(S(0.3));
            popOutChord     = new Effect.PopOut(S(0.4));
            popOutSolo      = new Effect.PopOut(S(0.3));
            popOutSolo2     = new Effect.PopOut(S(0.2));
            popOutChoir     = new Effect.PopOut(S(1.0));
            popOutVoice     = new Effect.PopOut(S(1.0));
            popOutVocal2    = new Effect.PopOut(S(2.0));
            popOutVocalLong = new Effect.PopOut(S(5.0));
            popOutEnd       = new Effect.PopOut(S(5.0));

            popOutPiano
            .AddDevice(lightIcicles);

            popOutDrums
            .AddDevice(lightReindeers)
            .AddDevice(lightHatsRight);

            popOutDrumsFast
            .AddDevice(lightCeiling1)
            .AddDevice(allPixels);

            popOutChord
            .AddDevice(lightTree)
            .AddDevice(lightCeiling2)
            .AddDevice(lightCeiling3);

            popOutSolo
            .AddDevice(lightNetLeft)
            .AddDevice(lightNetRight)
            .AddDevice(lightCeiling1)
            .AddDevice(lightCeiling3)
            .SetPriority(2);

            popOutSolo2
            .AddDevice(lightCeiling1)
            .AddDevice(lightCeiling3)
            .SetPriority(2);

            popOutChoir
            .AddDevice(lightGarlandRight)
            .AddDevice(lightTreesRight)
            .AddDevice(lightCeiling1);

            popOutVoice
            .AddDevice(lightGarlandLeft)
            .AddDevice(lightCeiling3);

            popOutVocal2
            .AddDevice(lightReindeers)
            .AddDevice(allPixels)
            .SetPriority(10);

            popOutVocalLong
            .AddDevice(lightNetRight)
            .AddDevice(lightGarlandRight)
            .AddDevice(lightHatsRight)
            .SetPriority(10);

            popOutEnd
            .AddDevice(lightIcicles)
            .AddDevice(lightReindeers)
            .AddDevice(lightHatsRight)
            .AddDevice(lightCeiling1)
            .AddDevice(lightCeiling2)
            .AddDevice(lightCeiling3)
            .AddDevice(lightGarlandRight)
            .AddDevice(lightGarlandLeft)
            .AddDevice(lightTreesRight)
            .AddDevice(lightNetRight)
            .AddDevice(lightNetLeft)
            .AddDevice(allPixels)
            .SetPriority(100);


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

            timeline.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":
                    popOutPiano.Pop(0.4);
                    if (state == 0)
                    {
                        allPixels.Inject(Color.Red, 0.5);
                    }
                    break;

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

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

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

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

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

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

                case "Solo":
                    popOutSolo.Pop(1.0);
                    if ((halfSolo++ % 2) == 0)
                    {
                        popOutSolo2.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":
                    popOutChoir.Pop(1.0);
                    break;

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

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

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

                case "LongUp":
                    // TODO
                    break;

                case "Down":
                    // TODO
                    break;

                case "End":
                    EverythingOff();
                    popOutEnd.Pop(1.0);
                    break;

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

            audioPlayer = new Physical.NetworkAudioPlayer(
                settings["NetworkAudioPlayerIP"],
                int.Parse(settings["NetworkAudioPlayerPort"]));
        }
        public override void Start()
        {
            hoursSmall.AddRange("5:00 pm", "9:00 pm");
            hoursFull.AddRange("5:00 pm", "9:00 pm");
            //hoursFull.SetForced(true);
            //hoursSmall.SetForced(true);
            //hoursFull.SetForced(false);
            //hoursSmall.SetForced(false);

#if !true
            hoursFull.SetForced(true);

            audioBeauty.SetSilent(true);
            audioCat.SetSilent(true);
            audioGeorge.SetSilent(true);
            audioSpider.SetSilent(true);
            georgeMotor.SetDisabled(true);
#endif
            var backgroundSeq = new Controller.Sequence("BG Sequence");
            backgroundSeq.WhenExecuted
            .SetUp(() =>
            {
                audioGeorge.PlayBackground();
                lightFloor.SetOnlyColor(Color.Orange);
                pulsatingEffect1.Start();
                flickerEffect.Start();
            })
            .Execute(instance =>
            {
                while (!instance.IsCancellationRequested)
                {
                    instance.WaitFor(S(1));
                    if (!this.lastFogRun.HasValue || (DateTime.Now - this.lastFogRun.Value).TotalMinutes > 10)
                    {
                        // Run the fog for a little while
                        switchFog.SetPower(true);
                        instance.WaitFor(S(4));
                        switchFog.SetPower(false);
                        this.lastFogRun = DateTime.Now;
                    }
                }
            })
            .TearDown(() =>
            {
                audioGeorge.PauseBackground();
                pulsatingEffect1.Stop();
                flickerEffect.Stop();
            });

            var deadendSeq = new Controller.Sequence("Deadend dr");
            deadendSeq.WhenExecuted
            .Execute(instance =>
            {
                switchDeadendDrive.SetPower(true);
                Thread.Sleep(1000);
                switchDeadendDrive.SetPower(false);
            });

            var stairSeq = new Controller.Sequence("Stair Sequence");
            stairSeq.WhenExecuted
            .SetUp(() =>
            {
            })
            .Execute(instance =>
            {
                switchFog.SetPower(true);
                this.lastFogRun = DateTime.Now;
                Executor.Current.Execute(deadendSeq);
                audioGeorge.PlayEffect("ghostly");
                instance.WaitFor(S(0.5));
                popOutEffect.Pop(1.0);

                instance.WaitFor(S(1.0));
                audioSpider.PlayNewEffect("348 Spider Hiss");
                switchSpider.SetPower(true);
                instance.WaitFor(S(0.5));
                switchSpiderEyes1.SetPower(true);
                instance.WaitFor(S(2));
                switchSpider.SetPower(false);
                switchSpiderEyes1.SetPower(false);
                instance.WaitFor(S(4));
                stateMachine.NextState();
            })
            .TearDown(() =>
            {
                switchFog.SetPower(false);
                audioGeorge.PauseFX();
            });

            var georgeReturnSeq = new Controller.Sequence("George Return Seq");
            georgeReturnSeq.WhenExecuted
            .Execute(instance =>
            {
                georgeMotor.WaitForVectorReached();
                georgeMotor.SetVector(0.9, 0, S(15));
                georgeMotor.WaitForVectorReached();
            });

            var georgeSeq = new Controller.Sequence("George Sequence");
            georgeSeq.WhenExecuted
            .Execute(instance =>
            {
                //Exec.WaitUntilFinished(georgeReturnSeq);

                audioGeorge.PlayEffect("laugh");
                georgeMotor.SetVector(1.0, 350, S(10));
                instance.WaitFor(TimeSpan.FromSeconds(0.8));
                lightGeorge.SetColor(Color.Red);
                georgeMotor.WaitForVectorReached(instance);
                instance.WaitFor(TimeSpan.FromSeconds(2));
                georgeMotor.SetVector(0.9, 0, S(15));
                lightGeorge.RunEffect(new Effect2.Fader(1.0, 0.0), S(1.0));
                instance.WaitFor(TimeSpan.FromSeconds(1));
                lightFloor.SetOnlyColor(Color.Green);
                pulsatingEffect1.Start();
                georgeMotor.WaitForVectorReached(instance);

                instance.WaitFor(S(15));
            })
            .TearDown(() =>
            {
                Exec.Execute(georgeReturnSeq);
                pulsatingEffect1.Stop();
                lightGeorge.TurnOff();
            });

            var spiderEyes2Seq = new Controller.Sequence("Spider Eyes 2");
            spiderEyes2Seq.WhenExecuted
            .Execute(instance =>
            {
                var rnd = new Random();
                while (!instance.IsCancellationRequested)
                {
                    switchSpiderEyes2.SetPower(true);
                    instance.WaitFor(S(1.0 + rnd.Next(10)));
                    switchSpiderEyes2.SetPower(false);
                    instance.WaitFor(S(1.0 + rnd.Next(2)));
                }
            });

            var popupSeq = new Controller.Sequence("Popup Sequence");
            popupSeq.WhenExecuted
            .Execute(instance =>
            {
                audioBeauty.PlayEffect("scream", 0.0, 1.0);
                switchPopEyes.SetPower(true);
                instance.WaitFor(TimeSpan.FromSeconds(1.0));
                lightPopup.SetBrightness(1.0);
                switchPopUp.SetPower(true);

                instance.WaitFor(S(3));

                lightPopup.RunEffect(new Effect2.Fader(1.0, 0.0), S(1.0));
                switchPopEyes.TurnOff();
                switchPopUp.TurnOff();
            });

            var beautySeq = new Controller.Sequence("Beauty Sequence");
            beautySeq.WhenExecuted
            .Execute(instance =>
            {
                flickerEffect2.Stop();
                lightBeauty.SetColor(Color.Purple);
                switchHand.SetPower(true);
                instance.WaitFor(TimeSpan.FromSeconds(1));
                audioBeauty.PlayEffect("gollum_precious1", 1.0, 0.0);
                instance.WaitFor(TimeSpan.FromSeconds(0.4));
                switchHead.SetPower(true);
                instance.WaitFor(TimeSpan.FromSeconds(6));
                switchHead.SetPower(false);
                switchHand.SetPower(false);

                instance.WaitFor(TimeSpan.FromSeconds(1.5));
                lightBeauty.TurnOff();
                instance.WaitFor(TimeSpan.FromSeconds(0.5));
                switchDrawer1.SetPower(true);
                switchHead.SetPower(true);
                instance.WaitFor(TimeSpan.FromSeconds(0.5));
                lightBeauty.SetColor(Color.Red, 1.0);
                audioBeauty.PlayEffect("my_pretty", 1.0, 0.0);
                instance.WaitFor(TimeSpan.FromSeconds(4));
                switchDrawer2.SetPower(true);
                instance.WaitFor(TimeSpan.FromSeconds(2));
                switchDrawer1.SetPower(false);
                instance.WaitFor(TimeSpan.FromSeconds(0.15));
                switchDrawer2.SetPower(false);
                instance.WaitFor(TimeSpan.FromSeconds(1));

                switchHead.SetPower(false);
                lightBeauty.RunEffect(new Effect2.Fader(1.0, 0.0), S(1.0));
                if (hoursSmall.IsOpen)
                {
                    flickerEffect2.Start();
                }
                instance.WaitFor(TimeSpan.FromSeconds(5));
            });


            var catSeq = new Controller.Sequence("Cat Sequence");
            catSeq.WhenExecuted
            .Execute(instance =>
            {
                var maxRuntime = System.Diagnostics.Stopwatch.StartNew();

                var random = new Random();

                catLights.SetPower(true);

                while (true)
                {
                    switch (random.Next(4))
                    {
                    case 0:
                        audioCat.PlayEffect("266 Monster Growl 7", 1.0, 1.0);
                        instance.WaitFor(TimeSpan.FromSeconds(2.0));
                        break;

                    case 1:
                        audioCat.PlayEffect("285 Monster Snarl 2", 1.0, 1.0);
                        instance.WaitFor(TimeSpan.FromSeconds(3.0));
                        break;

                    case 2:
                        audioCat.PlayEffect("286 Monster Snarl 3", 1.0, 1.0);
                        instance.WaitFor(TimeSpan.FromSeconds(2.5));
                        break;

                    case 3:
                        audioCat.PlayEffect("287 Monster Snarl 4", 1.0, 1.0);
                        instance.WaitFor(TimeSpan.FromSeconds(1.5));
                        break;

                    default:
                        instance.WaitFor(TimeSpan.FromSeconds(3.0));
                        break;
                    }

                    instance.CancelToken.ThrowIfCancellationRequested();

                    if (maxRuntime.Elapsed.TotalSeconds > 10)
                    {
                        break;
                    }
                }
            })
            .TearDown(() =>
            {
                catLights.TurnOff();
            });

            var candyCane = new Controller.Sequence("Candy Cane");
            candyCane
            .WhenExecuted
            .SetUp(() => allPixels.TurnOff())
            .Execute(instance =>
            {
                var cbList = new List <ColorBrightness>();
                //cbList.Add(new ColorBrightness(Color.Green, 1.00));
                //cbList.Add(new ColorBrightness(Color.Green, 0.70));
                //cbList.Add(new ColorBrightness(Color.Green, 0.40));
                //cbList.Add(new ColorBrightness(Color.White, 1.00));
                //cbList.Add(new ColorBrightness(Color.White, 0.70));
                //cbList.Add(new ColorBrightness(Color.White, 0.40));
                //cbList.Add(new ColorBrightness(Color.Red, 1.00));
                //cbList.Add(new ColorBrightness(Color.Red, 0.70));
                //cbList.Add(new ColorBrightness(Color.Red, 0.40));
                //cbList.Add(new ColorBrightness(Color.Black, 0.0));
                //cbList.Add(new ColorBrightness(Color.Black, 0.0));
                //cbList.Add(new ColorBrightness(Color.Black, 0.0));
                //cbList.Add(new ColorBrightness(Color.Black, 0.0));

                double b1 = 1.00;
                double b2 = 0.70;
                double b3 = 0.40;
                Color c1  = Color.Blue;
                Color c2  = Color.Yellow;
                Color c3  = Color.Blue;
                Color c4  = Color.Black;

                cbList.Add(new ColorBrightness(c1, b1));
                cbList.Add(new ColorBrightness(c1, b2));
                cbList.Add(new ColorBrightness(c1, b3));
                cbList.Add(new ColorBrightness(c2, b1));
                cbList.Add(new ColorBrightness(c2, b2));
                cbList.Add(new ColorBrightness(c2, b3));
                cbList.Add(new ColorBrightness(c3, b1));
                cbList.Add(new ColorBrightness(c3, b2));
                cbList.Add(new ColorBrightness(c3, b3));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));

                b1 = 1.00;
                b2 = 0.70;
                b3 = 0.40;
                c1 = Color.White;
                c2 = Color.Blue;
                c3 = Color.Red;
                c4 = Color.Black;

                cbList.Add(new ColorBrightness(c1, b1));
                cbList.Add(new ColorBrightness(c1, b2));
                cbList.Add(new ColorBrightness(c1, b3));
                cbList.Add(new ColorBrightness(c2, b1));
                cbList.Add(new ColorBrightness(c2, b2));
                cbList.Add(new ColorBrightness(c2, b3));
                cbList.Add(new ColorBrightness(c3, b1));
                cbList.Add(new ColorBrightness(c3, b2));
                cbList.Add(new ColorBrightness(c3, b3));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));

                b1 = 1.00;
                b2 = 0.70;
                b3 = 0.40;
                c1 = Color.Red;
                c2 = Color.White;
                c3 = Color.Blue;
                c4 = Color.Black;

                cbList.Add(new ColorBrightness(c1, b1));
                cbList.Add(new ColorBrightness(c1, b2));
                cbList.Add(new ColorBrightness(c1, b3));
                cbList.Add(new ColorBrightness(c2, b1));
                cbList.Add(new ColorBrightness(c2, b2));
                cbList.Add(new ColorBrightness(c2, b3));
                cbList.Add(new ColorBrightness(c3, b1));
                cbList.Add(new ColorBrightness(c3, b2));
                cbList.Add(new ColorBrightness(c3, b3));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));

                while (true)
                {
                    foreach (var cb in cbList)
                    {
                        allPixels.Inject(cb);
                        instance.WaitFor(S(0.350), true);
                    }
                }
            })
            .TearDown(() =>
            {
                allPixels.TurnOff();
            });


            stateMachine.ForFromSequence(States.Background, backgroundSeq);
            stateMachine.ForFromSequence(States.Stair, stairSeq);
            stateMachine.ForFromSequence(States.George, georgeSeq);
            stateMachine.ForFromSequence(States.Popup, popupSeq);

            hoursSmall.OpenHoursChanged += (sender, e) =>
            {
                if (e.IsOpenNow)
                {
                    pulsatingEffect2.Start();
                    flickerEffect.Start();
                    flickerEffect2.Start();
                    catFan.SetPower(true);
                    lightEyes.SetPower(true);
                    lightTreeGhost.SetBrightness(1.0);
                    //                        Exec.Execute(candyCane);
                    allPixels.SetAll(Color.FromArgb(255, 115, 0), 0.5);
                }
                else
                {
                    pulsatingEffect2.Stop();
                    flickerEffect.Stop();
                    flickerEffect2.Stop();
                    catFan.SetPower(false);
                    lightEyes.SetPower(false);
                    lightTreeGhost.TurnOff();
                    allPixels.TurnOff();
                }
            };

            hoursFull.OpenHoursChanged += (sender, e) =>
            {
                if (e.IsOpenNow)
                {
                    Executor.Current.Execute(spiderEyes2Seq);
                    stateMachine.SetBackgroundState(States.Background);
                    stateMachine.SetState(States.Background);
                }
                else
                {
                    Executor.Current.Cancel(spiderEyes2Seq);
                    stateMachine.Hold();
                    stateMachine.SetBackgroundState(null);
                    audioGeorge.PauseBackground();
                }
            };

            buttonMotionCat.ActiveChanged += (sender, e) =>
            {
#if CHECK_SENSOR_ALIGNMENT
                catLights.SetPower(e.NewState);
#else
                if (e.NewState && hoursSmall.IsOpen)
                {
                    Executor.Current.Execute(catSeq);
                }
#endif
            };

            buttonMotionBeauty.ActiveChanged += (sender, e) =>
            {
                if (e.NewState && hoursFull.IsOpen)
                {
                    Executor.Current.Execute(beautySeq);
                }
            };

            buttonTriggerStairs.ActiveChanged += (sender, e) =>
            {
                if (!hoursSmall.IsOpen)
                {
                    lightFloor.SetColor(Color.Purple, e.NewState ? 0.6 : 0.0);
                }
                else
                {
                    if (e.NewState && hoursFull.IsOpen)
                    {
                        if (!stateMachine.CurrentState.HasValue || stateMachine.CurrentState == States.Background)
                        {
                            stateMachine.SetState(States.Stair);
                        }
                    }
                }
            };

            buttonTriggerPopup.ActiveChanged += (sender, e) =>
            {
                if (!hoursSmall.IsOpen)
                {
                    lightPopup.SetBrightness(e.NewState ? 0.5 : 0.0);
                }
                else
                {
                    if (e.NewState)
                    {
                        if (stateMachine.CurrentState == States.George)
                        {
                            stateMachine.SetState(States.Popup);
                        }
                    }
                }
            };

            flickerEffect.AddDevice(skullsLight);
            flickerEffect2.AddDevice(skullsLight2);
            lightFloor.SetColor(Color.Orange, 0);
            lightSign.SetColor(Color.Pink, 0);
            pulsatingEffect1.AddDevice(lightFloor);
            pulsatingEffect1.AddDevice(lightSpiderWeb);
            pulsatingEffect2.AddDevice(lightSign);

            popOutEffect.AddDevice(skullsLight);

            ForTest();
        }