voicemeeter-api-python/__main__.py

47 lines
1.1 KiB
Python
Raw Normal View History

2022-06-16 14:07:12 +01:00
import voicemeeterlib
class ManyThings:
def __init__(self, vm):
self.vm = vm
def things(self):
2025-01-15 12:40:31 +00:00
self.vm.strip[0].label = 'podmic'
2022-06-16 14:07:12 +01:00
self.vm.strip[0].mute = True
print(
2025-01-15 12:40:31 +00:00
f'strip 0 ({self.vm.strip[0].label}) mute has been set to {self.vm.strip[0].mute}'
2022-06-16 14:07:12 +01:00
)
def other_things(self):
2022-10-19 13:51:25 +01:00
self.vm.bus[3].gain = -6.3
2023-06-24 19:06:23 +01:00
self.vm.bus[4].eq.on = True
2022-06-16 14:07:12 +01:00
info = (
2025-01-15 12:40:31 +00:00
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.on}',
2022-06-16 14:07:12 +01:00
)
2025-01-15 12:40:31 +00:00
print('\n'.join(info))
2022-06-16 14:07:12 +01:00
def main():
2025-01-15 12:40:31 +00:00
KIND_ID = 'banana'
2023-06-24 19:06:23 +01:00
with voicemeeterlib.api(KIND_ID) as vm:
2022-06-16 14:07:12 +01:00
do = ManyThings(vm)
do.things()
do.other_things()
# set many parameters at once
vm.apply(
{
2025-01-15 12:40:31 +00:00
'strip-2': {'A1': True, 'B1': True, 'gain': -6.0},
'bus-2': {'mute': True, 'eq': {'on': True}},
'button-0': {'state': True},
'vban-in-0': {'on': True},
'vban-out-1': {'name': 'streamname'},
2022-06-16 14:07:12 +01:00
}
)
2025-01-15 12:40:31 +00:00
if __name__ == '__main__':
2022-06-16 14:07:12 +01:00
main()