mirror of
https://github.com/onyx-and-iris/voicemeeter-api-python.git
synced 2024-11-15 16:40:46 +00:00
add eq, comp, gate to apply examples.
This commit is contained in:
parent
2f9864cf60
commit
cc26720ae2
@ -72,7 +72,7 @@ def main():
|
|||||||
vm.apply(
|
vm.apply(
|
||||||
{
|
{
|
||||||
"strip-2": {"A1": True, "B1": True, "gain": -6.0},
|
"strip-2": {"A1": True, "B1": True, "gain": -6.0},
|
||||||
"bus-2": {"mute": True},
|
"bus-2": {"mute": True, "eq": {"on": True}},
|
||||||
"button-0": {"state": True},
|
"button-0": {"state": True},
|
||||||
"vban-in-0": {"on": True},
|
"vban-in-0": {"on": True},
|
||||||
"vban-out-1": {"name": "streamname"},
|
"vban-out-1": {"name": "streamname"},
|
||||||
@ -82,6 +82,7 @@ def main():
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Otherwise you must remember to call `vm.login()`, `vm.logout()` at the start/end of your code.
|
Otherwise you must remember to call `vm.login()`, `vm.logout()` at the start/end of your code.
|
||||||
@ -636,7 +637,7 @@ get() may return None if no value for requested key in midi cache
|
|||||||
vm.apply(
|
vm.apply(
|
||||||
{
|
{
|
||||||
"strip-2": {"A1": True, "B1": True, "gain": -6.0},
|
"strip-2": {"A1": True, "B1": True, "gain": -6.0},
|
||||||
"bus-2": {"mute": True},
|
"bus-2": {"mute": True, "eq": {"on": True}},
|
||||||
"button-0": {"state": True},
|
"button-0": {"state": True},
|
||||||
"vban-in-0": {"on": True},
|
"vban-in-0": {"on": True},
|
||||||
"vban-out-1": {"name": "streamname"},
|
"vban-out-1": {"name": "streamname"},
|
||||||
|
12
__main__.py
12
__main__.py
@ -14,16 +14,18 @@ class ManyThings:
|
|||||||
|
|
||||||
def other_things(self):
|
def other_things(self):
|
||||||
self.vm.bus[3].gain = -6.3
|
self.vm.bus[3].gain = -6.3
|
||||||
self.vm.bus[4].eq = True
|
self.vm.bus[4].eq.on = True
|
||||||
info = (
|
info = (
|
||||||
f"bus 3 gain has been set to {self.vm.bus[3].gain}",
|
f"bus 3 gain has been set to {self.vm.bus[3].gain}",
|
||||||
f"bus 4 eq has been set to {self.vm.bus[4].eq}",
|
f"bus 4 eq has been set to {self.vm.bus[4].eq.on}",
|
||||||
)
|
)
|
||||||
print("\n".join(info))
|
print("\n".join(info))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
with voicemeeterlib.api(kind_id) as vm:
|
KIND_ID = "banana"
|
||||||
|
|
||||||
|
with voicemeeterlib.api(KIND_ID) as vm:
|
||||||
do = ManyThings(vm)
|
do = ManyThings(vm)
|
||||||
do.things()
|
do.things()
|
||||||
do.other_things()
|
do.other_things()
|
||||||
@ -32,7 +34,7 @@ def main():
|
|||||||
vm.apply(
|
vm.apply(
|
||||||
{
|
{
|
||||||
"strip-2": {"A1": True, "B1": True, "gain": -6.0},
|
"strip-2": {"A1": True, "B1": True, "gain": -6.0},
|
||||||
"bus-2": {"mute": True},
|
"bus-2": {"mute": True, "eq": {"on": True}},
|
||||||
"button-0": {"state": True},
|
"button-0": {"state": True},
|
||||||
"vban-in-0": {"on": True},
|
"vban-in-0": {"on": True},
|
||||||
"vban-out-1": {"name": "streamname"},
|
"vban-out-1": {"name": "streamname"},
|
||||||
@ -41,6 +43,4 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
kind_id = "banana"
|
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
@ -51,8 +51,8 @@ class MyClient:
|
|||||||
def on_end(self):
|
def on_end(self):
|
||||||
self.vm.apply(
|
self.vm.apply(
|
||||||
{
|
{
|
||||||
"strip-0": {"mute": True},
|
"strip-0": {"mute": True, "comp": {"ratio": 4.3}},
|
||||||
"strip-1": {"mute": True, "B1": False},
|
"strip-1": {"mute": True, "B1": False, "gate": {"attack": 2.3}},
|
||||||
"strip-2": {"mute": True, "B1": False},
|
"strip-2": {"mute": True, "B1": False},
|
||||||
"vban-in-0": {"on": False},
|
"vban-in-0": {"on": False},
|
||||||
}
|
}
|
||||||
|
@ -45,9 +45,11 @@ class IRemote(metaclass=ABCMeta):
|
|||||||
|
|
||||||
for attr, val in data.items():
|
for attr, val in data.items():
|
||||||
if not isinstance(val, dict):
|
if not isinstance(val, dict):
|
||||||
if hasattr(self, attr):
|
if attr in dir(self): # avoid calling getattr (with hasattr)
|
||||||
target, attr, val = fget(attr, val)
|
target, attr, val = fget(attr, val)
|
||||||
setattr(target, attr, val)
|
setattr(target, attr, val)
|
||||||
|
else:
|
||||||
|
self.logger.error(f"invalid attribute {attr} for {self}")
|
||||||
else:
|
else:
|
||||||
target = getattr(self, attr)
|
target = getattr(self, attr)
|
||||||
target.apply(val)
|
target.apply(val)
|
||||||
|
Loading…
Reference in New Issue
Block a user