public static ColorBrightness[] CreateBlank(int size) { var result = new ColorBrightness[size]; for (int i = 0; i < size; i++) result[i] = new ColorBrightness(Color.Black, 0); return result; }
public static ColorBrightness[] CreateBlank(int size) { var result = new ColorBrightness[size]; for (int i = 0; i < size; i++) { result[i] = new ColorBrightness(Color.Black, 0); } return(result); }
protected void RaiseMultiPixelChanged(int startChannel, int size) { var handler = MultiPixelChanged; if (handler != null) { var newValues = new ColorBrightness[size]; for (int i = 0; i < size; i++) { newValues[i] = new ColorBrightness(this.color[i + startChannel], this.brightness[i + startChannel]); } handler(this, new MultiPixelChangedEventArgs(startChannel, newValues)); } }
public Pixel1D InjectWithFade(Color color, double brightness, TimeSpan duration) { var newValues = new ColorBrightness[this.pixelCount]; for (int i = this.brightness.Length - 1; i > 0; i--) { newValues[i] = new ColorBrightness(this.color[i - 1], this.brightness[i - 1]); } newValues[0] = new ColorBrightness(color, brightness); FadeTo(newValues, duration); return(this); }
public BaseLight(DigitalOutput2 logicalDevice) : base(logicalDevice) { this.colorBrightness = new ColorBrightness(Color.White, 0.0); var sendsData = logicalDevice as ISendsData; if (sendsData != null) { sendsData.OutputChanged.Subscribe(x => { SetFromIData(logicalDevice, x); Output(); }); SetFromIData(logicalDevice, sendsData.CurrentData); } }
public BaseLight(IApiVersion3 logicalDevice) : base(logicalDevice) { this.colorBrightness = new ColorBrightness(Color.White, 0.0); var sendsData = logicalDevice as ISendsData; if (sendsData != null) { sendsData.OutputChanged.Subscribe(x => { SetFromIData(logicalDevice, x); Output(); }); SetFromIData(logicalDevice, sendsData.CurrentData); } Executor.Current.Blackout.Subscribe(_ => Output()); Executor.Current.Whiteout.Subscribe(_ => Output()); }
public static System.Drawing.Color GetColorFromColorBrightness(ColorBrightness colorBrightness) { var hsv = new HSV(colorBrightness.Color); double whiteOut = Executor.Current.Whiteout.Value; // Adjust brightness double adjustedValue = (hsv.Value * colorBrightness.Brightness) + whiteOut; // Adjust for WhiteOut HSV baseHsv; if (colorBrightness.Brightness == 0 && whiteOut > 0) // Base it on black instead baseHsv = HSV.Black; else baseHsv = hsv; hsv.Saturation = baseHsv.Saturation + (HSV.White.Saturation - baseHsv.Saturation) * whiteOut; hsv.Value = adjustedValue.Limit(0, 1) * (1 - Executor.Current.Blackout.Value); return hsv.Color; }
public Halloween2015(IEnumerable<string> args) { hoursSmall.AddRange("5:00 pm", "7:00 pm"); // hoursFull.AddRange("5:00 pm", "7:00 pm"); // Logging hoursSmall.Output.Log("Hours small"); hoursFull.Output.Log("Hours full"); hoursSmall .ControlsMasterPower(catAir); hoursFull .ControlsMasterPower(catAir); // .ControlsMasterPower(eyes); buttonOverrideHours.Output.Subscribe(x => { if (x) hoursFull.SetForced(true); else hoursFull.SetForced(false); }); emergencyStop.Output.Subscribe(x => { if (x) { stateMachine.GoToState(States.EmergencyStop); } else { if (hoursFull.IsOpen) stateMachine.GoToState(States.Background); else stateMachine.GoToIdle(); } }); hoursFull.Output.Subscribe(x => { if (x) { stateMachine.SetDefaultState(States.Background); if (emergencyStop.Value) stateMachine.GoToState(States.EmergencyStop); else stateMachine.GoToState(States.Background); } else { stateMachine.GoToIdle(); stateMachine.SetDefaultState(null); } SetPixelColor(); }); popOut1.ConnectTo(wall1Light); popOut1.ConnectTo(wall4Light); popOut2.ConnectTo(wall2Light); popOutAll.ConnectTo(wall1Light); popOutAll.ConnectTo(wall2Light); popOutAll.ConnectTo(wall3Light); popOutAll.ConnectTo(wall4Light); popOutAll.ConnectTo(underGeorge); popOutAll.ConnectTo(pixelsRoofEdge); popOutAll.ConnectTo(pinSpot); allLights.Add(wall1Light, wall2Light, wall3Light, wall4Light, underGeorge, pixelsRoofEdge, pinSpot, spiderLight); purpleLights.Add(wall1Light, wall2Light, wall3Light, wall4Light, pixelsRoofEdge); flickerEffect.ConnectTo(stairs1Light); flickerEffect.ConnectTo(stairs2Light); pulsatingEffect1.ConnectTo(pinSpot, Tuple.Create<DataElements, object>(DataElements.Color, Color.FromArgb(0, 255, 0))); pulsatingEffect2.ConnectTo(pinSpot, Tuple.Create<DataElements, object>(DataElements.Color, Color.FromArgb(255, 0, 0))); stateMachine.For(States.Background) .Execute(i => { subVideo.Run(); flickerEffect.Start(); treeGhosts.SetBrightness(1.0); audioMain.PlayBackground(); audioEeebox.SetBackgroundVolume(0.6); audioEeebox.PlayBackground(); ColorBrightness purpleColor = new ColorBrightness(HSV.ColorFromRGB(0.73333333333333328, 0, 1), 0.16470588235294117); purpleLights.SetBrightness(purpleColor.Brightness, new Data(DataElements.Color, purpleColor.Color)); while (!i.IsCancellationRequested && stateMachine.CurrentState == States.Background) { i.WaitFor(S(0.5)); if (!this.lastFogRun.HasValue || (DateTime.Now - this.lastFogRun.Value).TotalMinutes > 5) { // Run the fog for a little while fog.SetValue(true); i.WaitFor(S(4)); fog.SetValue(false); this.lastFogRun = DateTime.Now; } } }) .TearDown(instance => { purpleLights.SetBrightness(0.0); Exec.Cancel(subVideo); audioMain.PauseBackground(); audioEeebox.PauseBackground(); timelineThunder1.Stop(); timelineThunder2.Stop(); timelineThunder3.Stop(); timelineThunder4.Stop(); timelineThunder5.Stop(); timelineThunder6.Stop(); timelineThunder7.Stop(); timelineThunder8.Stop(); flickerEffect.Stop(); treeGhosts.SetBrightness(0.0); }); stateMachine.For(States.EmergencyStop) .Execute(i => { // Do nothing i.WaitUntilCancel(); }); stateMachine.For(States.Special1) .Execute(i => { audioEeebox.PlayNewEffect("640 The Demon Exorcised.wav"); i.WaitUntilCancel(); }); inputBrightness.Output.Subscribe(x => { // testLight1.SetBrightness(x); }); inputH.WhenOutputChanges(x => { // testLight1.SetColor(HSV.ColorFromHSV(x.GetByteScale(), inputS.Value, 1.0)); }); inputS.Output.Subscribe(x => { // testLight1.SetColor(HSV.ColorFromHSV(inputH.Value.GetByteScale(), x, 1.0)); }); midiInput.Controller(midiChannel, 1).Controls(inputBrightness.Control); midiInput.Controller(midiChannel, 2).Controls(inputH.Control); midiInput.Controller(midiChannel, 3).Controls(inputS.Control); raspberryLocal.AudioTrackStart.Subscribe(x => { // Next track switch (x) { case "Thunder1.wav": timelineThunder1.Start(); audioEeebox.PlayEffect("scream.wav"); break; case "Thunder2.wav": timelineThunder2.Start(); break; case "Thunder3.wav": timelineThunder3.Start(); break; case "Thunder4.wav": timelineThunder4.Start(); audioEeebox.PlayEffect("424 Coyote Howling.wav"); break; case "Thunder5.wav": timelineThunder5.Start(); // audioEeebox.PlayEffect("sixthsense-deadpeople.wav"); break; case "Thunder6.wav": timelineThunder6.Start(); break; case "Thunder7.wav": timelineThunder7.Start(); break; case "Thunder8.wav": timelineThunder8.Start(); break; default: log.Debug("Unknown track {0}", x); break; } }); 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; acnOutput.Connect(new Physical.Pixel1D(pixelsRoofEdge, 0, 50), 6, 1); acnOutput.Connect(new Physical.Pixel1D(pixelsRoofEdge, 50, 100), 5, 1); acnOutput.Connect(new Physical.SmallRGBStrobe(spiderLight, 1), 1); acnOutput.Connect(new Physical.RGBStrobe(wall1Light, 60), 1); acnOutput.Connect(new Physical.RGBStrobe(wall2Light, 70), 1); acnOutput.Connect(new Physical.RGBStrobe(wall3Light, 40), 1); acnOutput.Connect(new Physical.RGBStrobe(wall4Light, 80), 1); acnOutput.Connect(new Physical.GenericDimmer(stairs1Light, 50), 1); acnOutput.Connect(new Physical.GenericDimmer(stairs2Light, 51), 1); acnOutput.Connect(new Physical.GenericDimmer(treeGhosts, 52), 1); acnOutput.Connect(new Physical.AmericanDJStrobe(underGeorge, 100), 1); acnOutput.Connect(new Physical.MonopriceRGBWPinSpot(pinSpot, 20), 1); // acnOutput.Connect(new Physical.RGBIS(testLight1, 260), 1); raspberryCat.DigitalInputs[4].Connect(catMotion, false); raspberryCat.DigitalInputs[5].Connect(firstBeam, false); raspberryCat.DigitalInputs[6].Connect(finalBeam, false); raspberryCat.DigitalOutputs[7].Connect(spiderCeilingDrop); raspberryCat.Connect(audioCat); raspberryLocal.Connect(audioMain); monoExpanderEeebox.Connect(audioEeebox); raspberry3dfx.Connect(video3dfx); raspberryVideo2.Connect(video2); raspberryPop.Connect(audioPop); raspberryDIN.Connect(audioDIN); raspberryDIN.DigitalInputs[4].Connect(motion2); raspberryCat.DigitalOutputs[6].Connect(fog); raspberryDIN.DigitalOutputs[1].Connect(candyEyes); raspberryPop.DigitalOutputs[7].Connect(george1); raspberryPop.DigitalOutputs[6].Connect(george2); raspberryPop.DigitalOutputs[5].Connect(popper); raspberryPop.DigitalOutputs[2].Connect(dropSpiderEyes); acnOutput.Connect(new Physical.GenericDimmer(catAir, 10), 1); acnOutput.Connect(new Physical.GenericDimmer(catLights, 11), 1); oscServer.RegisterAction<int>("/3/multipush1/6/1", d => d.First() != 0, (msg, data) => { audioEeebox.PlayEffect("sixthsense-deadpeople.wav"); }); oscServer.RegisterAction<int>("/3/multipush1/6/2", d => d.First() != 0, (msg, data) => { audioEeebox.PlayEffect("162 Blood Curdling Scream of Terror.wav"); }); oscServer.RegisterAction<int>("/3/multipush1/6/3", d => d.First() != 0, (msg, data) => { audioEeebox.PlayEffect("424 Coyote Howling.wav"); }); oscServer.RegisterAction<int>("/3/multipush1/6/4", d => d.First() != 0, (msg, data) => { audioEeebox.PlayEffect("125919__klankbeeld__horror-what-are-you-doing-here-cathedral.wav"); }); oscServer.RegisterAction<int>("/3/multipush1/6/5", d => d.First() != 0, (msg, data) => { audioEeebox.PlayEffect("242004__junkfood2121__fart-01.wav"); }); oscServer.RegisterAction<int>("/3/multipush1/5/1", d => d.First() != 0, (msg, data) => { audioEeebox.PlayEffect("death-scream.wav"); }); oscServer.RegisterAction<int>("/3/multipush1/5/2", d => d.First() != 0, (msg, data) => { audioEeebox.PlayEffect("scream.wav"); }); oscServer.RegisterAction<int>("/3/multipush1/5/3", d => d.First() != 0, (msg, data) => { audioEeebox.PlayEffect("door-creak.wav"); }); oscServer.RegisterAction<int>("/3/multipush1/5/4", d => d.First() != 0, (msg, data) => { audioEeebox.PlayEffect("violin screech.wav"); }); oscServer.RegisterAction<int>("/3/multipush1/5/5", d => d.First() != 0, (msg, data) => { audioEeebox.PlayEffect("gollum_precious1.wav"); }); oscServer.RegisterAction<int>("/3/multipush1/4/1", d => d.First() != 0, (msg, data) => { audioEeebox.PlayNewEffect("640 The Demon Exorcised.wav"); }); oscServer.RegisterAction<int>("/3/multipush1/4/2", d => d.First() != 0, (msg, data) => { audioCat.PlayEffect("266 Monster Growl 7.wav", 1.0, 1.0); }); oscServer.RegisterAction<int>("/3/multipush1/4/3", d => d.First() != 0, (msg, data) => { audioCat.PlayEffect("285 Monster Snarl 2.wav", 1.0, 1.0); }); oscServer.RegisterAction<int>("/3/multipush1/4/4", d => d.First() != 0, (msg, data) => { audioCat.PlayEffect("286 Monster Snarl 3.wav", 1.0, 1.0); }); oscServer.RegisterAction<int>("/3/multipush1/4/5", d => d.First() != 0, (msg, data) => { audioCat.PlayEffect("287 Monster Snarl 4.wav", 1.0, 1.0); }); oscServer.RegisterAction<int>("/3/multipush1/3/1", d => d.First() != 0, (msg, data) => { audioEeebox.PlayEffect("180 Babbling Lunatic.wav"); }); oscServer.RegisterAction<int>("/1/eStop", (msg, data) => { emergencyStop.Control.OnNext(data.First() != 0); }); oscServer.RegisterAction<int>("/1/push2", d => d.First() != 0, (msg, data) => { audioCat.PlayEffect("285 Monster Snarl 2.wav", 1.0, 1.0); }); oscServer.RegisterAction<int>("/1/push3", d => d.First() != 0, (msg, data) => { audioCat.PlayEffect("286 Monster Snarl 3.wav", 1.0, 1.0); }); oscServer.RegisterAction<int>("/1/push4", (msg, data) => { // Flash if (data.First() != 0) { allLights.TakeAndHoldControl(); allLights.SetBrightness(1.0, new Data(DataElements.Color, Color.White)); } else allLights.ReleaseControl(); }); oscServer.RegisterAction<int>("/1/push5", (msg, data) => { george1.SetValue(data.First() != 0); }); oscServer.RegisterAction<int>("/1/push6", (msg, data) => { george2.SetValue(data.First() != 0); }); oscServer.RegisterAction<int>("/1/push7", (msg, data) => { popper.SetValue(data.First() != 0); }); oscServer.RegisterAction<int>("/1/push8", d => d.First() != 0, (msg, data) => { audioPop.PlayEffect("laugh.wav", 1.0, 0.0); }); oscServer.RegisterAction<int>("/1/spiderEyes", (msg, data) => { dropSpiderEyes.SetValue(data.First() != 0); }); oscServer.RegisterAction<int>("/1/push10", d => d.First() != 0, (msg, data) => { audioPop.PlayEffect("348 Spider Hiss.wav", 0.0, 1.0); }); oscServer.RegisterAction<int>("/1/push11", (msg, data) => { spiderCeilingDrop.SetValue(data.First() != 0); }); oscServer.RegisterAction<int>("/1/push12", (msg, data) => { fog.SetValue(data.First() != 0); }); oscServer.RegisterAction<int>("/1/special1", (msg, data) => { if (data.First() != 0) stateMachine.GoToMomentaryState(States.Special1); else stateMachine.StopCurrentJob(); }); oscServer.RegisterAction<int>("/1/push13", d => d.First() != 0, (msg, data) => { // Exec.MasterEffect.Fade(stairs1Light, 1.0, 0.0, 2000, token: testToken); //popOut1.Pop(); //popOut2.Pop(); //popOut3.Pop(); popOutAll.Pop(color: Color.White); }); oscServer.RegisterAction<int>("/1/toggle1", (msg, data) => { // candyEyes.Value = data.First() != 0; if (data.First() != 0) audioMain.PlayBackground(); else audioMain.PauseBackground(); }); oscServer.RegisterAction<int>("/1/toggle2", (msg, data) => { // pinSpot.SetBrightness(data.First()); }); oscServer.RegisterAction<int>("/1/toggle3", (msg, data) => { if (data.First() != 0) audioEeebox.PlayBackground(); else audioEeebox.PauseBackground(); }); oscServer.RegisterAction<int>("/1/toggle4", (msg, data) => { block.Value = data.First() != 0; // treeGhosts.SetBrightness(data.First() != 0 ? 1.0 : 0.0); }); oscServer.RegisterAction<int>("/1/push14", (msg, data) => { // flickerEffect.Start(); //double brightness = data.First(); //spiderLight.SetColor(Color.Red, brightness); //pinSpot.SetColor(Color.Purple, brightness); //underGeorge.SetBrightness(brightness); //wall1Light.SetColor(Color.Purple, brightness); //wall2Light.SetColor(Color.Purple, brightness); //wall3Light.SetColor(Color.Purple, brightness); //wall4Light.SetColor(Color.Purple, brightness); // audioDIN.PlayEffect("gollum_precious1.wav"); }); oscServer.RegisterAction<int>("/1/push20", d => d.First() != 0, (msg, data) => { video3dfx.PlayVideo("PHA_Wraith_StartleScare_3DFX_H.mp4"); }); oscServer.RegisterAction<int>("/1/push21", d => d.First() != 0, (msg, data) => { // video2.PlayVideo("SkeletonSurprise_Door_Horz_HD.mp4"); video2.PlayVideo("Beauty_Startler_TVHolo_Hor_HD.mp4"); }); oscServer.RegisterAction<int>("/4/multipush2/5/1", d => d.First() != 0, (msg, data) => { video2.PlayVideo("Beauty_Startler_TVHolo_Hor_HD.mp4"); }); oscServer.RegisterAction<int>("/4/multipush2/5/2", d => d.First() != 0, (msg, data) => { }); oscServer.RegisterAction<int>("/4/multipush2/5/3", d => d.First() != 0, (msg, data) => { }); oscServer.RegisterAction<int>("/4/multipush2/5/4", d => d.First() != 0, (msg, data) => { video2.PlayVideo("FearTheReaper_Door_Horz_HD.mp4"); }); oscServer.RegisterAction<int>("/4/multipush2/4/1", d => d.First() != 0, (msg, data) => { video2.PlayVideo("GatheringGhouls_Door_Horz_HD.mp4"); }); oscServer.RegisterAction<int>("/4/multipush2/4/2", d => d.First() != 0, (msg, data) => { video2.PlayVideo("Girl_Startler_TVHolo_Hor_HD.mp4"); }); oscServer.RegisterAction<int>("/4/multipush2/4/3", d => d.First() != 0, (msg, data) => { video2.PlayVideo("HeadOfHouse_Startler_TVHolo_Hor_HD.mp4"); }); oscServer.RegisterAction<int>("/4/multipush2/4/4", d => d.First() != 0, (msg, data) => { video2.PlayVideo("JitteryBones_Door_Horz_HD.mp4"); }); oscServer.RegisterAction<int>("/4/multipush2/3/1", d => d.First() != 0, (msg, data) => { video2.PlayVideo("PHA_Poltergeist_StartleScare_Holl_H.mp4"); }); oscServer.RegisterAction<int>("/4/multipush2/3/2", d => d.First() != 0, (msg, data) => { video2.PlayVideo("PHA_Siren_StartleScare_Holl_H.mp4"); }); oscServer.RegisterAction<int>("/4/multipush2/3/3", d => d.First() != 0, (msg, data) => { video2.PlayVideo("PHA_Spinster_StartleScare_Holl_H.mp4"); }); oscServer.RegisterAction<int>("/4/multipush2/3/4", d => d.First() != 0, (msg, data) => { video2.PlayVideo("PHA_Wraith_StartleScare_Holl_H.mp4"); }); oscServer.RegisterAction<int>("/4/multipush2/2/1", d => d.First() != 0, (msg, data) => { video2.PlayVideo("PopUpPanic_Door_Horz_HD.mp4"); }); oscServer.RegisterAction<int>("/4/multipush2/2/2", d => d.First() != 0, (msg, data) => { video2.PlayVideo("SkeletonSurprise_Door_Horz_HD.mp4"); }); oscServer.RegisterAction<int>("/4/multipush2/2/3", d => d.First() != 0, (msg, data) => { video2.PlayVideo("Wraith_Startler_TVHolo_Hor_HD.mp4"); }); oscServer.RegisterAction<int>("/4/multipush2/2/4", d => d.First() != 0, (msg, data) => { }); oscServer.RegisterAction<int>("/4/multipush2/1/1", d => d.First() != 0, (msg, data) => { video3dfx.PlayVideo("PHA_Wraith_StartleScare_3DFX_H.mp4"); }); oscServer.RegisterAction<int>("/4/multipush2/1/2", d => d.First() != 0, (msg, data) => { video3dfx.PlayVideo("PHA_Spinster_StartleScare_3DFX_H.mp4"); }); oscServer.RegisterAction<int>("/4/multipush2/1/3", d => d.First() != 0, (msg, data) => { video3dfx.PlayVideo("PHA_Siren_StartleScare_3DFX_H.mp4"); }); oscServer.RegisterAction<int>("/4/multipush2/1/4", d => d.First() != 0, (msg, data) => { video3dfx.PlayVideo("PHA_Poltergeist_StartleScare_3DFX_H.mp4"); }); oscServer.RegisterAction("/1", msg => { log.Info("Page 1"); // manualFader.Value = false; SetPixelColor(); }); oscServer.RegisterAction("/2", msg => { log.Info("Page 2"); // manualFader.Value = true; SetPixelColor(); }); oscServer.RegisterAction<float>("/2/faderBright", (msg, data) => { faderBright.Value = data.First(); SetPixelColor(); }); oscServer.RegisterAction<float>("/2/faderR", (msg, data) => { faderR.Value = data.First(); SetPixelColor(); }); oscServer.RegisterAction<float>("/2/faderG", (msg, data) => { faderG.Value = data.First(); SetPixelColor(); }); oscServer.RegisterAction<float>("/2/faderB", (msg, data) => { faderB.Value = data.First(); SetPixelColor(); }); midiInput.Note(midiChannel, 36).Subscribe(x => { if (x) audioCat.PlayEffect("266 Monster Growl 7", 1.0, 1.0); }); midiInput.Note(midiChannel, 37).Subscribe(x => { if (x) audioCat.PlayEffect("285 Monster Snarl 2", 1.0, 1.0); }); midiInput.Note(midiChannel, 38).Subscribe(x => { if (x) audioCat.PlayEffect("286 Monster Snarl 3", 1.0, 1.0); }); midiInput.Note(midiChannel, 39).Subscribe(x => { if (x) audioCat.PlayEffect("287 Monster Snarl 4", 1.0, 1.0); }); midiInput.Note(midiChannel, 40).Subscribe(x => { if (x) { allLights.TakeAndHoldControl(); allLights.SetBrightness(1.0, new Data(DataElements.Color, Color.White)); } else allLights.ReleaseControl(); }); midiInput.Note(midiChannel, 41).Subscribe(x => { if (x) audioEeebox.PlayEffect("125919__klankbeeld__horror-what-are-you-doing-here-cathedral.wav"); }); midiInput.Note(midiChannel, 42).Subscribe(x => { if (x) audioEeebox.PlayEffect("180 Babbling Lunatic.wav"); }); midiInput.Note(midiChannel, 43).Subscribe(x => { if (x) audioEeebox.PlayEffect("162 Blood Curdling Scream of Terror.wav"); }); catMotion.Output.Subscribe(x => { if (x && (hoursFull.IsOpen || hoursSmall.IsOpen)) Executor.Current.Execute(catSeq); touchOSC.Send("/1/led1", x ? 1 : 0); }); firstBeam.Output.Subscribe(x => { touchOSC.Send("/1/led2", x ? 1 : 0); if (x && hoursFull.IsOpen && !emergencyStop.Value && !block.Value) subFirst.Run(); }); finalBeam.Output.Subscribe(x => { touchOSC.Send("/1/led3", x ? 1 : 0); if (x && hoursFull.IsOpen && !emergencyStop.Value && !block.Value) subFinal.Run(); }); motion2.Output.Subscribe(x => { //if (x && hoursFull.IsOpen) // Executor.Current.Execute(motionSeq); touchOSC.Send("/1/led4", x ? 1 : 0); }); welcomeSeq.WhenExecuted .Execute(i => { audioPop.PlayEffect("100471__robinhood76__01886-welcome-spell.wav"); i.WaitFor(S(3)); }); subFirst .LockWhenRunning(10, spiderLight) .RunAction(i => { fog.SetValue(true); this.lastFogRun = DateTime.Now; pulsatingEffect2.Start(); i.WaitFor(S(5.0)); spiderLight.SetColor(Color.Red, token: i.Token); dropSpiderEyes.SetValue(true); spiderCeilingDrop.SetValue(true); audioPop.PlayEffect("348 Spider Hiss.wav", 1.0, 0.0); i.WaitFor(S(2.0)); dropSpiderEyes.SetValue(false); spiderLight.SetBrightness(0.0, i.Token); switch (random.Next(4)) { case 0: video3dfx.PlayVideo("PHA_Wraith_StartleScare_3DFX_H.mp4"); break; case 1: video3dfx.PlayVideo("PHA_Spinster_StartleScare_3DFX_H.mp4"); break; case 2: video3dfx.PlayVideo("PHA_Siren_StartleScare_3DFX_H.mp4"); break; case 3: video3dfx.PlayVideo("PHA_Poltergeist_StartleScare_3DFX_H.mp4"); break; } fog.SetValue(false); i.WaitFor(S(2.0)); spiderCeilingDrop.SetValue(false); i.WaitFor(S(3.0)); }) .TearDown(i => { pulsatingEffect2.Stop(); Thread.Sleep(S(5)); }); subVideo .RunAction(i => { while (!i.IsCancellationRequested) { string videoFile; while (true) { videoFile = videoFiles[random.Next(videoFiles.Length)]; if (videoFiles.Length == 1 || videoFile != currentVideoFile) break; } currentVideoFile = videoFile; video2.PlayVideo(videoFile); i.WaitFor(S(60)); } }); subFinal .LockWhenRunning(10, candyEyes, underGeorge) .RunAction(i => { pulsatingEffect2.Stop(); pulsatingEffect1.Start(); candyEyes.SetValue(true); underGeorge.SetStrobeSpeed(0.5, i.Token); underGeorge.SetBrightness(1.0, i.Token); audioPop.PlayEffect("laugh.wav", 1.0, 0.0); for (int r = 0; r < 2; r++) { george1.SetValue(true); i.WaitFor(S(0.2)); george1.SetValue(false); i.WaitFor(S(0.2)); } i.WaitFor(S(1)); audioDIN.PlayEffect("125919__klankbeeld__horror-what-are-you-doing-here-cathedral.wav"); underGeorge.SetStrobeSpeed(0.0, i.Token); underGeorge.SetBrightness(0.0, i.Token); i.WaitFor(S(1)); popper.SetValue(true); audioPop.PlayEffect("180 Babbling Lunatic.wav", 0.0, 1.0); i.WaitFor(S(3)); popper.SetValue(false); i.WaitFor(S(8)); Exec.MasterEffect.Fade(underGeorge, 0.5, 0.0, 1000, token: i.Token); // underGeorge.SetBrightness(0.3, i.Token); i.WaitFor(S(0.5)); george2.SetValue(true); i.WaitFor(S(1.0)); george2.SetValue(false); i.WaitFor(S(1.0)); // underGeorge.SetBrightness(0.0, i.Token); }) .TearDown(i => { candyEyes.SetValue(false); pulsatingEffect1.Stop(); Thread.Sleep(S(5)); }); catSeq.WhenExecuted .Execute(instance => { var maxRuntime = System.Diagnostics.Stopwatch.StartNew(); catLights.SetValue(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(instance => { catLights.SetValue(false); }); motionSeq.WhenExecuted .Execute(instance => { //video2.PlayVideo("DancingDead_Wall_HD.mp4"); // instance.WaitFor(S(10)); }) .TearDown(instance => { }); }
public override void Start() { hours.AddRange("5:00 pm", "11:00 pm"); bool.TryParse(Exec.GetKey("InflatablesRunning", false.ToString()), out inflatablesRunning); buttonOverrideHours.ActiveChanged += (i, e) => { if (e.NewState) hours.SetForced(true); else hours.SetForced(null); }; candyCane .WhenExecuted .SetUp(() => allPixels.TurnOff()) .Execute(instance => { const int spacing = 4; while (true) { for (int i = 0; i < spacing; i++) { allPixels.Inject((i % spacing) == 0 ? Color.Red : Color.White, 0.5); instance.WaitFor(S(0.2), true); } } }) .TearDown(() => { allPixels.TurnOff(); }); twinkleSeq .WhenExecuted .SetUp(() => allPixels.TurnOff()) .Execute(instance => { var rnd = new Random(); while (!instance.IsCancellationRequested) { allPixels.SetAll(Color.White, 0.5); instance.WaitFor(S(1.0), true); int pixel1 = rnd.Next(allPixels.Pixels); int pixel2 = rnd.Next(allPixels.Pixels); var task1 = allPixels.FadeToAsync(instance, pixel1, Color.Red, 1.0, S(2.0)); var task2 = allPixels.FadeToAsync(instance, pixel2, Color.Red, 1.0, S(2.0)); Task.WaitAll(task1, task2); instance.WaitFor(S(1.0), true); task1 = allPixels.FadeToAsync(instance, pixel1, Color.White, 0.5, S(1.0)); task2 = allPixels.FadeToAsync(instance, pixel2, Color.White, 0.5, S(1.0)); Task.WaitAll(task1, task2); } }) .TearDown(() => allPixels.TurnOff()); backgroundLoop .WhenExecuted .SetUp(() => { pulsatingEffect1.Start(); flickerEffect.Start(); switchButtonBlue.SetPower(true); switchButtonRed.SetPower(true); lightTreeUp.SetOnlyColor(Color.Red); faderIn.Restart(); Executor.Current.Execute(twinkleSeq); }) .TearDown(() => { Executor.Current.Cancel(twinkleSeq); switchButtonBlue.SetPower(false); switchButtonRed.SetPower(false); EverythingOff(); }); offHours1Seq .WhenExecuted .Execute(instance => { audioPlayer.PlayEffect("force1"); instance.WaitFor(S(4)); }); offHours2Seq .WhenExecuted .Execute(instance => { audioPlayer.PlayEffect("darkside"); instance.WaitFor(S(4)); }); music1Seq .WhenExecuted .SetUp(() => { audioPlayer.CueTrack("21. Christmas Canon Rock"); // Make sure it's ready System.Threading.Thread.Sleep(800); EverythingOff(); }) .Execute(instance => { audioPlayer.ResumeTrack(); var task = timeline1.Start(); try { task.Wait(instance.CancelToken); instance.WaitFor(S(10)); } finally { timeline1.Stop(); audioPlayer.PauseTrack(); } if (!instance.IsCancellationRequested) instance.WaitFor(S(2)); EverythingOff(); instance.WaitFor(S(2)); }) .TearDown(() => { EverythingOff(); }); starwarsCane .WhenExecuted .SetUp(() => { allPixels.TurnOff(); starwarsPixels.TurnOff(); }) .Execute(instance => { const int spacing = 4; while (!instance.CancelToken.IsCancellationRequested) { for (int i = 0; i < spacing; i++) { switch (i % spacing) { case 0: case 1: starwarsPixels.InjectRev(Color.Yellow, 1.0); break; case 2: case 3: starwarsPixels.InjectRev(Color.Orange, 0.2); break; } instance.WaitFor(S(0.1)); if (instance.IsCancellationRequested) break; } } }) .TearDown(() => starwarsPixels.TurnOff()); fatherSeq .WhenExecuted .Execute(instance => { EverythingOff(); Executor.Current.Execute(starwarsCane); audioPlayer.PlayTrack("01. Star Wars - Main Title"); //lightCeiling1.SetOnlyColor(Color.Yellow); //lightCeiling2.SetOnlyColor(Color.Yellow); //lightCeiling3.SetOnlyColor(Color.Yellow); //pulsatingEffect2.Start(); instance.WaitFor(S(16)); //pulsatingEffect2.Stop(); audioPlayer.PauseTrack(); Executor.Current.Cancel(starwarsCane); allPixels.TurnOff(); instance.WaitFor(S(0.5)); 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)); lightVader.SetOnlyColor(Color.LightYellow); lightVader.RunEffect(new Effect2.Fader(0.0, 1.0), S(1.0)); instance.WaitFor(S(2.5)); //elLightsaber.SetPower(true); audioPlayer.PlayEffect("saberon"); for (int sab = 0; sab < 60; sab++) { saberPixels.Inject(Color.Red, 0.5); instance.WaitFor(S(0.01)); } // lightVader.SetColor(Color.Red, 1.0); audioPlayer.PlayEffect("father"); instance.WaitFor(S(4)); lightVader.TurnOff(); light3wise.TurnOff(); lightJesus.TurnOff(); pulsatingStar.Stop(); elJesus.TurnOff(); audioPlayer.PlayEffect("force1"); instance.WaitFor(S(4)); lightVader.TurnOff(); audioPlayer.PlayEffect("saberoff"); instance.WaitFor(S(0.7)); for (int sab = 0; sab < 30; sab++) { saberPixels.InjectRev(Color.Black, 0); saberPixels.InjectRev(Color.Black, 0); 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(() => { EverythingOff(); }); waveformSeq .WhenExecuted .SetUp(() => { audioPlayer.CueTrack("05. Frozen - Let It Go"); // Make sure it's ready System.Threading.Thread.Sleep(800); EverythingOff(); }) .Execute(i => { var timer = new Controller.HighPrecisionTimer(50, false); byte[] buffer; using (var fs = System.IO.File.OpenRead("Let It Go - Waveform 50ms.dat")) { buffer = new byte[fs.Length]; fs.Read(buffer, 0, buffer.Length); fs.Close(); } var cb = new ColorBrightness[allPixels.Pixels]; for(int cb_pos = 0; cb_pos < cb.Length; cb_pos++) cb[cb_pos] = new ColorBrightness(Color.Turquoise, 0.0); double lastValue = 0; timer.Tick += (o, e) => { int pos = (int)e.TotalTicks; if(pos >= buffer.Length) { e.Cancel = true; return; } double curValue = buffer[pos].GetDouble(); if (curValue > lastValue) lastValue = curValue; double value = lastValue; lastValue = (lastValue - 0.02).Limit(0.0, 1.0); const double d1 = 0.00; const double d2 = 0.15; const double d3 = 0.20; const double d4 = 0.25; lightHat1.Brightness = value.LimitAndScale(d1, 0.2); lightHat2.Brightness = value.LimitAndScale(d1, 0.2); lightHat3.Brightness = value.LimitAndScale(d2, 0.2); lightHat4.Brightness = value.LimitAndScale(d2, 0.2); lightTreeUp.Brightness = value.LimitAndScale(d3, 0.2); lightGarland1.Brightness = value.LimitAndScale(d3, 0.2); lightGarland2.Brightness = value.LimitAndScale(d3, 0.2); lightGarland3.Brightness = value.LimitAndScale(d3, 0.2); lightGarland4.Brightness = value.LimitAndScale(d3, 0.2); lightNet1.Brightness = value.LimitAndScale(d2, 0.2); lightNet2.Brightness = value.LimitAndScale(d2, 0.2); lightSnow1.Brightness = value.LimitAndScale(d3, 0.2); lightSnow2.Brightness = value.LimitAndScale(d3, 0.2); lightStairs1.Brightness = value.LimitAndScale(d1, 0.2); lightStairs2.Brightness = value.LimitAndScale(d1, 0.2); lightDeerSmall.Brightness = curValue; lightTopperLarge.Brightness = curValue; lightDeerLarge.Brightness = curValue; lightTopperSmall.Brightness = curValue; lightString1.Brightness = value.LimitAndScale(d4, 0.2); lightString2.Brightness = value.LimitAndScale(d4, 0.2); lightXmasTree.Brightness = value.LimitAndScale(d4, 0.2); lightStar.Brightness = value.LimitAndScale(d4, 0.2); int vuPos = (int)(cb.Length * value); for (int cb_pos = 0; cb_pos < cb.Length; cb_pos++) cb[cb_pos].Brightness = cb_pos < vuPos ? 1.0 : 0.2; allPixels.SetColors(0, cb); }; timer.Start(); audioPlayer.ResumeTrack(); timer.WaitUntilFinished(i); }) .TearDown(() => { EverythingOff(); }); buttonStartInflatables.ActiveChanged += (o, e) => { if (e.NewState && hours.IsOpen) { InflatablesRunning = true; switchDeerHuge.SetPower(true); switchSanta.SetPower(true); } }; this.oscServer.RegisterAction<int>("/osc/button1", (msg, data) => { if (data.Any() && data.First() == 1) { stateMachine.SetState(States.Vader); } }); this.oscServer.RegisterAction<int>("/osc/button2", (msg, data) => { if (data.Any() && data.First() == 1) { stateMachine.SetState(States.Music1); } }); this.oscServer.RegisterAction<int>("/osc/button3", (msg, data) => { if (data.Any() && data.First() == 1) { stateMachine.SetState(States.Music2); } }); this.oscServer.RegisterAction<int>("/osc/button4", (msg, data) => { if (data.Any() && data.First() == 1) { stateMachine.SetState(States.Background); } }); this.oscServer.RegisterAction<int>("/osc/button5", (msg, data) => { if (data.Any() && data.First() == 1) { audioPlayer.PlayEffect("darkside"); } }); this.oscServer.RegisterAction<int>("/osc/button6", (msg, data) => { if (data.Any() && data.First() == 1) { audioPlayer.PlayEffect("Darth Breathing"); } }); // Test Button buttonTest.ActiveChanged += (sender, e) => { // lightGarland4.Brightness = e.NewState ? 1.0 : 0.0; if (e.NewState) Exec.Execute(waveformSeq); else Exec.Cancel(waveformSeq); if (!e.NewState) return; //Exec.Cancel(candyCane); //allPixels.RunEffect(new Effect2.Fader(1.0, 0.0), S(2.0)).Wait(); //allPixels.SetAllOnlyColor(Color.Purple); //allPixels.RunEffect(new Effect2.Fader(0.0, 1.0), S(2.0)).Wait(); //allPixels.RunEffect(new Effect2.Fader(1.0, 0.0), S(2.0)).Wait(); //allPixels.SetAllOnlyColor(Color.Orange); //allPixels.RunEffect(new Effect2.Fader(0.0, 1.0), S(2.0)).Wait(); //allPixels.RunEffect(new Effect2.Fader(1.0, 0.0), S(2.0)).Wait(); //Exec.Execute(candyCane); }; buttonBlue.ActiveChanged += (o, e) => { if (!e.NewState) return; if (mute.HasValue && (DateTime.Now - mute.Value).TotalSeconds < 30) return; if (hours.IsOpen) { if (stateMachine.CurrentState == States.Music1 || stateMachine.CurrentState == States.Music2) { // Stop //stateMachine.SetState(States.Background); return; } switch (this.whichMusic++ % 2) { case 0: stateMachine.SetState(States.Music1); break; case 1: stateMachine.SetState(States.Music2); break; } } else Exec.Execute(offHours1Seq); mute = DateTime.Now; }; buttonRed.ActiveChanged += (o, e) => { if (!e.NewState) return; if (mute.HasValue && (DateTime.Now - mute.Value).TotalSeconds < 30) return; if (hours.IsOpen) { if (stateMachine.CurrentState == States.Vader) return; //stateMachine.SetState(States.Background); else stateMachine.SetState(States.Vader); } else Exec.Execute(offHours2Seq); mute = DateTime.Now; }; audioPlayer.AudioTrackDone += (o, e) => { // switchButtonBlue.SetPower(false); }; pulsatingEffect1 .AddDevice(lightStar); pulsatingStar .AddDevice(lightStar); flickerEffect .AddDevice(lightHat1) .AddDevice(lightHat2) .AddDevice(lightHat3) .AddDevice(lightHat4); hours.OpenHoursChanged += (i, e) => { if (e.IsOpenNow) { stateMachine.SetBackgroundState(States.Background); stateMachine.SetState(States.Background); //lightTreeUp.SetColor(Color.Red, 1.0); //lightSnow1.SetBrightness(1.0); //lightSnow2.SetBrightness(1.0); if (InflatablesRunning) { switchDeerHuge.SetPower(true); switchSanta.SetPower(true); } } else { if (buttonOverrideHours.Active) return; stateMachine.Hold(); stateMachine.SetBackgroundState(null); EverythingOff(); System.Threading.Thread.Sleep(200); switchDeerHuge.TurnOff(); switchSanta.TurnOff(); InflatablesRunning = false; } }; faderIn .AddDevice(lightGarland1) .AddDevice(lightGarland2) .AddDevice(lightGarland3) .AddDevice(lightGarland4) .AddDevice(lightStairs1) .AddDevice(lightStairs2) .AddDevice(lightXmasTree) .AddDevice(lightDeerSmall) .AddDevice(lightDeerLarge) .AddDevice(lightTopperLarge) .AddDevice(lightTopperSmall) .AddDevice(lightNet1) .AddDevice(lightNet2) .AddDevice(lightString1) .AddDevice(lightString2) .AddDevice(lightSnow1) .AddDevice(lightSnow2) .AddDevice(lightTreeUp); stateMachine.ForFromSequence(States.Background, backgroundLoop); stateMachine.ForFromSequence(States.Music1, music1Seq); stateMachine.ForFromSequence(States.Music2, waveformSeq); stateMachine.ForFromSequence(States.Vader, fatherSeq); hatLightState.For(0).Execute(i => lightHat1.RunEffect(new Effect2.Fader(1.0, 0.0), S(0.5))); hatLightState.For(1).Execute(i => lightHat2.RunEffect(new Effect2.Fader(1.0, 0.0), S(0.5))); hatLightState.For(2).Execute(i => lightHat3.RunEffect(new Effect2.Fader(1.0, 0.0), S(0.5))); hatLightState.For(3).Execute(i => lightHat4.RunEffect(new Effect2.Fader(1.0, 0.0), S(0.5))); hatLightState.For(4).Execute(i => lightHat3.RunEffect(new Effect2.Fader(1.0, 0.0), S(0.5))); hatLightState.For(5).Execute(i => lightHat2.RunEffect(new Effect2.Fader(1.0, 0.0), S(0.5))); //lightGarland1.Follow(hours); //lightGarland2.Follow(hours); //lightGarland3.Follow(hours); //lightGarland4.Follow(hours); //lightGarland5.Follow(hours); //lightXmasTree.Follow(hours); //lightStairs1.Follow(hours); //lightDeerSmall.Follow(hours); //lightDeerLarge.Follow(hours); //lightTopperLarge.Follow(hours); //lightTopperSmall.Follow(hours); //lightNet1.Follow(hours); //lightNet2.Follow(hours); //lightString1.Follow(hours); //lightString2.Follow(hours); //light3wise.Follow(hours); //lightVader.Follow(hours); //switchButtonBlue.Follow(hours); //switchButtonRed.Follow(hours); ConfigureMusic1(); }
public override void Start() { pulsatingEffect1.AddDevice(lightHatsRight); pulsatingEffect2 .AddDevice(lightCeiling1) .AddDevice(lightCeiling2) .AddDevice(lightCeiling3); candyCane .WhenExecuted .SetUp(() => allPixels.TurnOff()) .Execute(instance => { const int spacing = 4; while (true) { for (int i = 0; i < spacing; i++) { allPixels.Inject((i % spacing) == 0 ? Color.Red : Color.White, 1.0); instance.WaitFor(S(0.2), true); } } }) .TearDown(() => allPixels.TurnOff()); starwarsCane .WhenExecuted .Execute(instance => { const int spacing = 4; allPixels.TurnOff(); while (!instance.CancelToken.IsCancellationRequested) { for (int i = 0; i < spacing; i++) { switch (i % spacing) { case 0: case 1: allPixels.InjectRev(Color.Yellow, 1.0); break; case 2: case 3: allPixels.InjectRev(Color.Orange, 0.2); break; } instance.WaitFor(S(0.1)); if (instance.IsCancellationRequested) break; } } allPixels.TurnOff(); }); backgroundLoop .WhenExecuted .SetUp(() => { pulsatingEffect1.Start(); lightGarlandLeft.Brightness = 1; lightGarlandRight.Brightness = 1; lightIcicles.Brightness = 1; lightTreesRight.Brightness = 1; lightHatsRight.Brightness = 1; lightNetLeft.Brightness = 0.5; lightNetRight.Brightness = 0.5; lightReindeers.Brightness = 1; lightTree.Brightness = 1; lightCeiling1.SetColor(Color.Red, 0.5); lightCeiling2.SetColor(Color.Red, 0.5); lightCeiling3.SetColor(Color.Red, 0.5); Executor.Current.Execute(candyCane); }) .TearDown(() => { Executor.Current.Cancel(candyCane); EverythingOff(); }); musicSeq .Loop .WhenExecuted .SetUp(() => { audioPlayer.CueTrack("21 Christmas Canon Rock"); // Make sure it's ready System.Threading.Thread.Sleep(800); EverythingOff(); }) .Execute(instance => { audioPlayer.PlayTrack(); var task = timeline.Start(); try { task.Wait(instance.CancelToken); instance.WaitFor(S(10)); } finally { timeline.Stop(); audioPlayer.PauseTrack(); } if (!instance.IsCancellationRequested) instance.WaitFor(S(2)); EverythingOff(); instance.WaitFor(S(2), true); Executor.Current.Execute(backgroundLoop); instance.WaitFor(S(30)); Executor.Current.Cancel(backgroundLoop); EverythingOff(); instance.WaitFor(S(1)); }) .TearDown(() => { EverythingOff(); }); buttonSeq .Loop .WhenExecuted .Execute(instance => { buttonLightBlue.SetPower(true); buttonLightRed.SetPower(false); instance.WaitFor(S(0.2)); buttonLightBlue.SetPower(false); buttonLightRed.SetPower(true); instance.WaitFor(S(0.2)); }) .TearDown(() => { buttonLightBlue.SetPower(false); buttonLightRed.SetPower(false); }); fatherSeq .WhenExecuted .Execute(instance => { Executor.Current.Execute(starwarsCane); EverythingOff(); audioPlayer.CueTrack("01 Star Wars_ Main Title"); // Make sure it's ready instance.WaitFor(S(0.5)); audioPlayer.PlayTrack(); lightCeiling1.SetOnlyColor(Color.Yellow); lightCeiling2.SetOnlyColor(Color.Yellow); lightCeiling3.SetOnlyColor(Color.Yellow); pulsatingEffect2.Start(); instance.WaitFor(S(16)); pulsatingEffect2.Stop(); audioPlayer.PauseTrack(); Executor.Current.Cancel(starwarsCane); allPixels.TurnOff(); instance.WaitFor(S(0.5)); elJesus.SetPower(true); lightJesus.SetColor(Color.White, 0.3); instance.WaitFor(S(1.5)); elLightsaber.SetPower(true); audioPlayer.PlayEffect("saberon"); instance.WaitFor(S(1)); lightVader.SetColor(Color.Red, 1.0); audioPlayer.PlayEffect("father"); instance.WaitFor(S(3)); lightVader.TurnOff(); audioPlayer.PlayEffect("saberoff"); instance.WaitFor(S(0.5)); elLightsaber.SetPower(false); instance.WaitFor(S(1)); lightJesus.TurnOff(); elLightsaber.TurnOff(); elJesus.TurnOff(); }); breathSeq .WhenExecuted .Execute(instance => { audioPlayer.PlayEffect("Darth Breathing"); instance.WaitFor(S(4)); }); laserSeq .WhenExecuted .SetUp(() => { allPixels.TurnOff(); }) .Execute(instance => { audioPlayer.PlayEffect("lazer"); var cb = new ColorBrightness[6]; cb[0] = new ColorBrightness(Color.Black, 1.0); cb[1] = new ColorBrightness(Color.Red, 1.0); cb[2] = new ColorBrightness(Color.Orange, 1.0); cb[3] = new ColorBrightness(Color.Yellow, 1.0); cb[4] = new ColorBrightness(Color.Blue, 1.0); cb[5] = new ColorBrightness(Color.White, 1.0); for (int i = -6; i < allPixels.Pixels; i++) { allPixels.SetColors(i, cb); System.Threading.Thread.Sleep(25); } instance.WaitFor(S(1)); }) .TearDown(() => { allPixels.TurnOff(); }); stateMachine.ForFromSequence(States.Background, backgroundLoop); stateMachine.ForFromSequence(States.Music, musicSeq); stateMachine.ForFromSequence(States.Vader, fatherSeq); // Start Reindeer buttonStartReindeer.ActiveChanged += (sender, e) => { if (!e.NewState) return; if (hours.IsOpen) bigReindeer.SetPower(true); else { TestAllPixels(Color.Red, 1.0, S(1)); TestAllPixels(Color.Red, 0.5, S(1)); TestAllPixels(Color.Green, 1.0, S(1)); TestAllPixels(Color.Green, 0.5, S(1)); TestAllPixels(Color.Blue, 1.0, S(1)); TestAllPixels(Color.Blue, 0.5, S(1)); TestAllPixels(Color.Purple, 1.0, S(1)); TestAllPixels(Color.Purple, 0.5, S(1)); TestAllPixels(Color.White, 1.0, S(1)); TestAllPixels(Color.White, 0.5, S(1)); allPixels.TurnOff(); } }; // Red Button buttonRed.ActiveChanged += (sender, e) => { if (!e.NewState) return; if (hours.IsOpen) { stateMachine.SetMomentaryState(States.Vader); } else { Executor.Current.Execute(laserSeq); } }; // Blue Button buttonBlue.ActiveChanged += (sender, e) => { if (!e.NewState) return; if (hours.IsOpen) { if (stateMachine.CurrentState == States.Background) stateMachine.SetMomentaryState(States.Music); } else { Executor.Current.Execute(breathSeq); } }; // Hours hours.OpenHoursChanged += (sender, e) => { if (e.IsOpenNow) { stateMachine.SetState(States.Background); Executor.Current.Execute(buttonSeq); } else { Executor.Current.Cancel(buttonSeq); stateMachine.Hold(); bigReindeer.SetPower(false); } }; }
public virtual Pixel1D SetColors(int startChannel, ColorBrightness[] colorBrightness) { int? firstChannel = null; int lastChannel = 0; for (int i = 0; i < colorBrightness.Length; i++) { if (i + startChannel < 0) continue; if (i + startChannel >= Pixels) continue; if (!firstChannel.HasValue) firstChannel = i + startChannel; lastChannel = i + startChannel; this.color[i + startChannel] = colorBrightness[i].Color; this.brightness[i + startChannel] = colorBrightness[i].Brightness; } if (firstChannel.HasValue) RaiseMultiPixelChanged(firstChannel.Value, lastChannel - firstChannel.Value + 1); return this; }
public void Start() { var explosion = new Sequence("Explosion"); explosion.WhenExecuted .Execute(instance => { audioPlayer.PlayEffect("18384__inferno__largex"); instance.WaitFor(TimeSpan.FromMilliseconds(300)); int d = 100; explosion1.SetBrightness(1); instance.WaitFor(TimeSpan.FromMilliseconds(d)); explosion1.SetBrightness(0.5); explosion2.SetBrightness(1); instance.WaitFor(TimeSpan.FromMilliseconds(d)); explosion1.TurnOff(); explosion2.SetBrightness(0.5); explosion3.SetBrightness(1); instance.WaitFor(TimeSpan.FromMilliseconds(d)); explosion2.TurnOff(); explosion3.SetBrightness(0.5); explosion4.SetBrightness(1); instance.WaitFor(TimeSpan.FromMilliseconds(d)); explosion3.TurnOff(); explosion4.SetBrightness(0.5); instance.WaitFor(TimeSpan.FromMilliseconds(d)); explosion4.TurnOff(); }); var seq = new Sequence("Seq"); seq.WhenExecuted .Execute(instance => { // audioPlayer.PlayEffect("tie_fighter"); // x.WaitFor(TimeSpan.FromSeconds(2)); audioPlayer.PlayEffect("Lazer"); instance.WaitFor(TimeSpan.FromMilliseconds(300)); audioPlayer.PlayEffect("Lazer"); var cb = new ColorBrightness[6]; cb[0] = new ColorBrightness(Color.Black, 1.0); cb[1] = new ColorBrightness(Color.Red, 1.0); cb[2] = new ColorBrightness(Color.Orange, 1.0); cb[3] = new ColorBrightness(Color.Yellow, 1.0); cb[4] = new ColorBrightness(Color.Blue, 1.0); cb[5] = new ColorBrightness(Color.White, 1.0); for (int i = -6; i < 50; i++) { testPixels.SetColors(i, cb); instance.WaitFor(TimeSpan.FromMilliseconds(10)); } if (random.Next(10) > 5) Executor.Current.Execute(explosion); }); // flickerEffect.AddDevice(candyLight); testButton.ActiveChanged += (sender, e) => { if (e.NewState) { Console.WriteLine("Button press!"); Executor.Current.Execute(seq); // audioPlayer.PlayEffect("Lazer"); } else { Console.WriteLine("Button depress!"); // testPixels.SetColor(0, Color.Blue); } }; }
public override void Start() { testSeq .WhenExecuted .SetUp(() => allPixels.TurnOff()) .Execute(instance => { allPixels.SetAllOnlyColor(Color.Orange); allPixels.RunEffect(new Effect2.Pulse(0.0, 1.0), S(2.0)) .SetIterations(2) .Wait(); allPixels.StopEffect(); }) .TearDown(() => { allPixels.TurnOff(); Exec.Execute(candyCane); }); candyCane .WhenExecuted .SetUp(() => allPixels.TurnOff()) .Execute(instance => { const int spacing = 4; while (true) { for (int i = 0; i < spacing; i++) { allPixels.Inject((i % spacing) == 0 ? Color.Red : Color.White, 0.5); instance.WaitFor(S(0.30), true); } } }) .TearDown(() => { allPixels.TurnOff(); }); laserSeq .WhenExecuted .SetUp(() => { allPixels.TurnOff(); }) .Execute(instance => { var cb = new ColorBrightness[6]; cb[0] = new ColorBrightness(Color.Black, 1.0); cb[1] = new ColorBrightness(Color.Red, 1.0); cb[2] = new ColorBrightness(Color.Orange, 1.0); cb[3] = new ColorBrightness(Color.Yellow, 1.0); cb[4] = new ColorBrightness(Color.Blue, 1.0); cb[5] = new ColorBrightness(Color.White, 1.0); for (int i = -6; i < allPixels.Pixels; i++) { allPixels.SetColors(i, cb); System.Threading.Thread.Sleep(25); } instance.WaitFor(S(1)); }) .TearDown(() => { allPixels.TurnOff(); Exec.Execute(candyCane); }); // Test Button buttonTest.ActiveChanged += (sender, e) => { if (!e.NewState) return; Exec.Cancel(candyCane); allPixels.RunEffect(new Effect2.Fader(1.0, 0.0), S(2.0)).Wait(); allPixels.SetAllOnlyColor(Color.Purple); allPixels.RunEffect(new Effect2.Fader(0.0, 1.0), S(2.0)).Wait(); allPixels.RunEffect(new Effect2.Fader(1.0, 0.0), S(2.0)).Wait(); allPixels.SetAllOnlyColor(Color.Orange); allPixels.RunEffect(new Effect2.Fader(0.0, 1.0), S(2.0)).Wait(); allPixels.RunEffect(new Effect2.Fader(1.0, 0.0), S(2.0)).Wait(); Exec.Execute(candyCane); }; }
//IDEA: Fade to new array of ColorBrightness public VirtualPixel1D Inject(ColorBrightness colorBrightness) { Inject(colorBrightness.Color, colorBrightness.Brightness); return(this); }
public Halloween2016(IEnumerable<string> args) { hoursSmall.AddRange("6:00 pm", "8:30 pm", DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday); hoursSmall.AddRange("5:00 pm", "9:00 pm", DayOfWeek.Friday, DayOfWeek.Saturday, DayOfWeek.Sunday); hoursFull.AddRange("6:00 pm", "8:30 pm"); //hoursFull.Disabled = true; hoursSmall.Disabled = true; // Logging hoursSmall.Output.Log("Hours small"); hoursFull.Output.Log("Hours full"); 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 = expanderServer.ExpanderSharedFiles = parts[1]; } } expanderServer.AddInstance("ed86c3dc166f41ee86626897ba039ed2", expanderLedmx); // rpi-eb0092ca expanderServer.AddInstance("1583f686014345888c15d7fc9c55ca3c", expanderCat); // rpi-eb81c94e expanderServer.AddInstance("4ea781ef257442edb524493da8f52220", expanderAudio2); // rpi-eba6cbc7 expanderServer.AddInstance("76d09e6032d54e77aafec90e1fc4b35b", expanderHifi); // rpi-eb428ef1 expanderServer.AddInstance("60023fcde5b549b89fa828d31741dd0c", expanderPicture); // rpi-eb91bc26 expanderServer.AddInstance("e41d2977931d4887a9417e8adcd87306", expanderGhost); // rpi-eb6a047c expanderServer.AddInstance("999861affa294fd7bbf0601505e9ae09", expanderPop); // rpi-ebd43a38 masterVolume.ConnectTo(Exec.MasterVolume); hoursSmall .ControlsMasterPower(catAir) .ControlsMasterPower(mrPumpkinAir); hoursFull .ControlsMasterPower(catAir) .ControlsMasterPower(mrPumpkinAir); buttonOverrideHours.Output.Subscribe(x => { if (x) hoursFull.SetForced(true); else hoursFull.SetForced(null); }); flashBaby.Output.Subscribe(x => { // Flash if (x) { allLights.TakeAndHoldControl(100, "FlashBaby"); allLights.SetBrightness(1.0, new Data(DataElements.Color, Color.White)); } else allLights.ReleaseControl(); }); floodLights.Output.Subscribe(x => { // Flash if (x) { allLights.TakeAndHoldControl(200, "FlashBaby"); allLights.SetBrightness(1.0, new Data(DataElements.Color, Color.White)); } else allLights.ReleaseControl(); }); emergencyStop.Output.Subscribe(x => { if (x) { stateMachine.GoToState(States.EmergencyStop); } else { if (hoursFull.IsOpen || hoursSmall.IsOpen) stateMachine.GoToDefaultState(); else stateMachine.GoToIdle(); } }); hoursFull.Output.Subscribe(x => { if (x) { stateMachine.SetDefaultState(States.BackgroundFull); if (emergencyStop.Value) stateMachine.GoToState(States.EmergencyStop); else stateMachine.GoToDefaultState(); } else { stateMachine.GoToIdle(); stateMachine.SetDefaultState(null); } SetManualColor(); }); hoursSmall.Output.Subscribe(x => { if (x) { stateMachine.SetDefaultState(States.BackgroundSmall); stateMachine.GoToDefaultState(); } else { stateMachine.GoToIdle(); stateMachine.SetDefaultState(null); } SetManualColor(); }); popOut1.ConnectTo(wall1Light); popOut1.ConnectTo(wall4Light); popOut1.ConnectTo(wall6Light); popOut1.ConnectTo(flash1); popOut2.ConnectTo(wall2Light); popOut2.ConnectTo(wall7Light); popOut2.ConnectTo(flash2); popOutAll.ConnectTo(wall1Light); popOutAll.ConnectTo(wall2Light); popOutAll.ConnectTo(wall3Light); popOutAll.ConnectTo(wall4Light); popOutAll.ConnectTo(wall5Light); popOutAll.ConnectTo(wall6Light); popOutAll.ConnectTo(wall7Light); popOutAll.ConnectTo(wall8Light); popOutAll.ConnectTo(wall9Light); popOutAll.ConnectTo(flash1); popOutAll.ConnectTo(flash2); popOutAll.ConnectTo(pixelsRoofEdge); // popOutAll.ConnectTo(pinSpot); allLights.Add( wall1Light, wall2Light, wall3Light, wall4Light, wall5Light, wall6Light, wall7Light, wall8Light, wall9Light, flash1, flash2, pixelsRoofEdge, // pinSpot, spiderLight, spiderWebLights, pumpkinLights); purpleLights.Add( wall1Light, wall2Light, wall3Light, wall4Light, wall5Light, wall6Light, wall7Light, wall8Light, wall9Light, pixelsRoofEdge); flickerEffect.ConnectTo(stairs1Light); flickerEffect.ConnectTo(stairs2Light); flickerEffect.ConnectTo(gargoyleLightsEyes); flickerEffect.ConnectTo(flyingSkeletonEyes); flickerEffect.ConnectTo(streetNumberEyes); flickerEffect.ConnectTo(bigSpiderEyes); pulsatingGargoyle.ConnectTo(gargoyleLightsCrystal); pulsatingGargoyle.ConnectTo(treeSkulls); pulsatingGargoyle.ConnectTo(spiderEyes); //pulsatingEffect1.ConnectTo(pinSpot, Tuple.Create<DataElements, object>(DataElements.Color, Color.FromArgb(0, 255, 0))); //pulsatingEffect2.ConnectTo(pinSpot, Tuple.Create<DataElements, object>(DataElements.Color, Color.FromArgb(255, 0, 0))); pulsatingCatLow.ConnectTo(catLights); pulsatingCatHigh.ConnectTo(catLights); pulsatingPumpkinLow.ConnectTo(pumpkinLights); pulsatingPumpkinHigh.ConnectTo(pumpkinLights); pulsatingGargoyle.ConnectTo(spiderWebLights); stateMachine.For(States.BackgroundSmall) .Controls(1, flickerEffect, pulsatingGargoyle, pulsatingCatLow, pulsatingPumpkinLow) .Execute(i => { treeGhosts.SetBrightness(1.0); treeSkulls.SetBrightness(1.0); audio2.SetBackgroundVolume(0.5); var purpleColor = new ColorBrightness(HSV.ColorFromRGB(0.73333333333333328, 0, 1), 0.16470588235294117); purpleLights.SetBrightness(purpleColor.Brightness, new Data( Utils.AdditionalData(DataElements.Color, purpleColor.Color), Utils.AdditionalData(DataElements.ColorUltraViolet, 1.0))); i.WaitUntilCancel(); }) .TearDown(instance => { purpleLights.SetBrightness(0.0); treeGhosts.SetBrightness(0.0); treeSkulls.SetBrightness(0.0); }); stateMachine.For(States.BackgroundFull) .Controls(1, flickerEffect, pulsatingGargoyle, pulsatingCatLow, pulsatingPumpkinLow) .Execute(i => { treeGhosts.SetBrightness(1.0); treeSkulls.SetBrightness(1.0); audioHifi.PlayBackground(); audio2.SetBackgroundVolume(0.5); audio2.PlayBackground(); var purpleColor = new ColorBrightness(HSV.ColorFromRGB(0.73333333333333328, 0, 1), 0.16470588235294117); purpleLights.SetBrightness(purpleColor.Brightness, new Data(DataElements.Color, purpleColor.Color)); while (!i.IsCancellationRequested && stateMachine.CurrentState == States.BackgroundFull) { i.WaitFor(S(0.5)); if (!this.lastFogRun.HasValue || (DateTime.Now - this.lastFogRun.Value).TotalMinutes > 5) { // Run the fog for a little while fog.SetValue(true); i.WaitFor(S(4)); fog.SetValue(false); this.lastFogRun = DateTime.Now; } } }) .TearDown(instance => { purpleLights.SetBrightness(0.0); treeGhosts.SetBrightness(0.0); treeSkulls.SetBrightness(0.0); audioHifi.PauseBackground(); audio2.PauseBackground(); timelineThunder1.Stop(); timelineThunder2.Stop(); timelineThunder3.Stop(); timelineThunder4.Stop(); timelineThunder5.Stop(); timelineThunder6.Stop(); timelineThunder7.Stop(); timelineThunder8.Stop(); flickerEffect.Stop(); treeGhosts.SetBrightness(0.0); treeSkulls.SetBrightness(0.0); }); stateMachine.For(States.EmergencyStop) .Execute(i => { // Do nothing i.WaitUntilCancel(); }); stateMachine.For(States.Special1) .Execute(i => { audio2.PlayNewEffect("640 The Demon Exorcised.wav"); i.WaitUntilCancel(); }); inputBrightness.Output.Subscribe(x => { // testLight1.SetBrightness(x); }); inputH.WhenOutputChanges(x => { // testLight1.SetColor(HSV.ColorFromHSV(x.GetByteScale(), inputS.Value, 1.0)); }); inputS.Output.Subscribe(x => { // testLight1.SetColor(HSV.ColorFromHSV(inputH.Value.GetByteScale(), x, 1.0)); }); expanderHifi.AudioTrackStart.Subscribe(x => { // Next track switch (x.Item2) { case "Thunder1.wav": timelineThunder1.Start(); audio2.PlayEffect("scream.wav"); break; case "Thunder2.wav": timelineThunder2.Start(); break; case "Thunder3.wav": timelineThunder3.Start(); break; case "Thunder4.wav": timelineThunder4.Start(); audio2.PlayEffect("424 Coyote Howling.wav"); break; case "Thunder5.wav": timelineThunder5.Start(); // audioEeebox.PlayEffect("sixthsense-deadpeople.wav"); break; case "Thunder6.wav": timelineThunder6.Start(); break; case "Thunder7.wav": timelineThunder7.Start(); break; case "Thunder8.wav": timelineThunder8.Start(); break; default: log.Debug("Unknown track {0}", x); break; } }); 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; acnOutput.Connect(new Physical.Pixel1D(pixelsRoofEdge, 0, 50, true), SacnUniversePixel50, 1); acnOutput.Connect(new Physical.Pixel1D(pixelsRoofEdge, 50, 100), SacnUniversePixel100, 1); //acnOutput.Connect(new Physical.SmallRGBStrobe(spiderLight, 1), SacnUniverseDMXLedmx); acnOutput.Connect(new Physical.RGBStrobe(wall6Light, 60), SacnUniverseDMXLedmx); acnOutput.Connect(new Physical.RGBStrobe(wall9Light, 70), SacnUniverseDMXLedmx); acnOutput.Connect(new Physical.RGBStrobe(wall8Light, 40), SacnUniverseDMXCat); acnOutput.Connect(new Physical.RGBStrobe(wall7Light, 80), SacnUniverseDMXLedmx); acnOutput.Connect(new Physical.MarcGamutParH7(wall1Light, 310, 8), SacnUniverseDMXCat); acnOutput.Connect(new Physical.MarcGamutParH7(wall2Light, 300, 8), SacnUniverseDMXCat); acnOutput.Connect(new Physical.MFL7x10WPar(wall3Light, 320), SacnUniverseDMXLedmx); acnOutput.Connect(new Physical.MarcGamutParH7(wall4Light, 330, 8), SacnUniverseDMXLedmx); acnOutput.Connect(new Physical.MarcGamutParH7(wall5Light, 340, 8), SacnUniverseDMXLedmx); // acnOutput.Connect(new Physical.MarcGamutParH7(wall6Light, 350, 8), SacnUniverseDMXLedmx); acnOutput.Connect(new Physical.GenericDimmer(stairs1Light, 97), SacnUniverseDMXCat); acnOutput.Connect(new Physical.GenericDimmer(stairs2Light, 98), SacnUniverseDMXCat); acnOutput.Connect(new Physical.GenericDimmer(treeGhosts, 52), SacnUniverseDMXLedmx); acnOutput.Connect(new Physical.GenericDimmer(treeSkulls, 263), SacnUniverseDMXLedmx); acnOutput.Connect(new Physical.GenericDimmer(spiderEyes, 262), SacnUniverseDMXLedmx); acnOutput.Connect(new Physical.GenericDimmer(popperEyes, 259), SacnUniverseDMXLedmx); acnOutput.Connect(new Physical.AmericanDJStrobe(flash1, 100), SacnUniverseDMXLedmx); acnOutput.Connect(new Physical.EliminatorFlash192(flash2, 110), SacnUniverseDMXLedmx); // acnOutput.Connect(new Physical.MonopriceRGBWPinSpot(pinSpot, 20), 1); acnOutput.Connect(new Physical.GenericDimmer(catAir, 10), SacnUniverseDMXCat); acnOutput.Connect(new Physical.GenericDimmer(mrPumpkinAir, 50), SacnUniverseDMXLedmx); acnOutput.Connect(new Physical.GenericDimmer(catLights, 96), SacnUniverseDMXCat); acnOutput.Connect(new Physical.GenericDimmer(spiderWebLights, 99), SacnUniverseDMXCat); acnOutput.Connect(new Physical.GenericDimmer(pumpkinLights, 51), SacnUniverseDMXLedmx); acnOutput.Connect(new Physical.GenericDimmer(gargoyleLightsCrystal, 128), SacnUniverseDMXCat); acnOutput.Connect(new Physical.GenericDimmer(gargoyleLightsEyes, 129), SacnUniverseDMXCat); acnOutput.Connect(new Physical.GenericDimmer(flyingSkeletonEyes, 130), SacnUniverseDMXCat); acnOutput.Connect(new Physical.GenericDimmer(streetNumberEyes, 131), SacnUniverseDMXCat); acnOutput.Connect(new Physical.GenericDimmer(bigSpiderEyes, 132), SacnUniverseDMXCat); acnOutput.Connect(new Physical.GenericDimmer(hazerFanSpeed, 500), SacnUniverseDMXCat); acnOutput.Connect(new Physical.GenericDimmer(hazerHazeOutput, 501), SacnUniverseDMXCat); // acnOutput.Connect(new Physical.RGBIS(testLight1, 260), 1); expanderLedmx.DigitalInputs[4].Connect(pumpkinMotion, false); expanderCat.DigitalInputs[4].Connect(catMotion, false); expanderCat.DigitalInputs[5].Connect(secondBeam); expanderCat.DigitalInputs[6].Connect(firstBeam); expanderLedmx.DigitalInputs[5].Connect(ghostBeam); expanderLedmx.DigitalInputs[6].Connect(lastBeam); expanderPop.DigitalOutputs[7].Connect(popper); expanderPop.DigitalOutputs[6].Connect(fog); expanderCat.DigitalOutputs[7].Connect(spiderJump1); expanderCat.DigitalOutputs[6].Connect(spiderJump2); expanderLedmx.Connect(audioPumpkin); expanderCat.Connect(audioCat); expanderHifi.Connect(audioHifi); expanderPop.Connect(audioPop); expanderAudio2.Connect(audio2); expanderPicture.Connect(audioFlying); blockMaster.WhenOutputChanges(x => UpdateOSC()); blockCat.WhenOutputChanges(x => UpdateOSC()); blockFirst.WhenOutputChanges(x => UpdateOSC()); blockPicture.WhenOutputChanges(x => UpdateOSC()); blockGhost.WhenOutputChanges(x => UpdateOSC()); blockLast.WhenOutputChanges(x => UpdateOSC()); blockPumpkin.WhenOutputChanges(x => UpdateOSC()); catMotion.Output.Subscribe(x => { if (x && (hoursFull.IsOpen || hoursSmall.IsOpen) && !blockMaster.Value && !blockCat.Value) Executor.Current.Execute(catSeq); oscServer.SendAllClients("/1/led1", x ? 1 : 0); }); pumpkinMotion.Output.Subscribe(x => { if (x && (hoursFull.IsOpen || hoursSmall.IsOpen) && !blockMaster.Value && !blockPumpkin.Value) Executor.Current.Execute(pumpkinSeq); // oscServer.SendAllClients("/1/led1", x ? 1 : 0); }); firstBeam.Output.Subscribe(x => { UpdateOSC(); if (x && hoursFull.IsOpen && !emergencyStop.Value && !blockMaster.Value && !blockFirst.Value) subFirst.Run(); }); secondBeam.Output.Subscribe(x => { UpdateOSC(); if (x && hoursFull.IsOpen && !emergencyStop.Value && !blockMaster.Value && !blockPicture.Value) subPicture.Run(); }); ghostBeam.Output.Subscribe(x => { UpdateOSC(); if (x && hoursFull.IsOpen && !emergencyStop.Value && !blockMaster.Value && !blockGhost.Value) subGhost.Run(); }); lastBeam.Output.Subscribe(x => { UpdateOSC(); if (x && hoursFull.IsOpen && !emergencyStop.Value && !blockMaster.Value && !blockLast.Value) subLast.Run(); }); subFog .RunAction(i => { fog.SetValue(true); lastFogRun = DateTime.Now; i.WaitFor(S(6)); fog.SetValue(false); }); subFirst .AutoAddDevices(lockPriority: 100) .RunAction(i => { flyingSkeletonEyes.SetBrightness(1.0); wall3Light.SetColor(Color.FromArgb(255, 0, 100), 0.5); wall3Light.SetStrobeSpeed(1.0, i.Token); // audioPicture.PlayEffect("162 Blood Curdling Scream of Terror.wav"); //audioFlying.PlayEffect("05 I'm a Little Teapot.wav", 0.05); audioFlying.PlayEffect("Who is that knocking.wav"); i.WaitFor(S(3.0)); audioFlying.PlayEffect("Evil-Laugh.wav"); i.WaitFor(S(2.0)); }) .TearDown(i => { Exec.MasterEffect.Fade(wall3Light, 0.5, 0.0, 2000, token: i.Token).Wait(); }); subPicture .RunAction(i => { if (bigSpiderEyesToken != null) bigSpiderEyesToken.Dispose(); wall8Light.SetColor(Color.White, 1, bigSpiderEyesToken); wall8Light.SetStrobeSpeed(1, bigSpiderEyesToken); bigSpiderEyesToken = bigSpiderEyes.TakeControl(100); bigSpiderEyes.SetBrightness(0, bigSpiderEyesToken); audioHifi.PlayNewEffect("Happy Halloween.wav"); expanderPicture.SendSerial(0, new byte[] { 0x02 }); i.WaitFor(S(4.0)); sub3dfxRandom.Run(); i.WaitFor(S(10.0)); wall8Light.SetBrightness(0); subSpiderJump.Run(); i.WaitFor(S(4.0)); }) .TearDown(i => { }); subSpiderJump .RunAction(i => { if (bigSpiderEyesToken == null) bigSpiderEyesToken = bigSpiderEyes.TakeControl(100); audio2.PlayNewEffect("348 Spider Hiss.wav", 0, 1); bigSpiderEyes.SetBrightness(1, bigSpiderEyesToken); spiderJump1.SetValue(true); i.WaitFor(S(0.5)); spiderJump2.SetValue(true); i.WaitFor(S(2.0)); spiderJump1.SetValue(false); spiderJump2.SetValue(false); }) .TearDown(i => { bigSpiderEyesToken?.Dispose(); bigSpiderEyesToken = null; }); sub3dfxRandom .RunAction(i => { byte video; do { video = (byte)(random.Next(3) + 1); } while (video == last3dfxVideo); last3dfxVideo = video; expanderLedmx.SendSerial(0, new byte[] { video }); i.WaitFor(S(12.0)); }) .TearDown(i => { }); sub3dfxLady .RunAction(i => { expanderLedmx.SendSerial(0, new byte[] { 0x02 }); i.WaitFor(S(12.0)); }) .TearDown(i => { }); sub3dfxMan .RunAction(i => { expanderLedmx.SendSerial(0, new byte[] { 0x03 }); i.WaitFor(S(12.0)); }) .TearDown(i => { }); sub3dfxKids .RunAction(i => { expanderLedmx.SendSerial(0, new byte[] { 0x01 }); i.WaitFor(S(12.0)); }) .TearDown(i => { }); subGhost .RunAction(i => { expanderGhost.SendSerial(0, new byte[] { 0x01 }); i.WaitFor(S(12.0)); }) .TearDown(i => { }); subLast .RunAction(i => { popperEyes.SetBrightness(1.0); fog.SetValue(true); lastFogRun = DateTime.Now; audioPop.PlayEffect("Short Laugh.wav"); i.WaitFor(S(1.0)); popper.SetValue(true); i.WaitFor(S(2.0)); audioPop.PlayEffect("Leave Now.wav"); i.WaitFor(S(3.0)); var tsk = Exec.MasterEffect.Fade(popperEyes, 1.0, 0.0, 2000, token: i.Token); popper.SetValue(false); tsk.Wait(); }) .TearDown(i => { fog.SetValue(false); i.WaitFor(S(1.0)); }); catSeq.WhenExecuted .Execute(instance => { var maxRuntime = System.Diagnostics.Stopwatch.StartNew(); pulsatingCatLow.Stop(); pulsatingCatHigh.Start(); // catLights.SetBrightness(1.0, instance.Token); while (true) { switch (random.Next(4)) { case 0: audioCat.PlayEffect("266 Monster Growl 7.wav", 1.0, 1.0); instance.WaitFor(TimeSpan.FromSeconds(2.0)); break; case 1: audioCat.PlayEffect("285 Monster Snarl 2.wav", 1.0, 1.0); instance.WaitFor(TimeSpan.FromSeconds(3.0)); break; case 2: audioCat.PlayEffect("286 Monster Snarl 3.wav", 1.0, 1.0); instance.WaitFor(TimeSpan.FromSeconds(2.5)); break; case 3: audioCat.PlayEffect("287 Monster Snarl 4.wav", 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(instance => { // Exec.MasterEffect.Fade(catLights, 1.0, 0.0, 1000, token: instance.Token); //TODO: Fade out pulsatingCatHigh.Stop(); pulsatingCatLow.Start(); }); pumpkinSeq.WhenExecuted .Execute(instance => { pulsatingPumpkinLow.Stop(); pulsatingPumpkinHigh.Start(); if (hoursFull.IsOpen) audioPumpkin.PlayEffect("Thriller2.wav"); else audioPumpkin.PlayEffect("Happy Halloween.wav"); instance.CancelToken.WaitHandle.WaitOne(40000); }) .TearDown(instance => { pulsatingPumpkinHigh.Stop(); pulsatingPumpkinLow.Start(); }); motionSeq.WhenExecuted .Execute(instance => { //video2.PlayVideo("DancingDead_Wall_HD.mp4"); // instance.WaitFor(S(10)); }) .TearDown(instance => { }); faderR.WhenOutputChanges(v => { SetManualColor(); }); faderG.WhenOutputChanges(v => { SetManualColor(); }); faderB.WhenOutputChanges(v => { SetManualColor(); }); faderBright.WhenOutputChanges(v => { SetManualColor(); }); manualFader.WhenOutputChanges(v => { if (v) this.manualFaderToken = pixelsRoofEdge.TakeControl(200); else { this.manualFaderToken?.Dispose(); this.manualFaderToken = null; } oscServer.SendAllClients("/ManualFader/x", v ? 1 : 0); SetManualColor(); }); ConfigureOSC(); ConfigureMIDI(); }
public Pixel1D FadeTo(ColorBrightness[] values, TimeSpan duration) { if (values.Length != this.pixelCount) throw new ArgumentOutOfRangeException("Invalid ColorBrightness length"); var startColors = new Color[this.pixelCount]; var startBrightness = new double[this.pixelCount]; for (int chn = 0; chn < this.pixelCount; chn++) { if (this.color[chn].GetBrightness() == 0) { this.color[chn] = values[chn].Color; this.brightness[chn] = 0; } if (values[chn].Color.GetBrightness() == 0) { values[chn].Color = this.color[chn]; values[chn].Brightness = 0; } startColors[chn] = this.color[chn]; startBrightness[chn] = this.brightness[chn]; } // 10 steps per second int steps = (int)(duration.TotalMilliseconds / 100); for (int i = 1; i < steps; i++) { double position = 1.0 * i / (steps - 1); for (int chn = 0; chn < values.Length; chn++) { double newBrightness = startBrightness[chn] + (values[chn].Brightness - startBrightness[chn]) * position; int r = (int)(startColors[chn].R + (values[chn].Color.R - startColors[chn].R) * position); int g = (int)(startColors[chn].G + (values[chn].Color.G - startColors[chn].G) * position); int b = (int)(startColors[chn].B + (values[chn].Color.B - startColors[chn].B) * position); Color newColor = Color.FromArgb(r, g, b); this.color[chn] = newColor; this.brightness[chn] = newBrightness; } RaiseMultiPixelChanged(0, values.Length); System.Threading.Thread.Sleep(100); } return this; }
public Pixel1D InjectWithFade(Color color, double brightness, TimeSpan duration) { var newValues = new ColorBrightness[this.pixelCount]; for (int i = this.brightness.Length - 1; i > 0; i--) { newValues[i] = new ColorBrightness(this.color[i - 1], this.brightness[i - 1]); } newValues[0] = new ColorBrightness(color, brightness); FadeTo(newValues, duration); return this; }
//IDEA: Fade to new array of ColorBrightness public VirtualPixel1D Inject(ColorBrightness colorBrightness) { Inject(colorBrightness.Color, colorBrightness.Brightness); return this; }
public virtual VirtualPixel1D SetColors(int startPosition, ColorBrightness[] colorBrightness) { int? firstPosition = null; int lastPosition = 0; for (int i = 0; i < colorBrightness.Length; i++) { if (i + startPosition < 0) continue; if (i + startPosition >= Pixels) continue; if (!firstPosition.HasValue) firstPosition = i + startPosition; lastPosition = i + startPosition; this.color[i + startPosition] = colorBrightness[i].Color; this.brightness[i + startPosition] = colorBrightness[i].Brightness; } if (firstPosition.HasValue) RaiseMultiPixelChanged(firstPosition.Value, lastPosition - firstPosition.Value + 1); return this; }