This commit is contained in:
Moritz Ruth 2023-07-08 13:34:35 +02:00
parent d4cff66261
commit dc98a172f5
Signed by: moritzruth
GPG key ID: C9BBAB79405EE56D
6 changed files with 29 additions and 24 deletions

View file

@ -1,6 +1,6 @@
package de.moritzruth.lampenfieber
import de.moritzruth.lampenfieber.device.Washs
import de.moritzruth.lampenfieber.device.Tops
import de.moritzruth.lampenfieber.device.devices
import de.moritzruth.theaterdsl.dmx.EnttecOpenDmxUsb
import de.moritzruth.theaterdsl.dmx.PerDeviceDmxDataWriter
@ -11,7 +11,6 @@ import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import kotlin.math.roundToLong
import kotlin.system.measureTimeMillis
import kotlin.time.Duration.Companion.seconds
suspend fun main() = coroutineScope {
EnttecOpenDmxUsb.start()
@ -38,14 +37,8 @@ suspend fun main() = coroutineScope {
}
suspend fun test() = coroutineScope {
Washs.both {
it.brightness.static(50.percent)
it.pointAtGuests()
}
delay(4000)
Washs.both {
it.pointAtCeiling(5.seconds)
Tops.both {
it.brightness.static(100.percent)
it.startRoomMovement(10.0)
}
}

View file

@ -92,7 +92,7 @@ fun ShowBuilderContext.firstAct() = act("Erster Akt") {
}
lightStep(StepCue.Custom("Gitarren-Ton")) {
FrontLights.center.forEach { it.brightness.fade(0.percent, 30.seconds) }
FrontLights.all.forEach { it.brightness.fade(0.percent, 30.seconds) }
Washs.both.forEach { it.colorWheelMode.static(CoemarProWash.ColorWheelMode.Rotate(20.percent)) }
Tops.both.forEach { it.colorWheelMode.static(FuturelightDmh160.ColorWheelMode.Rotate(20.percent)) }
}

View file

@ -239,10 +239,10 @@ fun ShowBuilderContext.fourthAct() = act("Vierter Akt") {
step(StepCue.MusicEnd) {
actors {
// alle ab außer David
+"Paula / durch Mittelgang auf Fahrrad"
+"Paula / von links"
}
rightSpotTarget = "Paula / im Mittelgang"
rightSpotTarget = "Paula und David (groß)"
onRun {
FrontLights.all.forEach { it.brightness.fade(20.percent, 6.seconds) }

View file

@ -7,6 +7,7 @@ import de.moritzruth.theaterdsl.device.PercentageDV
import de.moritzruth.theaterdsl.dmx.DmxAddress
import de.moritzruth.theaterdsl.dmx.DmxDataWriter
import de.moritzruth.theaterdsl.dmx.DmxValue
import de.moritzruth.theaterdsl.value.Angle
import de.moritzruth.theaterdsl.value.Percentage
import de.moritzruth.theaterdsl.value.degrees
import kotlinx.collections.immutable.persistentSetOf
@ -15,8 +16,8 @@ import kotlin.time.Duration.Companion.minutes
class FuturelightDmh160(override val firstChannel: DmxAddress, private val isRight: Boolean) : Device {
companion object {
private const val PAN_LIMIT = 630f // degrees
private const val TILT_LIMIT = 270f // degrees
private const val PAN_LIMIT = 630.0 // degrees
private const val TILT_LIMIT = 270.0 // degrees
}
override val numberOfChannels: UInt = 16u
@ -81,7 +82,7 @@ class FuturelightDmh160(override val firstChannel: DmxAddress, private val isRig
FROST(DmxValue(192u))
}
val pan = AngleDV()
val pan = AngleDV(maximumValue = Angle(PAN_LIMIT))
val tilt = AngleDV()
val brightness = PercentageDV()
val colorWheelMode = ConcreteDV<ColorWheelMode>(ColorWheelMode.White)
@ -90,9 +91,9 @@ class FuturelightDmh160(override val firstChannel: DmxAddress, private val isRig
val prismRotationSpeed = PercentageDV()
fun startRoomMovement(rotationsPerMinute: Double) { // TODO: Test
val period = 1.minutes / rotationsPerMinute
pan.rampUp(period) // spin
tilt.sine(period, minimum = 100.degrees, maximum = 120.degrees, start = 120.degrees)
val period = (1.minutes / rotationsPerMinute) * 2
pan.rampUp(period * (PAN_LIMIT / 360.0)) // spin
tilt.sine(period, minimum = 90.degrees, maximum = 120.degrees, start = 120.degrees)
}
override val dvs = persistentSetOf(

View file

@ -24,7 +24,7 @@ class StairvilleClb4(override val firstChannel: DmxAddress) : Device {
override fun writeDmxData(writer: DmxDataWriter, isLightBehindCurtainOn: Boolean) {
if (isLightBehindCurtainOn) {
repeat(2) {
repeat(3) {
writer.writeRaw(DmxValue(255u))
writer.writeRaw(DmxValue(255u))
writer.writeRaw(DmxValue(255u))

View file

@ -40,6 +40,7 @@ abstract class DoubleDV<T>(private val initialStaticValue: Double) : DynamicValu
}
data class Ramp(val period: Duration, val start: Double, val end: Double) : State
data class TriangleWave(val period: Duration, val start: Double, val end: Double) : State
data class Step(val steps: ImmutableList<Double>, val interval: Duration, val startIndex: Int) : State
data class PulseOnce(val rampUpDuration: Duration, val rampDownDuration: Duration, val peakValue: Double, val start: Double, val end: Double) : State
}
@ -71,7 +72,18 @@ abstract class DoubleDV<T>(private val initialStaticValue: Double) : DynamicValu
(fromZeroToOne * (s.maximum - s.minimum) + s.minimum)
}
is State.Ramp -> elapsedTime.inWholeMilliseconds.rem(s.period.inWholeMilliseconds) * (s.end - s.start) + s.start
is State.Ramp -> {
val progress = elapsedTime.inWholeMilliseconds.toDouble() / s.period.inWholeMilliseconds
val clampedProcess = progress.mod(1.0)
clampedProcess * (s.end - s.start) + s.start
}
is State.TriangleWave -> {
val progress = elapsedTime.inWholeMilliseconds.toDouble() / s.period.inWholeMilliseconds
val clampedProcess = progress.mod(1.0)
1.0
}
is State.Step -> {
val index = (elapsedTime / s.interval).toInt() + s.startIndex
@ -150,11 +162,10 @@ class PercentageDV(initialStaticValue: Percentage = 0.percent) : DoubleDV<Percen
override val maximumValue: Percentage = 100.percent
}
class AngleDV(initialStaticValue: Angle = 0.degrees) : DoubleDV<Angle>(initialStaticValue.degrees) {
class AngleDV(initialStaticValue: Angle = 0.degrees, override val maximumValue: Angle = 360.degrees) : DoubleDV<Angle>(initialStaticValue.degrees) {
override fun fromDomain(value: Angle): Double = value.degrees
override fun toDomain(value: Double): Angle = Angle(value)
override val minimumValue: Angle = 0.degrees
override val maximumValue: Angle = 360.degrees
}
class ConcreteDV<T>(private val initialStaticValue: T) : DynamicValue<T> {