- def __init__(self, group, hue, rect, tone) :
- pygame.sprite.Sprite.__init__(self, group)
- sur = pygame.surface.Surface(rect.size)
- rgba = hls_to_rgba_8bits(hue, OFF_LUMINANCE, OFF_SATURATION)
- sur.fill(rgba)
- self.stateOff = sur
- self.rectOff = rect
-
- topRgba = hls_to_rgba_8bits(hue, ON_TOP_LUMINANCE, ON_SATURATION, ON_COLUMN_ALPHA)
- bottomRgba = hls_to_rgba_8bits(hue, ON_BOTTOM_LUMINANCE, ON_SATURATION, ON_COLUMN_ALPHA)
- onWidth = rect.width * ON_COLUMN_OVERSIZING
- onLeft = rect.centerx - onWidth / 2
- rectOn = pygame.Rect((onLeft, 0),
- (onWidth, rect.height))
- self.stateOn = gradients.vertical(rectOn.size, topRgba, bottomRgba)
- self.rectOn = rectOn
-
- self.image = self.stateOff
- self.rect = rect
- self.toneName = FONT.render(tone.nom, True, (0,0,0))
+ def handleColumnDown(self, event) :
+ col = event.column
+ if col.state:
+ self.synth.noteon(0, col.tone.midi, DEFAULT_MIDI_VELOCITY)
+ self.currentNotePlayed = True