diff --git a/README.md b/README.md index 3e1036b..497a246 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,24 @@ example: ```python vban.strip[3].gain = 3.7 -print(strip[0].label) +print(vban.strip[0].label) +``` + +The following methods are available. + +- `appgain(name, value)`: string, float, from 0.0 to 1.0 + +Set the gain in db by value for the app matching name. + +- `appmute(name, value)`: string, bool + +Set mute state as value for the app matching name. + +example: + +```python +vban.strip[5].appmute("Spotify", True) +vban.strip[5].appgain("Spotify", 0.5) ``` ##### Gainlayers @@ -213,6 +230,22 @@ print(vban.bus[0].levels.all) `levels.all` will return -200.0 if no audio detected. +### Strip | Bus + +The following methods are available. + +- `fadeto(amount, time)`: float, int +- `fadeby(amount, time)`: float, int + +Modify gain to or by the selected amount in db over a time interval in ms. + +example: + +```python +vban.strip[0].fadeto(-10.3, 1000) +vban.bus[3].fadeby(-5.6, 500) +``` + ### Command Certain 'special' commands are defined by the API as performing actions rather than setting values. The following methods are available: diff --git a/vban_cmd/bus.py b/vban_cmd/bus.py index c6633c1..600c76d 100644 --- a/vban_cmd/bus.py +++ b/vban_cmd/bus.py @@ -43,6 +43,14 @@ class Bus(IRemote): def gain(self, val: float): self.setter("gain", val) + def fadeto(self, target: float, time_: int): + self.setter("FadeTo", f"({target}, {time_})") + time.sleep(self._remote.DELAY) + + def fadeby(self, change: float, time_: int): + self.setter("FadeBy", f"({change}, {time_})") + time.sleep(self._remote.DELAY) + class PhysicalBus(Bus): def __str__(self): diff --git a/vban_cmd/strip.py b/vban_cmd/strip.py index e1e13b5..cb7d259 100644 --- a/vban_cmd/strip.py +++ b/vban_cmd/strip.py @@ -1,3 +1,4 @@ +import time from abc import abstractmethod from typing import Union @@ -40,6 +41,14 @@ class Strip(IRemote): def gain(self, val: float): self.setter("gain", val) + def fadeto(self, target: float, time_: int): + self.setter("FadeTo", f"({target}, {time_})") + time.sleep(self._remote.DELAY) + + def fadeby(self, change: float, time_: int): + self.setter("FadeBy", f"({change}, {time_})") + time.sleep(self._remote.DELAY) + class PhysicalStrip(Strip): def __str__(self): @@ -86,6 +95,12 @@ class VirtualStrip(Strip): def k(self, val: int): self.setter("karaoke", val) + def appgain(self, name: str, gain: float): + self.setter("AppGain", f'("{name}", {gain})') + + def appmute(self, name: str, mute: bool = None): + self.setter("AppMute", f'("{name}", {1 if mute else 0})') + class StripLevel(IRemote): def __init__(self, remote, index):