From fee5475fe9ec79740869338d34a3d2368945e259 Mon Sep 17 00:00:00 2001 From: Edwin Jakobs Date: Tue, 30 Jun 2020 13:50:24 +0200 Subject: [PATCH] [orx-chataigne] Remove verbosity, change layout, exclude demo from actions --- build.gradle | 2 ++ orx-chataigne/src/main/kotlin/ChataigneOSC.kt | 25 +++++++++---------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 41ca9cb5..3d3fa89f 100644 --- a/build.gradle +++ b/build.gradle @@ -179,6 +179,8 @@ task collectScreenshots { continue if (sub.name == "orx-runway") continue + if (sub.name == "orx-chataigne") + continue def set = sub.sourceSets.demo def ucl = new URLClassLoader(set.runtimeClasspath.collect { it.toURI().toURL() } as URL[]) diff --git a/orx-chataigne/src/main/kotlin/ChataigneOSC.kt b/orx-chataigne/src/main/kotlin/ChataigneOSC.kt index 3488741a..eee9332b 100644 --- a/orx-chataigne/src/main/kotlin/ChataigneOSC.kt +++ b/orx-chataigne/src/main/kotlin/ChataigneOSC.kt @@ -1,12 +1,15 @@ +import mu.KotlinLogging import org.openrndr.color.ColorRGBa import org.openrndr.extra.osc.OSC import java.awt.Color import kotlin.reflect.KProperty +private val logger = KotlinLogging.logger {} + open class ChataigneOSC( val osc: OSC ) { - inner class DoubleChannel(key:String) { + inner class DoubleChannel(key: String) { private var currentDouble = 0.0 init { @@ -15,32 +18,26 @@ open class ChataigneOSC( } } - operator fun getValue(thisRef: Any?, property: KProperty<*>):Double { + operator fun getValue(thisRef: Any?, property: KProperty<*>): Double { return currentDouble } - operator fun setValue(thisRef: Any?, property: KProperty<*>, value: Double) { - print("$value") - } } - inner class ColorChannel(key:String) { + inner class ColorChannel(key: String) { private var currentColor = ColorRGBa.BLACK init { - println(key) osc.listen(key) { val c = it[0] as Color - currentColor = ColorRGBa(c.red/255.0, c.green/255.0, c.blue/255.0, c.alpha/255.0) + currentColor = ColorRGBa(c.red / 255.0, c.green / 255.0, c.blue / 255.0, c.alpha / 255.0) } } - operator fun getValue(thisRef: Any?, property: KProperty<*>):ColorRGBa { + operator fun getValue(thisRef: Any?, property: KProperty<*>): ColorRGBa { return currentColor } - operator fun setValue(thisRef: Any?, property: KProperty<*>, value: Double) { - print("$value") - } + } fun update(seconds: Double) { @@ -48,6 +45,8 @@ open class ChataigneOSC( } init { - println("setup Chataigne with OSC ${osc.address} in:${osc.portIn} out:${osc.portOut}") + logger.info { + "setup Chataigne with OSC ${osc.address} in:${osc.portIn} out:${osc.portOut}" + } } } \ No newline at end of file