Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(0)  |  Call(0)  |  Derive(0)  |  Import(0)

src/s/e/Selected_Track_Control-HEAD/SessionControl.py   Selected_Track_Control(Download)
	def on_track_selected(self):
		self.select_playing_clip(127, MIDI.ABSOLUTE, MIDI.NOTEON_STATUS)
 
 
	def select_playing_clip(self, value, mode, status):
			track.fold_state = not track.fold_state
		elif status == MIDI.CC_STATUS:
			if  mode == MIDI.ABSOLUTE:
				track.fold_state = value < 64
			else:
	def scroll_scenes(self, value, mode, status):
		if mode == MIDI.ABSOLUTE:
			# invert value (127-value), somehow feels more natural to turn left to go fully down and right to go up
			# also when assigning this to a fader this is more natural as up is up and down is down
			index = int((127-value)/(128.0/len(self.song.scenes)))
	def scroll_tracks(self, value, mode, status):
		if mode == MIDI.ABSOLUTE:
			tracks = self.get_all_tracks(only_visible = True)
			index = int(value/(128.0/len(tracks)))
			self.song.view.selected_track = tracks[index]
	def get_scene_index(self, value, mode, status):
		if mode == MIDI.ABSOLUTE:
			# get scene at index given in value 
			# if value to big then get last possible
			# usually values in absolute mode are greater 0, but make sure they are

src/s/e/Selected_Track_Control-HEAD/GlobalControl.py   Selected_Track_Control(Download)
			track_view.is_collapsed = not track_view.is_collapsed
		else:
			if mode == MIDI.ABSOLUTE:
				if value == 127:
					# CC toggle (like on LPD8)
	def set_tempo(self, value, mode, status):
		if mode == MIDI.ABSOLUTE:
			self.song.tempo = settings.tempo_min + value*self.tempo_step
		else:
			self.song.tempo = self.song.tempo + value
	def set_groove_amount(self, value, mode, status):
		if mode == MIDI.ABSOLUTE:
			self.song.groove_amount = (value/127.0)*1.3
		else:
			self.song.groove_amount = max(0, min(self.song.groove_amount + value/100.0, 1.3))

src/s/e/Selected_Track_Control-HEAD/DeviceControl.py   Selected_Track_Control(Download)
			("prev_device_bank", self.prev_device_bank),
			("next_device_bank", self.next_device_bank),
			("reset_device_bank", lambda value, mode, status: self.select_device_bank(0, MIDI.ABSOLUTE, MIDI.CC_STATUS)),
 
 
	def select_device_bank(self, value, mode, status):
		if mode == MIDI.ABSOLUTE:
			self.bank = self.max_banks*value/128
		else:
			self.bank = max(0, min(self.max_banks-1, self.bank + value))
	def scroll_devices(self, value, mode, status):
		if mode == MIDI.ABSOLUTE:
			#container = self.song.view.selected_track
			container = self.song.view.selected_track.view.selected_device.canonical_parent
			len_devices = len(container.devices)

src/s/e/Selected_Track_Control-HEAD/MixerControl.py   Selected_Track_Control(Download)
	def _set_volume(self, param, value, mode):
		if mode == MIDI.ABSOLUTE:
			param.value = value/127.0
		else:
			param.value = max(0.0, min(1.0, param.value + (value/200.0)))
	def set_pan(self, value, mode, status):
		param = self.song.view.selected_track.mixer_device.panning
		if mode == MIDI.ABSOLUTE:
			param.value = (value-64)/64.0
 
	def set_send(self, i, value, mode, status):
		param = self.song.view.selected_track.mixer_device.sends[i]
		if param:
			if mode == MIDI.ABSOLUTE:
				param.value = value/127.0
	def get_routing_index(self, value, mode, status, current_routing, routings):
		routings_len = len(routings)
		if status == MIDI.CC_STATUS and mode == MIDI.ABSOLUTE:
			return min(value/(127/routings_len), routings_len)
		else:
					break
				i = i+1
			if mode == MIDI.ABSOLUTE:
				i = i+1
			else:

src/s/e/Selected_Track_Control-HEAD/SelectedTrackControl.py   Selected_Track_Control(Download)
	def suggest_map_mode(self, cc_no):
		#log("suggest_map_mode")
		if cc_no in self.midi_cc_to_mode:
			return self.midi_cc_to_mode[cc_no]
		return MIDI.ABSOLUTE # see MIDI.py for definitions of modes
		# execute callbacks that are registered for this event
		callbacks = self.midi_callbacks.get(channel,{}).get(status,{}).get(key,[])
		mode = MIDI.ABSOLUTE
		if status == MIDI.CC_STATUS:
			# get mode and calculate signed int for MIDI value

src/s/e/Selected_Track_Control-HEAD/ParamSetter.py   Selected_Track_Control(Download)
def general_device(song, device, param, value, mode, status):
	param_range = param.max - param.min
	#log("set %s (%s): %s - %s" % (param.name, param.value, param.min, param.max))
	if param.is_quantized:
		if status == MIDI.CC_STATUS and mode == MIDI.ABSOLUTE:
				param.value = max(param.min, min(param.max, param.value + value))
	else:
		if mode == MIDI.ABSOLUTE:
			param.value = param_range*value/127.0 + param.min
		else:

src/s/e/Selected_Track_Control-HEAD/QuantizationControl.py   Selected_Track_Control(Download)
	def _get_quantization(self, value, mode, status, current_quantization, quantizations):
		nr_of_quantizations = len(quantizations)
 
		if status == MIDI.CC_STATUS and mode == MIDI.ABSOLUTE:
			return quantizations[nr_of_quantizations*value/128]

src/s/e/Selected_Track_Control-HEAD/ViewControl.py   Selected_Track_Control(Download)
	def toggle_view(self, value, mode, status, view):
		if status == MIDI.CC_STATUS and not value: # ignore 0 values from CC-pads
			return
 
		if status == MIDI.CC_STATUS and mode == MIDI.ABSOLUTE:
	def toggle_detail(self, value, mode, status, view):
		if status == MIDI.CC_STATUS and not value: # ignore 0 values from CC-pads
			return
 
		if status == MIDI.CC_STATUS and mode == MIDI.ABSOLUTE: