commit #54
This commit is contained in:
parent
d4cff66261
commit
dc98a172f5
6 changed files with 29 additions and 24 deletions
|
@ -1,6 +1,6 @@
|
||||||
package de.moritzruth.lampenfieber
|
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.lampenfieber.device.devices
|
||||||
import de.moritzruth.theaterdsl.dmx.EnttecOpenDmxUsb
|
import de.moritzruth.theaterdsl.dmx.EnttecOpenDmxUsb
|
||||||
import de.moritzruth.theaterdsl.dmx.PerDeviceDmxDataWriter
|
import de.moritzruth.theaterdsl.dmx.PerDeviceDmxDataWriter
|
||||||
|
@ -11,7 +11,6 @@ import kotlinx.coroutines.isActive
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlin.math.roundToLong
|
import kotlin.math.roundToLong
|
||||||
import kotlin.system.measureTimeMillis
|
import kotlin.system.measureTimeMillis
|
||||||
import kotlin.time.Duration.Companion.seconds
|
|
||||||
|
|
||||||
suspend fun main() = coroutineScope {
|
suspend fun main() = coroutineScope {
|
||||||
EnttecOpenDmxUsb.start()
|
EnttecOpenDmxUsb.start()
|
||||||
|
@ -38,14 +37,8 @@ suspend fun main() = coroutineScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun test() = coroutineScope {
|
suspend fun test() = coroutineScope {
|
||||||
Washs.both {
|
Tops.both {
|
||||||
it.brightness.static(50.percent)
|
it.brightness.static(100.percent)
|
||||||
it.pointAtGuests()
|
it.startRoomMovement(10.0)
|
||||||
}
|
|
||||||
|
|
||||||
delay(4000)
|
|
||||||
|
|
||||||
Washs.both {
|
|
||||||
it.pointAtCeiling(5.seconds)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -92,7 +92,7 @@ fun ShowBuilderContext.firstAct() = act("Erster Akt") {
|
||||||
}
|
}
|
||||||
|
|
||||||
lightStep(StepCue.Custom("Gitarren-Ton")) {
|
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)) }
|
Washs.both.forEach { it.colorWheelMode.static(CoemarProWash.ColorWheelMode.Rotate(20.percent)) }
|
||||||
Tops.both.forEach { it.colorWheelMode.static(FuturelightDmh160.ColorWheelMode.Rotate(20.percent)) }
|
Tops.both.forEach { it.colorWheelMode.static(FuturelightDmh160.ColorWheelMode.Rotate(20.percent)) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,10 +239,10 @@ fun ShowBuilderContext.fourthAct() = act("Vierter Akt") {
|
||||||
step(StepCue.MusicEnd) {
|
step(StepCue.MusicEnd) {
|
||||||
actors {
|
actors {
|
||||||
// alle ab außer David
|
// alle ab außer David
|
||||||
+"Paula / durch Mittelgang auf Fahrrad"
|
+"Paula / von links"
|
||||||
}
|
}
|
||||||
|
|
||||||
rightSpotTarget = "Paula / im Mittelgang"
|
rightSpotTarget = "Paula und David (groß)"
|
||||||
|
|
||||||
onRun {
|
onRun {
|
||||||
FrontLights.all.forEach { it.brightness.fade(20.percent, 6.seconds) }
|
FrontLights.all.forEach { it.brightness.fade(20.percent, 6.seconds) }
|
||||||
|
|
|
@ -7,6 +7,7 @@ import de.moritzruth.theaterdsl.device.PercentageDV
|
||||||
import de.moritzruth.theaterdsl.dmx.DmxAddress
|
import de.moritzruth.theaterdsl.dmx.DmxAddress
|
||||||
import de.moritzruth.theaterdsl.dmx.DmxDataWriter
|
import de.moritzruth.theaterdsl.dmx.DmxDataWriter
|
||||||
import de.moritzruth.theaterdsl.dmx.DmxValue
|
import de.moritzruth.theaterdsl.dmx.DmxValue
|
||||||
|
import de.moritzruth.theaterdsl.value.Angle
|
||||||
import de.moritzruth.theaterdsl.value.Percentage
|
import de.moritzruth.theaterdsl.value.Percentage
|
||||||
import de.moritzruth.theaterdsl.value.degrees
|
import de.moritzruth.theaterdsl.value.degrees
|
||||||
import kotlinx.collections.immutable.persistentSetOf
|
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 {
|
class FuturelightDmh160(override val firstChannel: DmxAddress, private val isRight: Boolean) : Device {
|
||||||
companion object {
|
companion object {
|
||||||
private const val PAN_LIMIT = 630f // degrees
|
private const val PAN_LIMIT = 630.0 // degrees
|
||||||
private const val TILT_LIMIT = 270f // degrees
|
private const val TILT_LIMIT = 270.0 // degrees
|
||||||
}
|
}
|
||||||
|
|
||||||
override val numberOfChannels: UInt = 16u
|
override val numberOfChannels: UInt = 16u
|
||||||
|
@ -81,7 +82,7 @@ class FuturelightDmh160(override val firstChannel: DmxAddress, private val isRig
|
||||||
FROST(DmxValue(192u))
|
FROST(DmxValue(192u))
|
||||||
}
|
}
|
||||||
|
|
||||||
val pan = AngleDV()
|
val pan = AngleDV(maximumValue = Angle(PAN_LIMIT))
|
||||||
val tilt = AngleDV()
|
val tilt = AngleDV()
|
||||||
val brightness = PercentageDV()
|
val brightness = PercentageDV()
|
||||||
val colorWheelMode = ConcreteDV<ColorWheelMode>(ColorWheelMode.White)
|
val colorWheelMode = ConcreteDV<ColorWheelMode>(ColorWheelMode.White)
|
||||||
|
@ -90,9 +91,9 @@ class FuturelightDmh160(override val firstChannel: DmxAddress, private val isRig
|
||||||
val prismRotationSpeed = PercentageDV()
|
val prismRotationSpeed = PercentageDV()
|
||||||
|
|
||||||
fun startRoomMovement(rotationsPerMinute: Double) { // TODO: Test
|
fun startRoomMovement(rotationsPerMinute: Double) { // TODO: Test
|
||||||
val period = 1.minutes / rotationsPerMinute
|
val period = (1.minutes / rotationsPerMinute) * 2
|
||||||
pan.rampUp(period) // spin
|
pan.rampUp(period * (PAN_LIMIT / 360.0)) // spin
|
||||||
tilt.sine(period, minimum = 100.degrees, maximum = 120.degrees, start = 120.degrees)
|
tilt.sine(period, minimum = 90.degrees, maximum = 120.degrees, start = 120.degrees)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val dvs = persistentSetOf(
|
override val dvs = persistentSetOf(
|
||||||
|
|
|
@ -24,7 +24,7 @@ class StairvilleClb4(override val firstChannel: DmxAddress) : Device {
|
||||||
|
|
||||||
override fun writeDmxData(writer: DmxDataWriter, isLightBehindCurtainOn: Boolean) {
|
override fun writeDmxData(writer: DmxDataWriter, isLightBehindCurtainOn: Boolean) {
|
||||||
if (isLightBehindCurtainOn) {
|
if (isLightBehindCurtainOn) {
|
||||||
repeat(2) {
|
repeat(3) {
|
||||||
writer.writeRaw(DmxValue(255u))
|
writer.writeRaw(DmxValue(255u))
|
||||||
writer.writeRaw(DmxValue(255u))
|
writer.writeRaw(DmxValue(255u))
|
||||||
writer.writeRaw(DmxValue(255u))
|
writer.writeRaw(DmxValue(255u))
|
||||||
|
|
|
@ -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 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 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
|
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)
|
(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 -> {
|
is State.Step -> {
|
||||||
val index = (elapsedTime / s.interval).toInt() + s.startIndex
|
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
|
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 fromDomain(value: Angle): Double = value.degrees
|
||||||
override fun toDomain(value: Double): Angle = Angle(value)
|
override fun toDomain(value: Double): Angle = Angle(value)
|
||||||
override val minimumValue: Angle = 0.degrees
|
override val minimumValue: Angle = 0.degrees
|
||||||
override val maximumValue: Angle = 360.degrees
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ConcreteDV<T>(private val initialStaticValue: T) : DynamicValue<T> {
|
class ConcreteDV<T>(private val initialStaticValue: T) : DynamicValue<T> {
|
||||||
|
|
Loading…
Add table
Reference in a new issue