scene 1 2
This commit is contained in:
@@ -2,6 +2,7 @@ package net.eksb.obsdc
|
||||
|
||||
import io.obswebsocket.community.client.OBSRemoteController
|
||||
import io.obswebsocket.community.client.message.event.ui.StudioModeStateChangedEvent
|
||||
import io.obswebsocket.community.client.model.Scene
|
||||
import io.obswebsocket.community.client.model.SceneItem.Transform
|
||||
import io.obswebsocket.community.client.model.SceneItem.Transform.TransformBuilder
|
||||
import org.slf4j.LoggerFactory
|
||||
@@ -47,12 +48,8 @@ class ObsCommunity(private val q:BlockingQueue<Op>): AutoCloseable {
|
||||
|
||||
private fun op(op:Op) {
|
||||
when(op) {
|
||||
Op.SCENE_TEST -> {
|
||||
controller.setCurrentProgramScene("test") { response ->
|
||||
log.info("set scene response: ${response.isSuccessful}")
|
||||
ready()
|
||||
}
|
||||
}
|
||||
Op.SCENE_1 -> scene { scenes -> scenes.firstOrNull() }
|
||||
Op.SCENE_2 -> scene { scenes -> scenes.asSequence().drop(1).firstOrNull() }
|
||||
Op.STUDIO_TRANSITION -> {
|
||||
controller.triggerStudioModeTransition { response ->
|
||||
// This does not get called?
|
||||
@@ -60,10 +57,10 @@ class ObsCommunity(private val q:BlockingQueue<Op>): AutoCloseable {
|
||||
ready()
|
||||
}
|
||||
}
|
||||
Op.PAN_UP -> { pan { old -> positionY(old.positionY - panAmount ) } }
|
||||
Op.PAN_DOWN -> { pan { old -> positionY(old.positionY + panAmount ) } }
|
||||
Op.PAN_LEFT -> { pan { old -> positionX(old.positionX - panAmount ) } }
|
||||
Op.PAN_RIGHT -> { pan { old -> positionX(old.positionX + panAmount ) } }
|
||||
Op.PAN_UP -> pan { old -> positionY(old.positionY - panAmount ) }
|
||||
Op.PAN_DOWN -> pan { old -> positionY(old.positionY + panAmount ) }
|
||||
Op.PAN_LEFT -> pan { old -> positionX(old.positionX - panAmount ) }
|
||||
Op.PAN_RIGHT -> pan { old -> positionX(old.positionX + panAmount ) }
|
||||
Op.TODO -> {
|
||||
log.info("OP=TODO")
|
||||
ready()
|
||||
@@ -71,6 +68,20 @@ class ObsCommunity(private val q:BlockingQueue<Op>): AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
private fun scene(selector:(List<Scene>)->Scene?) {
|
||||
controller.getSceneList { response ->
|
||||
val scene = selector(response.scenes.sortedBy(Scene::getSceneIndex).reversed())
|
||||
log.info("select scene ${scene?.sceneName} index:${scene?.sceneIndex}")
|
||||
if (scene != null) {
|
||||
controller.setCurrentProgramScene(scene.sceneName) { response ->
|
||||
ready()
|
||||
}
|
||||
} else {
|
||||
ready()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun pan(block:TransformBuilder.(Transform)->TransformBuilder) {
|
||||
controller.getCurrentProgramScene { response ->
|
||||
val sceneName = response.currentProgramSceneName
|
||||
|
||||
@@ -2,7 +2,8 @@ package net.eksb.obsdc
|
||||
|
||||
enum class Op {
|
||||
STUDIO_TRANSITION,
|
||||
SCENE_TEST,
|
||||
SCENE_1,
|
||||
SCENE_2,
|
||||
PAN_UP,
|
||||
PAN_DOWN,
|
||||
PAN_LEFT,
|
||||
|
||||
Reference in New Issue
Block a user