Script to automatically set Volume to a value (USB-UIRT)
Posted: Fri Feb 18, 2011 10:38 am
hello,
I'am starting making some script for eventghost. i would like a little help.
I send from iviewer a broadcast message with a payload value defining the futur new level of my Amplifier.
here is my script, work well.
But i would like to be able to stop this script with an event when i want, actually when i try to send other event they wait the end of the script.
could you help me ?
I'am starting making some script for eventghost. i would like a little help.
I send from iviewer a broadcast message with a payload value defining the futur new level of my Amplifier.
here is my script, work well.
But i would like to be able to stop this script with an event when i want, actually when i try to send other event they wait the end of the script.
could you help me ?
Code: Select all
eg.event.payload=int(eg.event.payload)
togo = eg.event.payload
if togo > eg.globals.volume:
while (eg.globals.volume<togo):
eg.plugins.USB_UIRT.TransmitIR(u'0000 0067 0000 0010 0061 0018 0031 0018 0031 0018 0019 0018 0019 0018 0031 0018 0019 0018 0019 0018 0019 0018 0019 0018 0019 0018 0019 0018 0031 0018 0031 0018 0019 0018 0019 0376', 2, 10)
eg.globals.volume += 1
eg.Wait(0.20000000000000001)
print "VOLUP",eg.globals.volume
else:
while (togo<eg.globals.volume):
eg.plugins.USB_UIRT.TransmitIR(u'0000 0067 0000 0010 0061 0018 0019 0018 0031 0018 0019 0018 0019 0018 0031 0018 0019 0018 0019 0018 0019 0018 0019 0018 0019 0018 0019 0018 0031 0018 0031 0018 0019 0018 0019 038F', 2, 10)
eg.globals.volume -= 1
eg.Wait(0.20000000000000001)
print "VOLDOWN",eg.globals.volume
buffer=str(eg.globals.volume)
print buffer
eg.plugins.BroadcastListener.Broadcast(u'NewVolume',buffer, 33333)