voicemeeter-remote-python
voicemeeter-remote-python copied to clipboard
When trying to use the API 2 times in a row, an error occurs: voicemeeter.errors.VMRDriverError: VMR#VBVMR_Login() returned -2
For example, this code:
import time
import voicemeeter
# Can be 'basic', 'banana' or 'potato'
kind = 'potato'
# Ensure that Voicemeeter is launched
voicemeeter.launch(kind)
#action 1
with voicemeeter.remote(kind) as vmr:
# Set the mapping of the second input strip
vmr.inputs[1].A4 = True
print(f'Output A4 of Strip {vmr.inputs[1].label}: {vmr.inputs[1].A4}')
time.sleep(10)
#action 2
with voicemeeter.remote(kind) as vmr:
# Set the mapping of the second input strip
vmr.inputs[1].A4 = False
print(f'Output A4 of Strip {vmr.inputs[1].label}: {vmr.inputs[1].A4}')
It's as if the first call doesn't release the dll. I also tried using Logout, without with, as the first action is triggered, and the second gives an error.
I wanted to integrate this with my voice assistant, but even if the commands are called after a while, the error occurs the second time. If you run the python script with action 1 and then close it, change it to action 2 and run it, then everything works, but in my case restarting the python script is not an option. What's the matter?