/
customosc.py
executable file
·39 lines (32 loc) · 1.17 KB
/
customosc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from mididings import Call
import mididings.engine as _engine
import mididings.setup as _setup
import mididings.misc as _misc
import mididings.extra.panic as _panic
import liblo as _liblo
class OSCCustomInterface(object):
def __init__(self, port=56418):
self.port = port
def on_start(self):
if self.port is not None:
self.server = _liblo.ServerThread(self.port)
self.server.register_methods(self)
self.server.start()
def on_exit(self):
if self.port is not None:
self.server.stop()
del self.server
@_liblo.make_method('/pedalBoard/button', 'i')
def button_cb(self, path, args):
if args[0] == 12:
_engine.switch_subscene(2)
if args[0] == 11:
_liblo.send(9999, '/video/freeze/toggle')
if _engine.current_subscene() == 2:
_engine.switch_scene(args[0])
_engine.switch_subscene(1)
if _engine.current_subscene() == 1:
if args[0] < 8: # Desactivation des boutons 7, 8, 9, 10
clip_number = args[0] + (_engine.current_scene()-1)*7
_liblo.send(9999, '/clip/select', clip_number)
_liblo.send(9999, '/clip/goto', 1)