iterate over cells.

This commit is contained in:
onyx-and-iris 2025-06-15 23:32:47 +01:00
parent fe1f4ee324
commit 1ff2017d51

View File

@ -2,39 +2,49 @@ import time
import voicemeeterlib import voicemeeterlib
# Creates an array of channels you want to edit
# s is the channel to start on, n is how many channels to edit
def create_channel_array(s, n):
return list(range(s, s+n))
def main(): def main():
KIND_ID = 'banana' KIND_ID = 'banana'
BUS_INDEX = 0 # Index of the bus to edit, can be changed as needed
CHANNEL_INDEX = 0 # Index of the channel to edit, can be changed as needed
with voicemeeterlib.api(KIND_ID) as vm: with voicemeeterlib.api(KIND_ID) as vm:
print( 'Check getting values' ) print(f'Bus[{BUS_INDEX}].EQ.on: {vm.bus[BUS_INDEX].eq.on}')
print( f'Bus[0].EQ.on: {vm.bus[0].eq.on}') print(
print( f'Bus[0].EQ.channel[0].cell[0].on: {vm.bus[0].eq.channel[0].cell[0].on}') f'Bus[{BUS_INDEX}].EQ.channel[{CHANNEL_INDEX}].cell[0].on: {vm.bus[BUS_INDEX].eq.channel[CHANNEL_INDEX].cell[0].on}'
)
print('Check sending commands (should affect your VM Banana window)') print('Check sending commands (should affect your VM Banana window)')
channels_idx = create_channel_array(0, 2)
vm.bus[0].eq.on = True
vm.bus[0].eq.ab = 0 # corresponds to A EQ memory slot
vm.bus[0].mute = False
for i in channels_idx:
vm.bus[0].eq.channel[i].cell[0].on = True
vm.bus[0].eq.channel[i].cell[0].f = 500
vm.bus[0].eq.channel[i].cell[0].gain = -10
vm.bus[0].eq.channel[i].cell[0].type = 3 # Should correspond to LPF
vm.bus[0].eq.channel[i].cell[0].q = 10
time.sleep(3) vm.bus[BUS_INDEX].eq.on = True
vm.bus[0].eq.on = False vm.bus[BUS_INDEX].eq.ab = 0 # corresponds to A EQ memory slot
for i in channels_idx: vm.bus[BUS_INDEX].mute = False
vm.bus[0].eq.channel[i].cell[0].on = False
vm.bus[0].eq.channel[i].cell[0].f = 50 for j, cell in enumerate(vm.bus[BUS_INDEX].eq.channel[CHANNEL_INDEX].cell):
vm.bus[0].eq.channel[i].cell[0].gain = 0 cell.on = True
vm.bus[0].eq.channel[i].cell[0].type = 0 cell.f = 500
vm.bus[0].eq.channel[i].cell[0].q = 3 cell.gain = -10
cell.type = 3 # Should correspond to LPF
cell.q = 10
print(
f'Channel {CHANNEL_INDEX}, Cell {j}: on={cell.on}, f={cell.f}, type={cell.type}, gain={cell.gain}, q={cell.q}'
)
time.sleep(1) # Sleep to simulate processing time
cell.on = False
cell.f = 50
cell.gain = 0
cell.type = 0
cell.q = 3
print(
f'Channel {CHANNEL_INDEX}, Cell {j}: on={cell.on}, f={cell.f}, type={cell.type} , gain={cell.gain}, q={cell.q}'
)
vm.bus[BUS_INDEX].eq.on = False
if __name__ == '__main__': if __name__ == '__main__':
main() main()