This repository has been archived by the owner on Jan 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
device_LaunchKey.py
121 lines (84 loc) · 2.65 KB
/
device_LaunchKey.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# name=LaunchKey Mk2
# url=https://forum.image-line.com/viewtopic.php?f=1994&t=231871
# receiveFrom=LaunchKey Mk2 Extension
"""
device_LaunchKey.py
This file is the controller file for port 1 of the LaunchKey Mk2.
It handles most note and controller events.
Author: Miguel Guthridge [hdsq@outlook.com.au]
"""
#-------------------------------
# Edit this file at your own risk. All user-modifyable variables are found in 'config.py'.
#-------------------------------
import patterns
import channels
import mixer
import device
import transport
import arrangement
import general
import launchMapPages
import playlist
import ui
# import screen
import midi
import utils
import config
import internal
import eventprocessor
import internal.consts
import processorhelpers
# device.dispatch(2, 0x9F + (0x0C << 8) + (0x00 << 16))
class TGeneric():
def __init__(self):
return
def OnInit(self):
try:
if internal.state.SHARED_INIT_STATE is internal.consts.INIT_INCOMPLETE:
# Run shared init functions
internal.sharedInit()
except Exception as e:
internal.errors.triggerError(e)
print('Initialisation complete')
print(internal.getLineBreak())
print(internal.getLineBreak())
print("")
print("")
def OnDeInit(self):
print('Deinitialisation complete')
def OnMidiIn(self, event):
event.handled = False
internal.performance.eventClock.start()
# Process the event into ParsedEvent format
command = processorhelpers.ParsedEvent(event)
# Print event before processing
internal.printCommand(command)
# Process event
eventprocessor.processBasic(command)
# If command was edited, update event object
if command.edited:
event.status = command.status
event.data1 = command.note
event.data2 = command.value
if command.handled:
event.handled = True
internal.performance.eventClock.stop()
# Print output
internal.printCommandOutput(command)
def OnIdle(self):
internal.idleProcessor()
if internal.shifts["MAIN"].query():
internal.state.idleShift()
def OnUpdateBeatIndicator(self, beat):
eventprocessor.beatChange(beat)
Generic = TGeneric()
def OnInit():
Generic.OnInit()
def OnDeInit():
Generic.OnDeInit()
def OnMidiIn(event):
Generic.OnMidiIn(event)
def OnIdle():
Generic.OnIdle()
def OnUpdateBeatIndicator(beat):
Generic.OnUpdateBeatIndicator(beat)