diff --git a/src/main/kotlin/de/moritzruth/lampenfieber/Main.kt b/src/main/kotlin/de/moritzruth/lampenfieber/Main.kt index 466515f..4e0829c 100644 --- a/src/main/kotlin/de/moritzruth/lampenfieber/Main.kt +++ b/src/main/kotlin/de/moritzruth/lampenfieber/Main.kt @@ -8,24 +8,314 @@ import de.moritzruth.theaterdsl.dmx.EnttecOpenDmxUsb import de.moritzruth.theaterdsl.show.StepCue import de.moritzruth.theaterdsl.show.createShow import de.moritzruth.theaterdsl.show.runShow +import de.moritzruth.theaterdsl.value.Color +import de.moritzruth.theaterdsl.value.degrees import de.moritzruth.theaterdsl.value.percent import kotlinx.collections.immutable.persistentSetOf +import kotlin.time.Duration.Companion.seconds val bar = StairvilleTriLedBar(DmxAddress(400u)) -val frontLights = (1..8).map { SimpleDimmer(DmxAddress(it.toUInt())) } -val washLeft = Wash(DmxAddress(85u)) -val washRight = Wash(DmxAddress(101u)) -val devices = persistentSetOf(bar, *frontLights.toTypedArray(), washLeft, washRight) +object FrontLights { + val left = listOf(SimpleDimmer(DmxAddress(1u)), SimpleDimmer(DmxAddress(2u))) + val center = listOf(SimpleDimmer(DmxAddress(4u)), SimpleDimmer(DmxAddress(5u))) + val right = listOf(SimpleDimmer(DmxAddress(7u)), SimpleDimmer(DmxAddress(8u))) + val all = left + center + right +} + +val spotLeft = SimpleDimmer(DmxAddress(10u)) +val spotRight = SimpleDimmer(DmxAddress(11u)) + +// Nebel: SF-1500 + +object Washs { + val left = Wash(DmxAddress(85u)) + val right = Wash(DmxAddress(101u)) + val all = listOf(left, right) +} + +val devices = persistentSetOf(bar, *FrontLights.all.toTypedArray(), spotLeft, spotRight, *Washs.all.toTypedArray()) val show = createShow { act("Erster Akt") { - scene("Prolog") { + scene("I") { step { - trigger = StepCue.Custom("") + trigger = StepCue.MusicStart("Lampenfieber", 69.seconds) onRun { - frontLights.forEach { it.brightness.static(100.percent) } + // Lichteffekte in der Aula + spotRight.brightness.static(100.percent) + } + } + } + + scene("I.1") { + step { + trigger = StepCue.MusicEnd + + onRun { + spotRight.brightness.static(0.percent) + + FrontLights.center.forEach { it.brightness.fade(75.percent, 10.seconds) } + } + } + + step { + trigger = StepCue.MusicStart("Rap", 69.seconds) + + onRun { + // sehr viel + FrontLights.center.forEach { it.brightness.fade(20.percent, 10.seconds) } + bar.color.static(Color(100.degrees)) + bar.brightness.fade(75.percent, 10.seconds) + } + } + + step { + trigger = StepCue.MusicEnd + + onRun { + FrontLights.center.forEach { it.brightness.fade(0.percent, 10.seconds) } + bar.brightness.fade(0.percent, 2.seconds) + } + } + } + + scene("I.2") { + step { + trigger = StepCue.Stub + + onRun { + FrontLights.left.forEach { it.brightness.fade(75.percent, 10.seconds) } + } + } + + step { + trigger = StepCue.Stub + + onRun { + FrontLights.left.forEach { it.brightness.fade(0.percent, 5.seconds) } + } + } + } + + scene("I.3") { + step { + trigger = StepCue.Stub + + onRun { + spotRight.brightness.fade(10.percent, 5.seconds) + FrontLights.right.forEach { it.brightness.fade(75.percent, 10.seconds) } + } + } + } + + scene("I.3") { + step { + trigger = StepCue.Custom("Bühne erreicht") + + onRun { + spotRight.brightness.fade(0.percent, 8.seconds) + FrontLights.all.forEach { it.brightness.fade(75.percent, 10.seconds) } + } + } + + // David spielt: Licht links + } + + scene("I.5") { + step { + trigger = StepCue.Stub + + onRun { + FrontLights.all.forEach { it.brightness.fade(0.percent, 10.seconds) } + FrontLights.right.forEach { it.brightness.fade(50.percent, 10.seconds) } + + Washs.all.forEach { + it.brightness.fade(75.percent, 10.seconds) + // Blau + } + + // Auftritt links: + spotRight.brightness.static(100.percent) + } + } + + step { + trigger = StepCue.MusicStart("Aus dem Schatten treten", 69.seconds) + + onRun { + FrontLights.right.forEach { it.brightness.fade(0.percent, 10.seconds) } + + Washs.all.forEach { + it.brightness.fade(100.percent, 10.seconds) + } + + // Nebel + } + } + + step { + trigger = StepCue.MusicEnd + + onRun { + FrontLights.right.forEach { it.brightness.off() } + Washs.all.forEach { it.brightness.off() } + // Nebel aus + } + } + } + + scene("II.1") { + step { + trigger = StepCue.MusicStart("Computerspiel", 69.seconds) + + onRun { + // bunt, instrumental + } + } + } + + scene("II.2") { + step { + trigger = StepCue.Stub + + onRun { + // Umbau, vorm Vorhang + FrontLights.all.forEach { it.brightness.fade(75.percent, 4.seconds) } + } + } + } + + scene("II.3") { + step { + trigger = StepCue.Stub + + onRun { + // Vorhang auf + FrontLights.left.forEach { it.brightness.fade(0.percent, 4.seconds) } + FrontLights.center.forEach { it.brightness.fade(0.percent, 4.seconds) } + + // Außerirdische in der Mitte und gehen nach links ab + } + } + + step { + trigger = StepCue.MusicEnd + + onRun { + FrontLights.right.forEach { it.brightness.off() } + spotRight.brightness.static(100.percent) + } + } + + step { + trigger = StepCue.MusicStart("Eine Rolle spielen I", 69.seconds) + + onRun { + // kühle Farben, sitzt rechts und steht dann auf zur Mitte + } + } + + step { + trigger = StepCue.MusicEnd + } + + step { + trigger = StepCue.Stub + + onRun { + spotRight.brightness.off() + // Vorhang zu + } + } + + step { + trigger = StepCue.MusicStart("Eine Rolle spielen II", 69.seconds) + + onRun { + // instrumental, Umbau + } + } + } + + scene("III.1") { + step { + trigger = StepCue.Stub + + onRun { + spotRight.brightness.fade(100.percent, 5.seconds) + FrontLights.all.forEach { it.brightness.fade(75.percent, 20.seconds) } + } + + // Maria singt etwas + } + } + + scene("III.2") { + step { + trigger = StepCue.Stub + + onRun { + FrontLights.right.forEach { it.brightness.fade(0.percent, 10.seconds) } + FrontLights.center.forEach { it.brightness.fade(0.percent, 10.seconds) } + } + } + + step { + trigger = StepCue.Custom("letzte Worte") + + onRun { + FrontLights.left.forEach { it.brightness.fade(0.percent, 2.seconds) } + } + } + } + + scene("III.3") { + step { + trigger = StepCue.MusicStart("Tischballet", 69.seconds) + // Instrumental, Umbau zu Musiksaal + } + } + + scene("III.4") { + step { + trigger = StepCue.MusicEnd + // Vorhang auf + + onRun { + FrontLights.all.forEach { it.brightness.fade(50.percent, 5.seconds) } + } + } + + step { + trigger = StepCue.Stub + + onRun { + spotRight.brightness.fade(100.percent, 4.seconds) + } + } + } + + scene("III.5") { + step { + trigger = StepCue.Custom("Ende") + + onRun { + // Vorhang zu + FrontLights.all.forEach { it.brightness.fade(0.percent, 5.seconds) } + } + } + + // Umbau-Musik + } + + scene("III.6") { + step { + trigger = StepCue.Custom("Vorhang auf, Musik Ende") + + onRun { + spotRight.brightness.static(100.percent) } } } diff --git a/src/main/kotlin/de/moritzruth/lampenfieber/Test.kt b/src/main/kotlin/de/moritzruth/lampenfieber/Test.kt index 6963c34..6a2eb21 100644 --- a/src/main/kotlin/de/moritzruth/lampenfieber/Test.kt +++ b/src/main/kotlin/de/moritzruth/lampenfieber/Test.kt @@ -2,7 +2,6 @@ package de.moritzruth.lampenfieber import de.moritzruth.theaterdsl.dmx.EnttecOpenDmxUsb import de.moritzruth.theaterdsl.dmx.PerDeviceDmxDataWriter -import de.moritzruth.theaterdsl.value.percent import kotlinx.coroutines.awaitCancellation suspend fun main() { @@ -24,5 +23,4 @@ suspend fun main() { } fun test() { - washRight.brightness.static(100.percent) } \ No newline at end of file diff --git a/src/main/kotlin/de/moritzruth/lampenfieber/device/Wash.kt b/src/main/kotlin/de/moritzruth/lampenfieber/device/Wash.kt index 249b927..2d86e42 100644 --- a/src/main/kotlin/de/moritzruth/lampenfieber/device/Wash.kt +++ b/src/main/kotlin/de/moritzruth/lampenfieber/device/Wash.kt @@ -25,7 +25,6 @@ class Wash(override val firstChannel: DmxAddress) : Device { val fullTilt = (tilt.getCurrentValue().degrees.mod(TILT_LIMIT) / TILT_LIMIT * 65536).roundToInt() val (mTilt, lTilt) = fullTilt.get16BitChannelValues() - println((fullTilt.rotateRight(8) and 0x11111111)) writer.writeRaw(DmxValue(130u)) writer.writeRaw(DmxValue(200u)) diff --git a/src/main/kotlin/de/moritzruth/theaterdsl/device/DynamicValue.kt b/src/main/kotlin/de/moritzruth/theaterdsl/device/DynamicValue.kt index 1ed789c..2d61fc4 100644 --- a/src/main/kotlin/de/moritzruth/theaterdsl/device/DynamicValue.kt +++ b/src/main/kotlin/de/moritzruth/theaterdsl/device/DynamicValue.kt @@ -83,6 +83,8 @@ abstract class FloatDV(private val initialStaticValue: Float) : DynamicValue< state = State.Static(fromDomain(value)) } + fun off() = static(toDomain(0f)) + fun fade(end: T, duration: Duration, start: T = getCurrentValue()) { state = State.Fade(fromDomain(start), fromDomain(end), duration) } diff --git a/src/main/kotlin/de/moritzruth/theaterdsl/show/StepCue.kt b/src/main/kotlin/de/moritzruth/theaterdsl/show/StepCue.kt index 449598d..6bb6e52 100644 --- a/src/main/kotlin/de/moritzruth/theaterdsl/show/StepCue.kt +++ b/src/main/kotlin/de/moritzruth/theaterdsl/show/StepCue.kt @@ -9,6 +9,10 @@ import kotlin.time.Duration sealed interface StepCue { fun format(): String + companion object { + val Stub = Custom("stub") + } + @Serializable @SerialName("TEXT") data class Text(val speaker: String, val text: String, val clarification: String? = null) : StepCue {