Load() public method

public Load ( string fileName, int triggerSyncOnUniverse ) : void
fileName string
triggerSyncOnUniverse int
return void
        //Expander.OpcClient opcOutput = new Expander.OpcClient("192.168.1.113");

        public PixelTest1(IEnumerable <string> args)
        {
            string expanderFilesFolder = string.Empty;
            string expFilesParam       = args.FirstOrDefault(x => x.StartsWith("EXPFILES"));

            if (!string.IsNullOrEmpty(expFilesParam))
            {
                string[] parts = expFilesParam.Split('=');
                if (parts.Length == 2)
                {
                    expanderFilesFolder = parts[1];
                }
            }

            blackOut.ConnectTo(Exec.Blackout);
            whiteOut.ConnectTo(Exec.Whiteout);

            dmxPlayback.Load(Path.Combine(expanderFilesFolder, "Seq", "XmasLoop.bin"), 15);
            dmxPlayback.Loop = true;

            //            var pixelMapping = dmxPlayback.GeneratePixelMapping(pixelsMatrix, 8, channelShift: 1);
            var pixelMapping = Framework.Utility.PixelMapping.GeneratePixelMappingFromGlediatorPatch(
                Path.Combine(expanderFilesFolder, "Glediator", "ArtNet 14-15 20x10.patch.glediator"));

            dmxPlayback.SetOutput(pixelsMatrix, pixelMapping);
            //dmxPlayback.SetOutput(pixelRope, pixelMapping);

            acnOutput.Connect(new Physical.Pixel1D(pixelRope, 0, 50), SacnUniverse6, 1);
            acnOutput.Connect(new Physical.Pixel1D(pixelRope, 50, 100), SacnUniverse5, 1);

            pixelMapping = Framework.Utility.PixelMapping.GeneratePixelMapping(20, 10, pixelOrder: Framework.Utility.PixelOrder.HorizontalSnakeBottomLeft);
            acnOutput.Connect(new Physical.Pixel2D(pixelsMatrix, pixelMapping), SacnUniverse10, 1);

            subStarWarsCane
            .LockWhenRunning(pixelRope)
            .RunAction(instance =>
            {
                const int spacing = 4;

                while (!instance.CancelToken.IsCancellationRequested)
                {
                    for (int i = 0; i < spacing; i++)
                    {
                        switch (i % spacing)
                        {
                        case 0:
                        case 1:
                            pixelRope.InjectRev(Color.Yellow, 1.0, instance.Token);
                            break;

                        case 2:
                        case 3:
                            pixelRope.InjectRev(Color.Orange, 0.2, instance.Token);
                            break;
                        }

                        instance.WaitFor(S(0.1));

                        if (instance.IsCancellationRequested)
                        {
                            break;
                        }
                    }
                }
            });

            subCandyCane
            .LockWhenRunning(pixelRope)
            .RunAction(i =>
            {
                const int spacing = 4;

                while (true)
                {
                    for (int x = 0; x < spacing; x++)
                    {
                        pixelRope.Inject((x % spacing) == 0 ? Color.Red : Color.White, 0.5, i.Token);

                        i.WaitFor(S(0.30), true);
                    }
                }
            });

            buttonTest.Output.Subscribe(x =>
            {
                if (x)
                {
                    Color rndCol = Color.FromArgb(random.Next(256), random.Next(256), random.Next(256));
                    pixelRope.Inject(rndCol, 1.0);

//FIXME                        pixelsMatrix.Inject(rndCol);
                }
            });

            buttonCane.Output.Subscribe(x =>
            {
                if (x)
                {
                    subStarWarsCane.Run();
                }
                else
                {
                    subStarWarsCane.Stop();
                }
            });

            buttonCandyCane.Output.Subscribe(x =>
            {
                if (x)
                {
                    subCandyCane.Run();
                }
                else
                {
                    subCandyCane.Stop();
                }
            });

            buttonPlayback.Output.Subscribe(x =>
            {
                if (x)
                {
                    dmxPlayback.Run();
                }
                else
                {
                    dmxPlayback.Stop();
                }
            });

            buttonFader.Output.Subscribe(x =>
            {
                if (x)
                {
                    Exec.MasterEffect.Fade(pixelsMatrix, 1.0, 0.0, 2000);
                }
                else
                {
                    Exec.MasterEffect.Fade(pixelsMatrix, 0.0, 1.0, 2000);
                }
            });

            buttonFader2.Output.Subscribe(x =>
            {
                if (x)
                {
                    Exec.MasterEffect.Fade(pixelsMatrix, 0.0, 1.0, 2000, additionalData: Utils.Data(Color.White));
                }
            });

            buttonClear.Output.Subscribe(x =>
            {
                if (x)
                {
                    pixelRope.SetColor(Color.Black, 0.0);
                    pixelsMatrix.SetColor(Color.Black, 0.0);
                }
            });

            pixelRope.SetBrightness(1);
        }
