Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, griode, grid_name):
self.griode = griode
self.grid_name = grid_name
persistent_attrs_init(self, grid_name)
self.surface_map = {} # maps leds to gridgets
self.colorpicker = ColorPicker(self)
self.faders = Faders(self)
self.bpmsetter = BPMSetter(self)
self.notepickers = [NotePicker(self, i) for i in range(16)]
self.instrumentpickers = [InstrumentPicker(self, i) for i in range(16)]
self.scalepicker = ScalePicker(self)
self.arpconfigs = [ArpConfig(self, i) for i in range(16)]
self.latchconfigs = [LatchConfig(self, i) for i in range(16)]
self.loopcontroller = LoopController(self)
self.menu = Menu(self)
self.focus(self.menu, MENU)
self.focus(self.notepickers[self.channel])
def __init__(self, griode):
self.griode = griode
persistent_attrs_init(self)
# FIXME don't duplicate the CC mappings
for cc, array in [
(7, self.volume),
(91, self.chorus),
(93, self.reverb),
]:
for channel, value in enumerate(array):
m = mido.Message("control_change", control=cc, value=value)
self.griode.devicechains[channel].send(m)
def __init__(self, griode):
self.griode = griode
persistent_attrs_init(self)
self.playing = False
self.last_tick = 0 # Last (=current) tick
self.loops_playing = set() # Contains instances of Loop
self.loops_recording = set() # Also instances of Loop
self.notes_recording = {} # note -> (Note(), tick_when_started)
self.notes_playing = [] # (stop_tick, channel, note)
self.loops = {}
self.teacher = Teacher(self)
for row in range(1, 9):
for column in range(1, 9):
self.loops[row, column] = Loop(self, (row, column))
def __init__(self):
persistent_attrs_init(self)
self.synth = Fluidsynth()
self.devicechains = [DeviceChain(self, i) for i in range(16)]
self.grids = []
self.cpu = CPU(self)
self.clock = Clock(self)
self.looper = Looper(self)
self.mixer = Mixer(self)
self.detect_devices()
# FIXME: probably make this configurable somehow (env var...?)
if False:
from termpad import ASCIIGrid
self.grids.append(ASCIIGrid(self, 0, 1))
def __init__(self, looper, number):
self.looper = looper
persistent_attrs_init(
self, "C{:02}L{:02}".format(looper.channel, number))
def __init__(self, grid, channel):
self.grid = grid
self.surface = Surface(grid.surface)
for button in "UP DOWN LEFT RIGHT".split():
self.surface[button] = palette.CHANNEL[channel]
self.channel = channel
persistent_attrs_init(self, "{}__{}".format(self.grid.grid_name, channel))
self.led2note = {}
self.note2leds = collections.defaultdict(list)
devicechain = self.grid.griode.devicechains[self.grid.channel]
if devicechain.instrument.is_drumkit:
self.mapping = self.drumkit_mapping
else:
self.mapping = self.melodic_mapping
self.switch()
def __init__(self, griode):
self.griode = griode
persistent_attrs_init(self)
self.tick = 0 # 24 ticks per quarter note
self.next = time.time()
self.cues = []
def __init__(self, devicechain):
self.devicechain = devicechain
persistent_attrs_init(self, str(devicechain.channel))
self.notes = []
self.next_note = 0 # That's a position in self.notes
self.direction = 1 # Always 1, except when in BOUNCING mode
self.latch_notes = set()
self.playing = []
self.next_step = 0 # That's a position in self.pattern
self.next_tick = 0 # Note: next_tick==0 also means "NOW!"
def __init__(self, devicechain):
self.devicechain = devicechain
persistent_attrs_init(self, str(devicechain.channel))
self.notes = set()
def __init__(self, looper, cell):
self.looper = looper
self.cell = cell
persistent_attrs_init(self, "{},{}".format(*cell))
self.next_tick = 0 # next "position" to be played in self.notes