Callbacks module extended

Now supports callback methods as well observer classes

levels example now uses callback methods

register,deregister now alias add/remove observer methods

minor version bump
This commit is contained in:
2023-07-27 14:55:00 +01:00
parent 155cbe019a
commit 4fdebc8178
5 changed files with 32 additions and 26 deletions

View File

@@ -21,11 +21,9 @@ class Main
def infostring
resp = @r_client.get_version
[
"Using obs version:",
resp.obs_version,
"With websocket version:",
resp.obs_web_socket_version
].join("\n")
"Using obs version: #{resp.obs_version}.",
"With websocket version: #{resp.obs_web_socket_version}"
].join(" ")
end
def on_current_program_scene_changed(data)

View File

@@ -1,7 +1,6 @@
require_relative "../../lib/obsws"
require "yaml"
module LevelTypes
VU = 0
POSTFADER = 1
@@ -14,7 +13,12 @@ class Main
def initialize(**kwargs)
subs = OBSWS::Events::SUBS::LOW_VOLUME | OBSWS::Events::SUBS::INPUTVOLUMEMETERS
@e_client = OBSWS::Events::Client.new(subs:, **kwargs)
@e_client.add_observer(self)
@e_client.register(
[
method(:on_input_mute_state_changed),
method(:on_input_volume_meters)
]
)
end
def run