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