Beispiel #1
0
    def controlPressed(self, control):
        if not self.song:
            return

        if control == Player.UP:
            self.guitar.selectPreviousString()
        elif control == Player.DOWN:
            self.guitar.selectNextString()
        elif control == Player.LEFT:
            self.pos = self.snapPos - self.song.period / 4
        elif control == Player.RIGHT:
            self.pos = self.snapPos + self.song.period / 4
        elif control in KEYS:
            self.heldFrets.add(KEYS.index(control))
        elif control in [Player.ACTION1, Player.ACTION2]:
            self.newNotePos = self.snapPos
            # Add notes for the frets that are held down or for the selected string.
            if self.heldFrets:
                self.newNotes = [
                    Note(f, self.song.period / 4) for f in self.heldFrets
                ]
            else:
                self.newNotes = [
                    Note(self.guitar.selectedString, self.song.period / 4)
                ]
            self.modified = True
Beispiel #2
0
  def controlReleased(self, control):
    if not self.song:
      return

    if control in [Player.ACTION1, Player.ACTION2] and self.newNotes and not self.heldFrets:
      self.newNotes = []
    elif control in KEYS:
      self.heldFrets.remove(KEYS.index(control))
      if not self.heldFrets and self.newNotes:
        self.newNotes = []
Beispiel #3
0
    def controlReleased(self, control):
        if not self.song:
            return

        if control in [Player.ACTION1, Player.ACTION2
                       ] and self.newNotes and not self.heldFrets:
            self.newNotes = []
        elif control in KEYS:
            self.heldFrets.remove(KEYS.index(control))
            if not self.heldFrets and self.newNotes:
                self.newNotes = []
Beispiel #4
0
  def controlPressed(self, control):
    if not self.song:
      return

    if control == Player.UP:
      self.guitar.selectPreviousString()
    elif control == Player.DOWN:
      self.guitar.selectNextString()
    elif control == Player.LEFT:
      self.pos = self.snapPos - self.song.period / 4
    elif control == Player.RIGHT:
      self.pos = self.snapPos + self.song.period / 4
    elif control in KEYS:
      self.heldFrets.add(KEYS.index(control))
    elif control in [Player.ACTION1, Player.ACTION2]:
      self.newNotePos = self.snapPos
      # Add notes for the frets that are held down or for the selected string.
      if self.heldFrets:
        self.newNotes = [Note(f, self.song.period / 4) for f in self.heldFrets]
      else:
        self.newNotes = [Note(self.guitar.selectedString, self.song.period / 4)]
      self.modified   = True