Browse Source

moving midiseq playhead

only works for 120bpm right now
tags/1.9.6
rhetr 9 years ago
parent
commit
0fd0021fa6
1 changed files with 9 additions and 4 deletions
  1. +9
    -4
      source/native-plugins/resources/midiseq-ui

+ 9
- 4
source/native-plugins/resources/midiseq-ui View File

@@ -373,9 +373,11 @@ class PianoRoll(QGraphicsScene):
# -------------------------------------------------------------------------
# Callbacks

def movePlayHead(self, t):
total_duration = 1920 * self.time_sig[0] * self.num_measures
pos = t['bar']*1920*self.time_sig[0] + t['beat']*1920 + t['tick']
def movePlayHead(self, transport_info):
# TODO: need conversion between frames and PPQ
x = 105. # works for 120bpm
total_duration = self.time_sig[0] * self.num_measures * x
pos = transport_info['frame'] / x
frac = (pos % total_duration) / total_duration
self.play_head.setPos(QPointF(frac * self.grid_width, 0))

@@ -1108,6 +1110,8 @@ class MainWindow(ExternalUI, QWidget):
if beat != self.fTransportInfo["beat"]:
print(beat)

old_frame = self.fTransportInfo['frame']

self.fTransportInfo = {
"playing": playing,
"frame": frame,
@@ -1119,7 +1123,8 @@ class MainWindow(ExternalUI, QWidget):
"sigDenom": sigDenom
}

self.piano.movePlayHead(self.fTransportInfo)
if old_frame != frame:
self.piano.movePlayHead(self.fTransportInfo)


elif msg == "show":


Loading…
Cancel
Save