-
Notifications
You must be signed in to change notification settings - Fork 0
/
TrackDevEchoHandler.py
95 lines (76 loc) · 3.37 KB
/
TrackDevEchoHandler.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
# ******************************************************************************
# This file is part of the AaMakro5oul project
# (An OSC/MIDI controller for Ableton Live with DJ features)
#
# Full project source: https://github.com/hiramegl/AaMakro5oul
#
# License : Apache License 2.0
# Full license: https://github.com/hiramegl/AaMakro5oul/blob/master/LICENSE
#
# Copyright 2018, 2019 by Hiram Galicia ([email protected])
# http://www.unasystems.com
#
# All rights reserved.
# ******************************************************************************
from TrackDevBaseHandler import TrackDevBaseHandler
# ******************************************************************************
# Echo audio effect (Ping-Pong delay) commands handler
# ******************************************************************************
class TrackDevEchoHandler(TrackDevBaseHandler):
def __init__(self, _oCtrlInstance, _oOscServer, _hConfig):
TrackDevBaseHandler.__init__(self, _oCtrlInstance, _oOscServer, _hConfig)
def config_device(self):
self.m_bLogRxMsgs = False
self.m_bLogParamsVal = False # use True for development
self.m_sDeviceClass = 'AudioEffectGroupDevice'
self.m_sDeviceNamePat = 'EchoOut'
self.config('/track/dev/echo', self.m_bIgnoreRelease, self.m_bLogRxMsgs)
self.m_aCmds = [
'toggle/dev', # Device On
'fader/effect', # Macro 1, Chain Selector
'fader/beatdl', # Macro 2, Beat Delay
'fader/drywet', # Macro 3, Dry/Wet
'fader/feedbk', # Macro 4, Feedback
'fader/ffreq', # Macro 5, Filter Freq
'fader/fwidt', # Macro 6, Filter Width
'fader/mode', # Macro 7, Mode
'fader/tdelay', # Macro 8, Time Delay
'push/echoout', # maximum effect for echoing out
]
self.m_sAutoCmdPrm = 'fader/effect'
self.m_sAutoCmdTx = 'fader/effect'
def register_param(self, _sTrackType, _nIdxAbs, _sParam, _sOriginal, _oParam):
sCmd = None
if (_sOriginal == 'Device On'):
sCmd = 'toggle/dev'
elif (_sOriginal == 'Macro 1'):
sCmd = 'fader/effect'
elif (_sOriginal == 'Macro 2'):
sCmd = 'fader/beatdl'
elif (_sOriginal == 'Macro 3'):
sCmd = 'fader/drywet'
elif (_sOriginal == 'Macro 4'):
sCmd = 'fader/feedbk'
elif (_sOriginal == 'Macro 5'):
sCmd = 'fader/ffreq'
elif (_sOriginal == 'Macro 6'):
sCmd = 'fader/fwidt'
elif (_sOriginal == 'Macro 7'):
sCmd = 'fader/mode'
elif (_sOriginal == 'Macro 8'):
sCmd = 'fader/tdelay'
# 'hParams': {'sCmd': oParam}
if (sCmd != None):
self.m_hDevices[_sTrackType][_nIdxAbs]['hParams'][sCmd] = _oParam
def handle_param_msg(self, _sChannel, _sTrackType, _nIdxAbs, _sCmd, _sType, _nGuiValue, _bActive):
hParams = self.m_hDevices[_sTrackType][_nIdxAbs]['hParams']
oParam = None
if (_sCmd == 'push'):
oParam = hParams['fader/effect']
nParamValue = 127
self.send_msg('fader/effect/%s' % (_sChannel), 1.0)
else:
oParam = hParams['%s/%s' % (_sCmd, _sType)]
nParamValue = self.value_gui_to_param(_nGuiValue, oParam)
oParam.value = nParamValue
return oParam