sends example added.

obs example updated to reflect updates to obsws
This commit is contained in:
onyx-and-iris 2024-02-08 13:45:55 +00:00
parent 265c26eb67
commit c2cf2fe523
2 changed files with 31 additions and 7 deletions

View File

@ -0,0 +1,19 @@
import logging
import xair_api
logging.basicConfig(level=logging.DEBUG)
def main():
with xair_api.connect("XR18", ip="mixer.local") as mixer:
for send in mixer.strip[0].send:
send.level = -22.8
mixer.strip[15].send[0].level = -16.3
mixer.auxreturn.send[0].level = -15.3
mixer.fxreturn[0].send[0].level = -14.3
if __name__ == "__main__":
main()

View File

@ -1,12 +1,19 @@
import obsws_python as obs import obsws_python as obs
import xair_api import xair_api
class Observer: class Observer:
def __init__(self, mixer): def __init__(self, mixer):
self._mixer = mixer self._mixer = mixer
self._cl = obs.EventClient() self._client = obs.EventClient()
self._cl.callback.register(self.on_current_program_scene_changed) self._client.callback.register(self.on_current_program_scene_changed)
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, exc_traceback):
self._client.disconnect()
def on_current_program_scene_changed(self, data): def on_current_program_scene_changed(self, data):
scene = data.scene_name scene = data.scene_name
@ -28,11 +35,9 @@ class Observer:
def main(): def main():
with xair_api.connect("MR18", ip="mixer.local") as mixer: with xair_api.connect("MR18", ip="mixer.local") as mixer:
Observer(mixer) with Observer(mixer):
while _ := input("Press <Enter> to exit\n"):
while cmd := input("<Enter> to exit\n"): pass
if not cmd:
break
if __name__ == "__main__": if __name__ == "__main__":