def loop(): '''Main loop function, calls processing sub-functions.''' global _jackRunning # compute the current tick interval = 60.0 / tempo / 2 # call the loop twice per beat (for blinking) transportTime = float( jack.get_current_transport_frame()) / jack.get_sample_rate() tickCount = math.floor(transportTime / interval) if tickCount > 0 and not _jackRunning: print 'jack is up and running... starting monome sequencer' _jackRunning = True if jack.get_transport_state() != jack.TransportRolling: # jack is stopped... stop processing here, as well if tickCount == 0 and _jackRunning: print 'jack transport has been stopped... waiting for jack to be restarted' _jackRunning = False mon.led_all(0) for i, itrack in tracks.iteritems(): itrack.clear() Timer(0.1, loop).start() return # processing readEvents(tickCount) beat(tickCount) # see when the loop needs to be called the next time transportTime = float( jack.get_current_transport_frame()) / jack.get_sample_rate() waitTime = (tickCount + 1) * interval - transportTime Timer(waitTime, loop).start()
def refreshUi(self): state = jack.get_transport_state() frame = jack.get_current_transport_frame() rate = jack.get_sample_rate() # Jack State if (state == 0): self.l_state.setText("Stopped") self.b_play.setChecked(False) elif (state == 1): self.l_state.setText("Rolling") self.b_play.setChecked(True) elif (state == 3): self.l_state.setText("Starting") else: self.l_state.setText("Unknown (%i)" % state) # Current Time time = frame / rate secs = time % 60 mins = (time / 60) % 60 hrs = (time / 3600) % 60 secH = minH = hrsH = "" if secs < 10: secH = "0" if mins < 10: minH = "0" if hrs < 10: hrsH = "0" self.l_time.setText(hrsH+str(hrs)+":"+minH+str(mins)+":"+secH+str(secs)) # Current Frame self.l_frame.setText(str(frame))
def refreshUi(self): state = jack.get_transport_state() frame = jack.get_current_transport_frame() rate = jack.get_sample_rate() # Jack State if (state == 0): self.l_state.setText("Stopped") self.b_play.setChecked(False) elif (state == 1): self.l_state.setText("Rolling") self.b_play.setChecked(True) elif (state == 3): self.l_state.setText("Starting") else: self.l_state.setText("Unknown (%i)" % state) # Current Time time = frame / rate secs = time % 60 mins = (time / 60) % 60 hrs = (time / 3600) % 60 secH = minH = hrsH = "" if secs < 10: secH = "0" if mins < 10: minH = "0" if hrs < 10: hrsH = "0" self.l_time.setText(hrsH + str(hrs) + ":" + minH + str(mins) + ":" + secH + str(secs)) # Current Frame self.l_frame.setText(str(frame))
def loop(): """Main loop function, calls processing sub-functions.""" global _jackRunning # compute the current tick interval = 60.0 / tempo / 2 # call the loop twice per beat (for blinking) transportTime = float(jack.get_current_transport_frame()) / jack.get_sample_rate() tickCount = math.floor(transportTime / interval) if tickCount > 0 and not _jackRunning: print "jack is up and running... starting monome sequencer" _jackRunning = True if jack.get_transport_state() != jack.TransportRolling: # jack is stopped... stop processing here, as well if tickCount == 0 and _jackRunning: print "jack transport has been stopped... waiting for jack to be restarted" _jackRunning = False mon.led_all(0) for i, itrack in tracks.iteritems(): itrack.clear() Timer(0.1, loop).start() return # processing readEvents(tickCount) beat(tickCount) # see when the loop needs to be called the next time transportTime = float(jack.get_current_transport_frame()) / jack.get_sample_rate() waitTime = (tickCount + 1) * interval - transportTime Timer(waitTime, loop).start()
def print_state(): state = jack.get_transport_state() statename = { jack.TransportStopped: "stopped", jack.TransportRolling: "rolling", jack.TransportStarting: "starting" }[state] print("current state is %i (%s)" % (state, statename))
def print_state(): state = jack.get_transport_state() statename = { jack.TransportStopped:"stopped", jack.TransportRolling:"rolling", jack.TransportStarting:"starting" } [state] print("current state is %i (%s)"% (state, statename))
def gui(): global play_button BGL.glClearColor(*map(lambda x: x / 255.0, Window.Theme.Get()[0].get('buts').back)) BGL.glClear(BGL.GL_COLOR_BUFFER_BIT) Draw.BeginAlign() if jack.get_transport_state() == jack.TransportStopped: play_button.val = 0 button_text = "play" else: play_button.val = 1 button_text = "pause" Draw.PushButton("s", BEV_START, 1, 1, 20, 20, "Go to 0") Draw.PushButton("<", BEV_PREV, 20, 1, 20, 20, "Go back") Draw.PushButton(">", BEV_NEXT, 40, 1, 20, 20, "Go forward") play_button = Draw.Toggle(button_text, BEV_PLAY, 60, 1, 75, 20, play_button.val, "Play / Pause") Draw.PushButton("x", BEV_EXIT, 135, 1, 25, 20, "Exit from script") Draw.EndAlign()
def get_state(): return jack.get_transport_state()