public Xmas2014(IEnumerable<string> args)
{
hours.AddRange("5:00 pm", "10:00 pm");
// hours.SetForced(true);
//acnOutput.Muted = true;
blackOut.ConnectTo(Exec.Blackout);
whiteOut.ConnectTo(Exec.Whiteout);
midiAkai.Controller(midiChannel, 1).Controls(blackOut.Control);
midiAkai.Controller(midiChannel, 2).Controls(whiteOut.Control);
midiBCF.Controller(0, 87).Controls(blackOut.Control);
midiBCF.Controller(0, 88).Controls(whiteOut.Control);
midiBCF.Controller(0, 91).Controls(x =>
{
if (x.Value == 1)
{
if (hours.IsOpen)
{
inflatablesRunning.OnNext(true);
}
}
});
midiBCF.Controller(0, 92).Controls(x =>
{
buttonSnowMachine.Control.OnNext(x.Value == 1);
});
blackOut.ConnectTo(x =>
{
midiBcfOutput.Send(0, 87, x.GetByteScale(127));
});
whiteOut.ConnectTo(x =>
{
midiBcfOutput.Send(0, 88, x.GetByteScale(127));
});
inflatablesRunning.Subscribe(x =>
{
airReindeer.Value = x;
Exec.SetKey("InflatablesRunning", x.ToString());
});
// Read from storage
inflatablesRunning.OnNext(Exec.GetSetKey("InflatablesRunning", false));
hours.Output.Log("Hours inside");
// movingHead.Pan.Log("Pan");
// movingHead.Tilt.Log("Tilt");
raspberryDarth.Connect(audioDarthVader);
raspberrySnow.DigitalOutputs[0].Connect(snowMachine);
packages.Value = true;
airSnowman.Value = true;
airR2D2.Value = true;
airSanta.Value = true;
hours
.ControlsMasterPower(packages)
.ControlsMasterPower(airSnowman)
.ControlsMasterPower(airR2D2)
.ControlsMasterPower(airSanta);
//TODO airSanta.Follow(hours);
//midiInput.Controller(midiChannel, 1).Controls(
// Observer.Create<double>(x => { allLights.Brightness = x; }));
// pulsatingEffect1.ConnectTo(lightStar.GetBrightnessObserver());
// pulsatingStar.ConnectTo()
buttonStartInflatables.ActiveChanged += (o, e) =>
{
if (e.NewState && hours.IsOpen)
{
inflatablesRunning.OnNext(true);
}
};
lightRoofEdge.OutputBrightness.Subscribe(x =>
{
pixelsRoofEdge.SetAll(lightRoofEdge.Color, x);
});
lightRoofEdge.OutputColor.Subscribe(x =>
{
pixelsRoofEdge.SetAll(x, lightRoofEdge.Brightness);
});
hours.Output.Subscribe(pulsatingEffect1.InputRun);
hours.Output.Subscribe(x =>
{
packages.Value = x;
/*
lightHat1.Brightness = x ? 1.0 : 0.0;
lightHat2.Brightness = x ? 1.0 : 0.0;
lightHat3.Brightness = x ? 1.0 : 0.0;
lightHat4.Brightness = x ? 1.0 : 0.0;
snowmanKaggen.Brightness = x ? 1.0 : 0.0;
lightSnowman.Brightness = x ? 1.0 : 0.0;
lightSanta.Brightness = x ? 1.0 : 0.0;
lightR2D2.Brightness = x ? 1.0 : 0.0;
lightStarExtra.Brightness = x ? 1.0 : 0.0;
lightNet1.Brightness = x ? 1.0 : 0.0;
lightNet2.Brightness = x ? 1.0 : 0.0;
lightNet3.Brightness = x ? 1.0 : 0.0;
lightNet4.Brightness = x ? 1.0 : 0.0;
lightNet5.Brightness = x ? 1.0 : 0.0;
lightNet6.Brightness = x ? 1.0 : 0.0;
lightNet7.Brightness = x ? 1.0 : 0.0;
lightNet8.Brightness = x ? 1.0 : 0.0;
lightNet9.Brightness = x ? 1.0 : 0.0;
lightNet10.Brightness = x ? 1.0 : 0.0;
lightX1.Brightness = x ? 1.0 : 0.0;
lightX2.Brightness = x ? 1.0 : 0.0;
lightX3.Brightness = x ? 1.0 : 0.0;
lightX4.Brightness = x ? 1.0 : 0.0;
lightX5.Brightness = x ? 1.0 : 0.0;
lightX6.Brightness = x ? 1.0 : 0.0;
lightX7.Brightness = x ? 1.0 : 0.0;
lightBushes.Brightness = x ? 1.0 : 0.0;*/
});
acnOutput.Connect(new Physical.PixelRope(pixelsRoofEdge, 0, 50), 4, 1);
acnOutput.Connect(new Physical.PixelRope(pixelsRoofEdge, 50, 100), 5, 1);
acnOutput.Connect(new Physical.PixelRope(saberPixels, 0, 32), 14, 85);
acnOutput.Connect(new Physical.PixelRope(saberSidePixels, 0, 18), 14, 1);
acnOutput.Connect(new Physical.GenericDimmer(airReindeer, 10), SacnUniverseDMX);
acnOutput.Connect(new Physical.GenericDimmer(airSnowman, 11), SacnUniverseDMX);
acnOutput.Connect(new Physical.GenericDimmer(airSanta, 12), SacnUniverseDMX);
acnOutput.Connect(new Physical.GenericDimmer(airR2D2, 13), SacnUniverseDMX);
acnOutput.Connect(new Physical.GenericDimmer(lightStar, 50), SacnUniverseDMX);
acnOutput.Connect(new Physical.GenericDimmer(lightBushes, 51), SacnUniverseDMX);
acnOutput.Connect(new Physical.AmericanDJStrobe(lightWhiteStrobe, 5), SacnUniverseDMX);
// acnOutput.Connect(new Physical.SmallRGBStrobe(lightBottom, 1), SacnUniverseDMX);
acnOutput.Connect(new Physical.RGBStrobe(lightStraigthAhead, 60), SacnUniverseDMX);
acnOutput.Connect(new Physical.RGBStrobe(lightRightColumn, 80), SacnUniverseDMX);
acnOutput.Connect(new Physical.RGBStrobe(lightUpTree, 40), SacnUniverseDMX);
acnOutput.Connect(new Physical.RGBStrobe(lightVader, 70), SacnUniverseDMX);
acnOutput.Connect(new Physical.MonopriceRGBWPinSpot(lightSnow, 20), SacnUniverseDMX);
acnOutput.Connect(new Physical.GenericDimmer(lightHat1, 1), SacnUniverseRenard2);
acnOutput.Connect(new Physical.GenericDimmer(lightHat2, 2), SacnUniverseRenard2);
acnOutput.Connect(new Physical.GenericDimmer(lightHat3, 3), SacnUniverseRenard2);
acnOutput.Connect(new Physical.GenericDimmer(lightHat4, 4), SacnUniverseRenard2);
acnOutput.Connect(new Physical.MonopriceMovingHeadLight12chn(movingHead, 200), SacnUniverseDMX);
acnOutput.Connect(new Physical.GenericDimmer(lightNet4, 5), SacnUniverseRenard2);
acnOutput.Connect(new Physical.GenericDimmer(lightNet3, 6), SacnUniverseRenard2);
acnOutput.Connect(new Physical.GenericDimmer(lightNet1, 7), SacnUniverseRenard2);
acnOutput.Connect(new Physical.GenericDimmer(lightNet2, 8), SacnUniverseRenard2);
acnOutput.Connect(new Physical.GenericDimmer(packages, 1), SacnUniverseRenard1);
acnOutput.Connect(new Physical.GenericDimmer(snowmanKaggen, 2), SacnUniverseRenard1);
acnOutput.Connect(new Physical.GenericDimmer(lightR2D2, 3), SacnUniverseRenard1);
acnOutput.Connect(new Physical.GenericDimmer(lightNet5, 4), SacnUniverseRenard1);
acnOutput.Connect(new Physical.GenericDimmer(lightNet6, 5), SacnUniverseRenard1);
acnOutput.Connect(new Physical.GenericDimmer(lightNet7, 6), SacnUniverseRenard1);
acnOutput.Connect(new Physical.GenericDimmer(lightMetalReindeer, 7), SacnUniverseRenard1);
acnOutput.Connect(new Physical.GenericDimmer(lightNet9, 8), SacnUniverseRenard1);
acnOutput.Connect(new Physical.GenericDimmer(lightNet10, 9), SacnUniverseRenard1);
acnOutput.Connect(new Physical.GenericDimmer(lightNet8, 10), SacnUniverseRenard1);
acnOutput.Connect(new Physical.GenericDimmer(lightStairsLeft, 11), SacnUniverseRenard1);
acnOutput.Connect(new Physical.GenericDimmer(lightFenceLeft, 12), SacnUniverseRenard1);
acnOutput.Connect(new Physical.GenericDimmer(lightFenceMid, 13), SacnUniverseRenard1);
acnOutput.Connect(new Physical.GenericDimmer(lightFenceRight, 14), SacnUniverseRenard1);
acnOutput.Connect(new Physical.GenericDimmer(lightStairsRight, 15), SacnUniverseRenard1);
acnOutput.Connect(new Physical.GenericDimmer(lightNet11, 16), SacnUniverseRenard1);
acnOutput.Connect(new Physical.GenericDimmer(lightSanta, 1), SacnUniverseArduino);
acnOutput.Connect(new Physical.GenericDimmer(lightSnowman, 2), SacnUniverseArduino);
stateMachine.ForFromSequence(States.Background, backgroundLights);
stateMachine.ForFromSequence(States.Music1, music1Seq);
stateMachine.ForFromSequence(States.Music2, music2Seq);
stateMachine.ForFromSequence(States.DarthVader, fatherSeq);
/* oscServer.RegisterActionSimple<double>("/1/faderA", (msg, data) =>
{
lightSnowman.Brightness = data;
});
oscServer.RegisterActionSimple<double>("/1/faderD", (msg, data) =>
{
Exec.Blackout.OnNext(data);
});*/
oscServer.RegisterActionSimple<int>("/2/push1", (msg, data) =>
{
if (data == 1)
{
stateMachine.SetState(States.DarthVader);
}
});
oscServer.RegisterActionSimple<int>("/2/push2", (msg, data) =>
{
if (data == 1)
{
stateMachine.SetState(States.Music1);
}
});
oscServer.RegisterActionSimple<int>("/2/push3", (msg, data) =>
{
if (data == 1)
{
// stateMachine.SetState(States.Music2);
}
});
oscServer.RegisterActionSimple<int>("/2/toggle4", (msg, data) =>
{
buttonSnowMachine.Control.OnNext(data == 1);
});
music1Seq
.WhenExecuted
.SetUp(() =>
{
soundOut.Stop();
soundOut.WaitForStopped();
})
.Execute(instance =>
{
using (var waveCarol = CodecFactory.Instance.GetCodec(@"C:\Projects\Other\ChristmasSounds\trk\09 Carol of the Bells (Instrumental).wav"))
{
soundOut.Initialize(waveCarol);
soundOut.Play();
var task = lorCarolBells.Start();
task.Wait(instance.CancelToken);
instance.WaitFor(S(5));
soundOut.Stop();
soundOut.WaitForStopped();
}
instance.WaitFor(S(8));
})
.TearDown(() =>
{
lorCarolBells.Stop();
soundOut.Stop();
});
music2Seq
.WhenExecuted
.SetUp(() =>
{
soundOut.Stop();
soundOut.WaitForStopped();
lightRoofEdge.SetOnlyColor(Color.Red);
lightStraigthAhead.SetOnlyColor(Color.Red);
lightRightColumn.SetOnlyColor(Color.Red);
lightUpTree.SetOnlyColor(Color.Red);
})
.Execute(instance =>
{
using (var wave = CodecFactory.Instance.GetCodec(@"C:\Projects\Other\ChristmasSounds\trk\Coca Cola - Holidays Are Coming.wav"))
{
soundOut.Initialize(wave);
soundOut.Play();
var task = lorCoke.Start();
task.Wait(instance.CancelToken);
instance.WaitFor(S(5));
soundOut.Stop();
soundOut.WaitForStopped();
}
instance.WaitFor(S(8));
})
.TearDown(() =>
{
lorCoke.Stop();
soundOut.Stop();
});
backgroundLights
.WhenExecuted
.SetUp(() =>
{
saberPixels.SetAll(Color.Red, 0.1);
pulsatingStar.Start();
lightUpTree.SetColor(Color.Red, 0.5);
lightHat1.Brightness = 1;
lightHat2.Brightness = 1;
lightHat3.Brightness = 1;
lightHat4.Brightness = 1;
snowmanKaggen.Brightness = 1;
lightR2D2.Brightness = 1;
lightSnowman.Brightness = 1;
lightSanta.Brightness = 1;
lightNet1.Brightness = 1;
lightNet2.Brightness = 1;
lightNet3.Brightness = 1;
lightNet4.Brightness = 1;
lightNet5.Brightness = 1;
lightNet6.Brightness = 1;
lightNet7.Brightness = 1;
lightNet8.Brightness = 1;
lightNet9.Brightness = 1;
lightNet10.Brightness = 1;
lightNet11.Brightness = 1;
lightStairsLeft.Brightness = 1;
lightFenceLeft.Brightness = 1;
lightFenceMid.Brightness = 1;
lightFenceRight.Brightness = 1;
lightStairsRight.Brightness = 1;
lightBushes.Brightness = 1;
lightMetalReindeer.Brightness = 1;
})
.TearDown(() =>
{
saberPixels.TurnOff();
pulsatingStar.Stop();
lightUpTree.Brightness = 0;
lightHat1.Brightness = 0;
lightHat2.Brightness = 0;
lightHat3.Brightness = 0;
lightHat4.Brightness = 0;
snowmanKaggen.Brightness = 0;
lightR2D2.Brightness = 0;
lightSnowman.Brightness = 0;
lightSanta.Brightness = 0;
lightNet1.Brightness = 0;
lightNet2.Brightness = 0;
lightNet3.Brightness = 0;
lightNet4.Brightness = 0;
lightNet5.Brightness = 0;
lightNet6.Brightness = 0;
lightNet7.Brightness = 0;
lightNet8.Brightness = 0;
lightNet9.Brightness = 0;
lightNet10.Brightness = 0;
lightNet11.Brightness = 0;
lightStairsLeft.Brightness = 0;
lightFenceLeft.Brightness = 0;
lightFenceMid.Brightness = 0;
lightFenceRight.Brightness = 0;
lightStairsRight.Brightness = 0;
lightBushes.Brightness = 0;
lightMetalReindeer.Brightness = 0;
});
backgroundLoop
.WhenExecuted
.SetUp(() =>
{
// Exec.Execute(candyCane);
//pulsatingEffect1.Start();
//flickerEffect.Start();
//switchButtonBlue.SetPower(true);
//switchButtonRed.SetPower(true);
//lightTreeUp.SetOnlyColor(Color.Red);
//faderIn.Restart();
//Executor.Current.Execute(twinkleSeq);
})
.Execute(i =>
{
while (!i.IsCancellationRequested)
{
Exec.ExecuteAndWait(fatherSeq);
if (i.IsCancellationRequested)
break;
Exec.ExecuteAndWait(music1Seq);
if (i.IsCancellationRequested)
break;
Exec.ExecuteAndWait(music2Seq);
}
})
.TearDown(() =>
{
// Exec.Cancel(candyCane);
//Executor.Current.Cancel(twinkleSeq);
//switchButtonBlue.SetPower(false);
//switchButtonRed.SetPower(false);
//EverythingOff();
});
starwarsCane
.WhenExecuted
.SetUp(() =>
{
pixelsRoofEdge.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:
pixelsRoofEdge.InjectRev(Color.Yellow, 1.0);
break;
case 2:
case 3:
pixelsRoofEdge.InjectRev(Color.Orange, 0.2);
break;
}
instance.WaitFor(S(0.1));
if (instance.IsCancellationRequested)
break;
}
}
})
.TearDown(() =>
{
pixelsRoofEdge.TurnOff();
});
fatherSeq
.WhenExecuted
.Execute(instance =>
{
Exec.Cancel(candyCane);
Executor.Current.Execute(starwarsCane);
lightR2D2.Brightness = 1.0;
soundOut.Stop();
soundOut.WaitForStopped();
using (var waveStarwars = CodecFactory.Instance.GetCodec(@"C:\Projects\Other\ChristmasSounds\trk\01. Star Wars - Main Title.wav"))
{
soundOut.Initialize(waveStarwars);
soundOut.Play();
//lightCeiling1.SetOnlyColor(Color.Yellow);
//lightCeiling2.SetOnlyColor(Color.Yellow);
//lightCeiling3.SetOnlyColor(Color.Yellow);
//pulsatingEffect2.Start();
instance.WaitFor(S(16));
//pulsatingEffect2.Stop();
soundOut.Stop();
soundOut.WaitForStopped();
Executor.Current.Cancel(starwarsCane);
pixelsRoofEdge.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.Red);
var ctrl = lightVader.TakeControl();
Exec.MasterEffect.Fade(lightVader, 0, 1, 1000).ContinueWith(_ => ctrl.Dispose());
instance.WaitFor(S(2.5));
//elLightsaber.SetPower(true);
audioDarthVader.PlayEffect("saberon");
for (int sab = 00; sab < 32; sab++)
{
saberPixels.Inject(Color.Red, 0.5);
instance.WaitFor(S(0.01));
}
instance.WaitFor(S(1));
lightVader.SetColor(Color.Red, 1.0);
audioDarthVader.PlayEffect("father");
instance.WaitFor(S(4));
saberSidePixels.SetAll(Color.Red, 0.5);
instance.WaitFor(S(1));
lightVader.Brightness = 0;
//light3wise.TurnOff();
//lightJesus.TurnOff();
//pulsatingStar.Stop();
//elJesus.TurnOff();
audioDarthVader.PlayEffect("force1");
instance.WaitFor(S(4));
lightVader.Brightness = 0;
saberSidePixels.SetAll(Color.Red, 0);
audioDarthVader.PlayEffect("saberoff");
instance.WaitFor(S(0.7));
for (int sab = 0; sab < 16; 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(() =>
{
lightR2D2.Brightness = 0;
// EverythingOff();
soundOut.Stop();
});
hours.Output.Subscribe(x =>
{
if (x)
{
stateMachine.SetBackgroundState(States.Background);
stateMachine.SetState(States.Background);
//lightTreeUp.SetColor(Color.Red, 1.0);
//lightSnow1.SetBrightness(1.0);
//lightSnow2.SetBrightness(1.0);
}
else
{
//if (buttonOverrideHours.Active)
// return;
stateMachine.Hold();
stateMachine.SetBackgroundState(null);
//EverythingOff();
System.Threading.Thread.Sleep(200);
/*
airR2D2.Power = false;
airSanta.Power = false;
airSnowman.Power = false;
airReindeer.Power = false;*/
//switchDeerHuge.TurnOff();
//switchSanta.TurnOff();
inflatablesRunning.OnNext(false);
}
});
ImportAndMapCarolBells();
ImportAndMapCoke();
}