예제 #1
0
 def on_zyncoder(self, encoder, value):
     if self.lst_menu.winfo_viewable():
         # Menu browsing
         if encoder == ENC_SELECT or encoder == ENC_LAYER:
             if self.lst_menu.size() < 1:
                 return
             index = 0
             try:
                 index = self.lst_menu.curselection()[0]
             except:
                 logging.error("Problem detecting menu selection")
             index = index + value
             if index < 0:
                 index = 0
             if index >= self.lst_menu.size():
                 index = self.lst_menu.size() - 1
             self.lst_menu.selection_clear(0, tkinter.END)
             self.lst_menu.selection_set(index)
             self.lst_menu.activate(index)
             self.lst_menu.see(index)
             return
     elif self.param_editor_item:
         # Parameter change
         if encoder == ENC_SELECT or encoder == ENC_LAYER:
             self.change_param(value)
         elif encoder == ENC_SNAPSHOT:
             self.change_param(value / 10)
     elif encoder == ENC_SNAPSHOT:
         libseq.setTempo(ctypes.c_double(libseq.getTempo() + 0.1 * value))
         self.set_title("Tempo: %0.1f BPM" % (libseq.getTempo()), None,
                        None, 2)
     elif encoder == ENC_LAYER:
         self.select_bank(self.bank + value)
	def start_playing(self, fpath=None):
		self.stop_playing()

		if fpath is None:
			fpath = self.get_current_track_fpath()
		
		if fpath is None:
			logging.info("No track to play!")
			return

		logging.info("STARTING MIDI PLAY '{}' ...".format(fpath))

		try:
			zynsmf.load(self.smf_player,fpath)
			tempo = int(libsmf.getTempo(self.smf_player, 0))
			libseq.setTempo(tempo) #TODO: This isn't working
			libsmf.startPlayback()
			zynseq.transport_start("zynsmf")
#			libseq.transportLocate(0)
			self.show_playing_bpm()
			self.current_playback_fpath=fpath
			self.smf_timer = Timer(interval = 1, function=self.check_playback)
			self.smf_timer.start()
		except Exception as e:
			logging.error("ERROR STARTING MIDI PLAY: %s" % e)
			self.zyngui.show_info("ERROR STARTING MIDI PLAY:\n %s" % e)
			self.zyngui.hide_info_timer(5000)

		self.update_list()
		return True
예제 #3
0
 def on_menu_change(self, params):
     value = params['value']
     if value < params['min']:
         value = params['min']
     if value > params['max']:
         value = params['max']
     if self.param_editor_item == 'Bank':
         self.select_bank(value)
     elif self.param_editor_item == 'Tempo':
         libseq.setTempo(ctypes.c_double(value))
         return "Tempo: %0.1f BPM" % (value)
     elif self.param_editor_item == "Beats per bar":
         libseq.setBeatsPerBar(value)
     self.set_param(self.param_editor_item, 'value', value)
     return "%s: %d" % (self.param_editor_item, value)
	def send_controller_value(self, zctrl):
		if zctrl.symbol=="bpm":
			libseq.setTempo(zctrl.value)
			logging.debug("SET PLAYING BPM => {}".format(zctrl.value))