""" Organizes the channel names of the midi map for XTouch Mini into a dictionary that more closely resembles the physical layout """ from TDStoreTools import StorageManager import TDFunctions as TDF class MidiExt: """ MidiExt description """ def __init__(self, ownerComp): self.ownerComp = ownerComp self.midiOp = parent().op('midi_map') self.ChannelLayers = {} layers = ['A', 'B'] numSliders = 9 buttonsInRow = 8 buttonRows = 3 buttonsInLayer = buttonRows * buttonsInRow for idx, layer in enumerate(layers): knobOffset = numSliders * idx buttonOffset = idx * buttonsInLayer self.ChannelLayers[layer] = { 'Sliders': ["s{}".format(x) for x in range(1 + knobOffset ,1 + numSliders + knobOffset) ], 'SliderButtons': ["b{}".format(x) for x in range(1 + buttonOffset , 1 + buttonsInRow + buttonOffset)], 'Buttons': ["b{}".format(x) for x in range(1 + buttonOffset + buttonsInRow, 1 + buttonsInLayer + buttonOffset + buttonsInRow)] }