Beispiel #2
0
        public Xmas2015(IEnumerable <string> args)
        {
            hours.AddRange("4:00 pm", "10:00 pm");

            string expFilesParam = args.FirstOrDefault(x => x.StartsWith("EXPFILES"));

            if (!string.IsNullOrEmpty(expFilesParam))
            {
                string[] parts = expFilesParam.Split('=');
                if (parts.Length == 2)
                {
                    Exec.ExpanderSharedFiles = parts[1];
                }
            }

            pulsatingEffect1.ConnectTo(lightOlaf);
            pulsatingEffect2.ConnectTo(lightR2D2);
            pulsatingEffect3.ConnectTo(pixelsRoofEdge, Utils.Data(Color.Red));
            pulsatingEffect4.ConnectTo(lightBlueButton);
            pulsatingEffect4.ConnectTo(lightRedButton);

            expanderServer.AddInstance("ec30b8eda95b4c5cab46bf630d74810e", expanderLocal);
            expanderServer.AddInstance("ed86c3dc166f41ee86626897ba039ed2", expander1);      // rpi-eb0092ca
            expanderServer.AddInstance("10520fdcf14d47cba31da8b6e05d01d8", expander2);      // rpi-eb428ef1
            expanderServer.AddInstance("59ebb8e925c94182a0f6e0ef09180200", expander3);      // rpi-eba6cbc7
            expanderServer.AddInstance("1583f686014345888c15d7fc9c55ca3c", expander4);      // rpi-eb81c94e

            expander1.DigitalInputs[5].Connect(inR2D2);
            expander1.DigitalInputs[4].Connect(inOlaf);
            expander1.DigitalInputs[6].Connect(inShowMachine);
            expander1.DigitalOutputs[7].Connect(out1);
            expander4.DigitalOutputs[7].Connect(snowMachine);

            expander4.DigitalInputs[5].Connect(inBlueButton);
            expander4.DigitalInputs[4].Connect(inRedButton);

            expander1.Connect(audio1);
            expander2.Connect(audioMain);
            expander3.Connect(video3);
            expander4.Connect(audioDarthVader);

            blackOut.ConnectTo(Exec.Blackout);
            whiteOut.ConnectTo(Exec.Whiteout);

            midiAkai.Controller(midiChannel, 1).Subscribe(x => blackOut.Value = x.Value);
            midiAkai.Controller(midiChannel, 2).Subscribe(x => whiteOut.Value = x.Value);

            dmxPlayback.Load(Path.Combine(Exec.ExpanderSharedFiles, "Seq", "XmasLoop.bin"), 15);
            dmxPlayback.Loop = true;

            var pixelMapping = Framework.Utility.PixelMapping.GeneratePixelMappingFromGlediatorPatch(
                Path.Combine(Exec.ExpanderSharedFiles, "Glediator", "ArtNet 14-15 20x10.patch.glediator"));

            dmxPlayback.SetOutput(pixelsMatrix, pixelMapping);

            buttonOverrideHours.Output.Subscribe(x =>
            {
                if (x)
                {
                    hours.SetForced(true);
                }
                else
                {
                    hours.SetForced(null);
                }
            });

            inflatablesRunning.Subscribe(x =>
            {
                airReindeer.SetValue(x);

                Exec.SetKey("InflatablesRunning", x.ToString());
            });

            // Read from storage
            inflatablesRunning.OnNext(Exec.GetSetKey("InflatablesRunning", false));

            //            hours.Output.Log("Hours inside");

            stateMachine.ForFromSubroutine(States.Background, subBackground);
            stateMachine.ForFromSubroutine(States.Music1, subMusic1);
            stateMachine.ForFromSubroutine(States.Music2, subMusic2);
            stateMachine.ForFromSubroutine(States.SantaVideo, subSantaVideo);
            stateMachine.ForFromSubroutine(States.DarthVader, subStarWars);

            airR2D2.SetValue(true);
            airSanta1.SetValue(true);
            airOlaf.SetValue(true);
            laser.SetValue(true);

            hours
            //    .ControlsMasterPower(packages)
            //    .ControlsMasterPower(airSnowman)
            .ControlsMasterPower(airOlaf)
            .ControlsMasterPower(laser)
            .ControlsMasterPower(airSanta1)
            .ControlsMasterPower(airR2D2);
            //    .ControlsMasterPower(airSanta);

            buttonStartInflatables.Output.Subscribe(x =>
            {
                if (x && hours.IsOpen)
                {
                    inflatablesRunning.OnNext(true);
                }
            });

            acnOutput.Connect(new Physical.Pixel1D(pixelsRoofEdge, 0, 50), SacnUniverse6, 1);
            acnOutput.Connect(new Physical.Pixel1D(pixelsRoofEdge, 50, 100), SacnUniverse5, 1);

            var pixelMapping2D = Framework.Utility.PixelMapping.GeneratePixelMapping(20, 10, pixelOrder: Framework.Utility.PixelOrder.HorizontalSnakeBottomLeft);

            acnOutput.Connect(new Physical.Pixel2D(pixelsMatrix, pixelMapping2D), SacnUniverse10, 1);

            acnOutput.Connect(new Physical.Pixel1D(saberPixels, 0, 32), SacnUniverse12, 1);

            acnOutput.Connect(new Physical.GenericDimmer(airOlaf, 10), SacnUniverseDMX);
            acnOutput.Connect(new Physical.GenericDimmer(airReindeer, 12), SacnUniverseDMX);
            acnOutput.Connect(new Physical.GenericDimmer(airR2D2, 11), SacnUniverseDMX);
            acnOutput.Connect(new Physical.GenericDimmer(lightHat1, 96), SacnUniverseDMX);
            acnOutput.Connect(new Physical.GenericDimmer(lightHat2, 97), SacnUniverseDMX);
            acnOutput.Connect(new Physical.GenericDimmer(lightHat3, 98), SacnUniverseDMX);
            acnOutput.Connect(new Physical.GenericDimmer(lightHat4, 99), SacnUniverseDMX);
            acnOutput.Connect(new Physical.RGBStrobe(lightVader, 60), SacnUniverseDMX);
            acnOutput.Connect(new Physical.RGBStrobe(lightWall1, 70), SacnUniverseDMX);
            acnOutput.Connect(new Physical.RGBStrobe(lightWall2, 40), SacnUniverseDMX);
            acnOutput.Connect(new Physical.RGBStrobe(lightWall3, 80), SacnUniverseDMX);

            acnOutput.Connect(new Physical.GenericDimmer(laser, 4), SacnUniverseRenardBig);

            acnOutput.Connect(new Physical.GenericDimmer(lightOlaf, 128), SacnUniverseDMX);
            acnOutput.Connect(new Physical.GenericDimmer(lightSanta, 131), SacnUniverseDMX);
            acnOutput.Connect(new Physical.GenericDimmer(lightSnowman, 132), SacnUniverseDMX);
            acnOutput.Connect(new Physical.GenericDimmer(lightSnowman, 132), SacnUniverseDMX);
            acnOutput.Connect(new Physical.GenericDimmer(lightBlueButton, 262), SacnUniverseDMX);
            acnOutput.Connect(new Physical.GenericDimmer(lightRedButton, 263), SacnUniverseDMX);

            acnOutput.Connect(new Physical.GenericDimmer(lightR2D2, 16), SacnUniverseRenardBig);
            acnOutput.Connect(new Physical.GenericDimmer(lightRail2, 10), SacnUniverseRenardBig);
            acnOutput.Connect(new Physical.GenericDimmer(lightNet5, 11), SacnUniverseRenardBig);
            acnOutput.Connect(new Physical.GenericDimmer(lightNet6, 19), SacnUniverseRenardBig);
            acnOutput.Connect(new Physical.GenericDimmer(airSanta1, 20), SacnUniverseRenardBig);
            acnOutput.Connect(new Physical.GenericDimmer(lightNet7, 22), SacnUniverseRenardBig);

            acnOutput.Connect(new Physical.GenericDimmer(lightStairs2, 25), SacnUniverseRenardBig);
            acnOutput.Connect(new Physical.GenericDimmer(lightXmasTree, 26), SacnUniverseRenardBig);
            acnOutput.Connect(new Physical.GenericDimmer(lightReindeer2, 29), SacnUniverseRenardBig);
            acnOutput.Connect(new Physical.GenericDimmer(lightReindeer1, 32), SacnUniverseRenardBig);

            acnOutput.Connect(new Physical.GenericDimmer(lightStairs1, 1), SacnUniverseRenardSmall);
            acnOutput.Connect(new Physical.GenericDimmer(lightNet2, 2), SacnUniverseRenardSmall);
            acnOutput.Connect(new Physical.GenericDimmer(lightNet1, 3), SacnUniverseRenardSmall);
            acnOutput.Connect(new Physical.GenericDimmer(lightNet3, 4), SacnUniverseRenardSmall);
            acnOutput.Connect(new Physical.GenericDimmer(lightNet4, 5), SacnUniverseRenardSmall);
            acnOutput.Connect(new Physical.GenericDimmer(lightRail1, 6), SacnUniverseRenardSmall);
            acnOutput.Connect(new Physical.GenericDimmer(lightTopper1, 7), SacnUniverseRenardSmall);
            acnOutput.Connect(new Physical.GenericDimmer(lightTopper2, 8), SacnUniverseRenardSmall);

            hours.Output.Subscribe(x =>
            {
                if (x)
                {
                    stateMachine.GoToDefaultState();
                }
                else
                {
                    //if (buttonOverrideHours.Active)
                    //    return;

                    stateMachine.GoToIdle();

                    // Needed?
                    System.Threading.Thread.Sleep(200);

                    inflatablesRunning.OnNext(false);
                }
            });

            subBackground
            .LockWhenRunning(
                lightNet1,
                lightNet2,
                lightNet3,
                lightNet4,
                lightNet5,
                lightNet6,
                lightNet7,
                lightNet8,
                lightTopper1,
                lightTopper2,
                lightXmasTree,
                lightStairs1,
                lightStairs2,
                lightRail1,
                lightRail2,
                lightSanta,
                lightSnowman,
                lightHat1,
                lightHat2,
                lightHat3,
                lightHat4,
                lightReindeer1,
                lightReindeer2,
                lightVader,
                lightWall1,
                lightWall2,
                lightWall3,
                lightR2D2,
                lightOlaf,
                saberPixels)
            .RunAction(i =>
            {
                pulsatingEffect4.Start();
                lightR2D2.SetBrightness(1, i.Token);
                lightOlaf.SetBrightness(1, i.Token);
                lightNet1.SetBrightness(1, i.Token);
                lightNet2.SetBrightness(1, i.Token);
                lightNet3.SetBrightness(1, i.Token);
                lightNet4.SetBrightness(1, i.Token);
                lightNet5.SetBrightness(1, i.Token);
                lightNet6.SetBrightness(1, i.Token);
                lightNet7.SetBrightness(1, i.Token);
                lightNet8.SetBrightness(1, i.Token);
                lightTopper1.SetBrightness(1, i.Token);
                lightTopper2.SetBrightness(1, i.Token);
                lightXmasTree.SetBrightness(1, i.Token);
                lightStairs1.SetBrightness(1, i.Token);
                lightStairs2.SetBrightness(1, i.Token);
                lightRail1.SetBrightness(1, i.Token);
                lightRail2.SetBrightness(1, i.Token);
                lightSanta.SetBrightness(1, i.Token);
                lightSnowman.SetBrightness(1, i.Token);
                lightHat1.SetBrightness(1, i.Token);
                lightHat2.SetBrightness(1, i.Token);
                lightHat3.SetBrightness(1, i.Token);
                lightHat4.SetBrightness(1, i.Token);
                lightReindeer1.SetBrightness(1, i.Token);
                lightReindeer2.SetBrightness(1, i.Token);
                lightVader.SetColor(Color.Red, 1, i.Token);
                lightWall1.SetColor(Color.Red, 1, i.Token);
                lightWall2.SetColor(Color.Red, 1, i.Token);
                lightWall3.SetColor(Color.Red, 1, i.Token);

                saberPixels.SetColor(Color.Red, 0.4, i.Token);

                subCandyCane.Run();
                dmxPlayback.Run();

                i.WaitUntilCancel();

                dmxPlayback.Stop();
                Exec.Cancel(subCandyCane);
                pulsatingEffect4.Stop();
            });

            subCandyCane
            .LockWhenRunning(pixelsRoofEdge)
            .RunAction(i =>
            {
                const int spacing = 4;

                while (true)
                {
                    for (int x = 0; x < spacing; x++)
                    {
                        pixelsRoofEdge.Inject((x % spacing) == 0 ? Color.Red : Color.White, 0.5, i.Token);

                        i.WaitFor(S(0.30), true);
                    }
                }
            });

            subSnow
            .RunAction(ins =>
            {
                snowMachine.SetValue(true);

                ins.WaitFor(S(30));
            })
            .TearDown(i =>
            {
                snowMachine.SetValue(false);
            });

            subStarWarsCane
            .LockWhenRunning(
                pixelsRoofEdge,
                pixelsMatrix)
            .RunAction(instance =>
            {
                const int spacing = 4;

                while (!instance.CancelToken.IsCancellationRequested)
                {
                    for (int i = 0; i < spacing; i++)
                    {
                        switch (i % spacing)
                        {
                        case 0:
                        case 1:
                            pixelsRoofEdge.InjectRev(Color.Yellow, 1.0, instance.Token);
                            break;

                        case 2:
                        case 3:
                            pixelsRoofEdge.InjectRev(Color.Orange, 0.2, instance.Token);
                            break;
                        }

                        instance.WaitFor(S(0.1));

                        if (instance.IsCancellationRequested)
                        {
                            break;
                        }
                    }
                }
            });

            subMusic1
            .RunAction(ins =>
            {
                audioMain.PlayTrack("08 Feel the Light.wav");
                ins.WaitFor(S(240));
            }).TearDown(i =>
            {
                lorFeelTheLight.Stop();
                audioMain.PauseTrack();
            });

            subMusic2
            .RunAction(ins =>
            {
                snowMachine.SetValue(true);
                audioMain.PlayTrack("T.P.E. - 04 - Josh Groban - Believe.flac");
                ins.WaitFor(S(260));
            }).TearDown(i =>
            {
                snowMachine.SetValue(false);
                lorBelieve.Stop();
                audioMain.PauseTrack();
            });

            subSantaVideo
            .RunAction(i =>
            {
                pulsatingEffect3.Start();
                switch (random.Next(6))
                {
                case 0:
                    video3.PlayVideo("NBC_DeckTheHalls_Holl_H.mp4");
                    break;

                case 1:
                    video3.PlayVideo("NBC_AllThruHouse_Part1_Holl_H.mp4");
                    break;

                case 2:
                    video3.PlayVideo("NBC_AllThruHouse_Part2_Holl_H.mp4");
                    break;

                case 3:
                    video3.PlayVideo("NBC_AllThruHouse_Part3_Holl_H.mp4");
                    break;

                case 4:
                    video3.PlayVideo("NBC_JingleBells_Holl_H.mp4");
                    break;

                case 5:
                    video3.PlayVideo("NBC_WeWishYou_Holl_H.mp4");
                    break;
                }

                i.WaitFor(S(120), false);
                pulsatingEffect3.Stop();
            });

            subOlaf
            .RunAction(i =>
            {
                pulsatingEffect1.Start();
                audio1.PlayNewEffect("WarmHugs.wav", 0.0, 1.0);
                i.WaitFor(S(10));
                pulsatingEffect1.Stop();
            });

            subR2D2
            .RunAction(i =>
            {
                pulsatingEffect2.Start();
                audio1.PlayNewEffect("Im C3PO.wav", 1.0, 0.0);
                i.WaitFor(S(4));
                audio1.PlayNewEffect("Processing R2D2.wav", 0.5, 0.0);
                i.WaitFor(S(5));
                pulsatingEffect2.Stop();
            });

            subStarWars
            .LockWhenRunning(
                saberPixels,
                lightVader,
                lightR2D2)
            .RunAction(instance =>
            {
                //Exec.Cancel(subCandyCane);
                subStarWarsCane.Run();
                lightR2D2.SetBrightness(1.0, instance.Token);

                audioMain.PlayTrack("01. Star Wars - Main Title.wav");

                instance.WaitFor(S(16));

                /*
                 *  elJesus.SetPower(true);
                 *  pulsatingStar.Start();
                 *  lightJesus.SetColor(Color.White, 0.3);
                 *  light3wise.SetOnlyColor(Color.LightYellow);
                 *  light3wise.RunEffect(new Effect2.Fader(0.0, 1.0), S(1.0));*/

                Exec.MasterEffect.Fade(lightVader, 0.0, 1.0, 1000, token: instance.Token, additionalData: Utils.Data(Color.Red));
                instance.WaitFor(S(2.5));

                Exec.Cancel(subStarWarsCane);
                instance.WaitFor(S(0.5));

                audioDarthVader.PlayEffect("saberon.wav");
                for (int sab = 00; sab < 32; sab++)
                {
                    saberPixels.Inject(Color.Red, 0.5, instance.Token);
                    instance.WaitFor(S(0.01));
                }
                instance.WaitFor(S(1));
                audioMain.PauseTrack();

                lightVader.SetColor(Color.Red, 1.0, instance.Token);
                audioDarthVader.PlayEffect("father.wav");
                instance.WaitFor(S(5));

                lightVader.SetBrightness(0.0, instance.Token);
                //light3wise.TurnOff();
                //lightJesus.TurnOff();
                //pulsatingStar.Stop();
                //elJesus.TurnOff();

                audioDarthVader.PlayEffect("force1.wav");
                instance.WaitFor(S(4));

                audioDarthVader.PlayEffect("saberoff.wav");
                instance.WaitFor(S(0.7));
                for (int sab = 0; sab < 16; sab++)
                {
                    saberPixels.InjectRev(Color.Black, 0, instance.Token);
                    saberPixels.InjectRev(Color.Black, 0, instance.Token);
                    instance.WaitFor(S(0.01));
                }
                //elLightsaber.SetPower(false);
                instance.WaitFor(S(2));

                //lightJesus.TurnOff();
                //light3wise.TurnOff();
                //elLightsaber.TurnOff();
                //pulsatingStar.Stop();
                //elJesus.TurnOff();
                //instance.WaitFor(S(2));
            })
            .TearDown(i =>
            {
                audioMain.PauseTrack();
            });


            midiAkai.Note(midiChannel, 36).Subscribe(x =>
            {
                if (x)
                {
                    subOlaf.Run();
                }
            });

            midiAkai.Note(midiChannel, 37).Subscribe(x =>
            {
                if (x)
                {
                    subR2D2.Run();
                }
            });

            midiAkai.Note(midiChannel, 38).Subscribe(x =>
            {
                if (x)
                {
                    stateMachine.GoToState(States.Music1);
                }
                //                    audio2.PlayTrack("08 Feel the Light.wav");
            });

            midiAkai.Note(midiChannel, 39).Subscribe(x =>
            {
                if (x)
                {
                    lorFeelTheLight.Stop();
                    audioMain.PauseTrack();
                }
            });

            midiAkai.Note(midiChannel, 40).Subscribe(x =>
            {
                if (x)
                {
                    stateMachine.GoToState(States.SantaVideo);
                }
            });

            inOlaf.Output.Subscribe(x =>
            {
                if (x && hours.IsOpen)
                {
                    subOlaf.Run();
                }
            });

            inR2D2.Output.Subscribe(x =>
            {
                if (x && hours.IsOpen)
                {
                    subR2D2.Run();
                }
            });

            inRedButton.Output.Subscribe(x =>
            {
                if (x)
                {
                    if (hours.IsOpen)
                    {
                        if (stateMachine.CurrentState == States.Background)
                        {
                            stateMachine.GoToState(States.DarthVader);
                        }
                    }
                    else
                    {
                        audioDarthVader.PlayEffect("darthvader_lackoffaith.wav");
                    }
                }
            });

            inBlueButton.Output.Subscribe(x =>
            {
                if (x)
                {
                    if (hours.IsOpen)
                    {
                        subSnow.Run();
                        if (stateMachine.CurrentState == States.Background)
                        {
                            stateMachine.GoToState(States.Music2);
                        }
                    }
                    else
                    {
                        audioDarthVader.PlayEffect("darkside.wav");
                    }
                }
            });

            audioMain.AudioTrackStart += (o, e) =>
            {
                switch (e.FileName)
                {
                case "08 Feel the Light.wav":
                    lorFeelTheLight.Start(27830);
                    break;

                case "T.P.E. - 04 - Josh Groban - Believe.flac":
                    lorBelieve.Start();
                    break;
                }
            };

            audioMain.AudioTrackDone += (o, e) =>
            {
                //                Thread.Sleep(5000);
                //    audio2.PlayTrack("08 Feel the Light.wav");
            };

            inShowMachine.Output.Subscribe(x =>
            {
                snowMachine.SetValue(x);
                //                lightRedButton.SetBrightness(x ? 1.0 : 0.0);
                //if (x)
                //    stateMachine.GoToState(States.Music1);
            });

            in2.Output.Subscribe(x =>
            {
                if (x)
                {
                    stateMachine.GoToIdle();
                }
            });

            in3.Output.Subscribe(x =>
            {
                if (x)
                {
                    stateMachine.GoToDefaultState();
                }
            });

            ImportAndMapFeelTheLight();
            ImportAndMapBelieve();
        }