当前位置: 首页>>代码示例>>Python>>正文


Python ParamMap.ParamMap类代码示例

本文整理汇总了Python中ParamMap.ParamMap的典型用法代码示例。如果您正苦于以下问题:Python ParamMap类的具体用法?Python ParamMap怎么用?Python ParamMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ParamMap类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: map_params_by_name

 def map_params_by_name(device, param_bank):
     ccs = []
     channel = CHANNEL_SETUP2
     mode = Live.MidiMap.MapMode.relative_two_compliment
     if self.parent.is_lv1:
         ccs = LV1_FX3_CCS + LV1_FX4_CCS
         channel = TRACK_CHANNEL_SETUP2
         mode = Live.MidiMap.MapMode.absolute
     else:
         ccs = FX3_CCS + FX4_CCS
         channel = CHANNEL_SETUP2
     for encoder in range(8):
         if len(params) >= encoder:
             if param_bank[encoder] == '':
                 continue
             param_name = param_bank[encoder]
             parameter = None
             parameter = self.helper.get_parameter_by_name(self.device, param_bank[encoder])
             if parameter:
                 mode2 = mode
                 fullname = self.helper.device_name(device) + '.' + parameter.name
                 if parameter.is_quantized and not self.parent.is_lv1 and not INVERT_QUANT_PARAM.has_key(fullname):
                     mode2 = Live.MidiMap.MapMode.relative_binary_offset
                 self.logfmt('parameter %s %s to %s (quant %s)', parameter, parameter.name, ccs[encoder], parameter.is_quantized)
                 ParamMap.map_with_feedback(midi_map_handle, channel, ccs[encoder], parameter, mode2)
             else:
                 self.log('Could not find parameter %s' % param_bank[encoder])
开发者ID:OwenPratt,项目名称:AbletonLive9_RemoteScripts,代码行数:27,代码来源:FaderfoxDeviceController.py

示例2: map_track_params

 def map_track_params(self, script_handle, midi_map_handle):
     for idx in range(0, 4):
         tracks = self.parent.song().tracks + self.parent.song().return_tracks + (self.parent.song().master_track,)
         if (len(tracks) > idx):
             track = tracks[idx]
             mixer_device = track.mixer_device
             parameter = mixer_device.volume
             ParamMap.map_with_feedback(midi_map_handle, CHANNEL_MIDI_COMMAND, \
                                            PAGE1_CCS[idx], \
                                            parameter, Live.MidiMap.MapMode.absolute)
开发者ID:0438snappy,项目名称:mididuino,代码行数:10,代码来源:MidiCommandMixerController.py

示例3: map_params_by_number

	def map_params_by_number(device):
	    ccs = PAGE3_CCS + PAGE4_CCS
	    channel = CHANNEL_MIDI_COMMAND
	    mode = Live.MidiMap.MapMode.absolute
	    for encoder in range(8):
		# +1 to skip "Device on"
		if (len(device.parameters) >= encoder + 1):
		    ParamMap.map_with_feedback(midi_map_handle, channel, \
					       ccs[encoder], \
					       device.parameters[encoder + 1], \
					       mode)
开发者ID:0438snappy,项目名称:mididuino,代码行数:11,代码来源:MidiCommandDeviceController.py

示例4: map_params_by_number

 def map_params_by_number(device):
     ccs = []
     channel = CHANNEL_SETUP2
     mode = Live.MidiMap.MapMode.relative_two_compliment
     if self.parent.is_lv1:
         ccs = LV1_FX3_CCS + LV1_FX4_CCS
         channel = TRACK_CHANNEL_SETUP2
         mode = Live.MidiMap.MapMode.absolute
     else:
         ccs = FX3_CCS + FX4_CCS
         channel = CHANNEL_SETUP2
     for encoder in range(8):
         if len(device.parameters) >= encoder + 1:
             ParamMap.map_with_feedback(midi_map_handle, channel, ccs[encoder], device.parameters[encoder + 1], mode)
开发者ID:OwenPratt,项目名称:AbletonLive9_RemoteScripts,代码行数:14,代码来源:FaderfoxDeviceController.py

示例5: build_midi_map

    def build_midi_map(self, script_handle, midi_map_handle):

        def forward_note(chan, note):
            Live.MidiMap.forward_midi_note(script_handle, midi_map_handle, chan, note)



        def forward_cc(chan, cc):
            Live.MidiMap.forward_midi_cc(script_handle, midi_map_handle, chan, cc)


        for note in FX3_NOTES:
            forward_note(CHANNEL_SETUP2, note)

        for note in FX4_NOTES:
            forward_note(CHANNEL_SETUP2, note)

        self.log('midi rebuild map')
        tracks = (self.parent.song().tracks + self.parent.song().return_tracks)
        for idx in range(0, 16):
            if (len(tracks) > idx):
                track = tracks[idx]
                eq = self.helper.track_find_last_eq(track)
                self.log(('found eq %s on track %s' % (eq,
                 track)))
                if eq:
                    params = self.helper.eq_params(eq)
                    for i in range(0, 4):
                        if (params[i] != None):
                            self.log(('map %s to %s' % (EQ_CCS[idx][i],
                             params[i])))
                            ParamMap.map_with_feedback(midi_map_handle, AUX_CHANNEL_SETUP2, EQ_CCS[idx][i], params[i], Live.MidiMap.MapMode.absolute)

            master_eq = self.helper.track_find_last_eq(self.parent.song().master_track)
            if master_eq:
                params = self.helper.eq_params(master_eq)
                for i in range(0, 4):
                    if (params[i] != None):
                        ParamMap.map_with_feedback(midi_map_handle, AUX_CHANNEL_SETUP2, MASTER_EQ_CCS[i], params[i], Live.MidiMap.MapMode.absolute)


        self.map_device_params(script_handle, midi_map_handle)
        forward_cc(CHANNEL_SETUP2, CLIP_TRANSPOSE_CC)
开发者ID:Etnorazz,项目名称:LeapConductor,代码行数:43,代码来源:FaderfoxDeviceController.py

示例6: realinit

 def realinit(self, c_instance):
     self.c_instance = c_instance
     self.helper = FaderfoxHelper(self)
     self.param_map = ParamMap(self)
     self.mixer_controller = None
     self.device_controller = None
     self.transport_controller = None
     self.components = []
     live = 'Live 6 & 7'
     if self.is_live_5():
         live = 'Live 5'
     self.show_message(self.__name__ + ' ' + self.__version__ + ' for ' + live)
     self.is_lv1 = False
开发者ID:SteveClement,项目名称:AbletonLive9_RemoteScripts,代码行数:13,代码来源:FaderfoxScript.py

示例7: map_params_by_name

	def map_params_by_name(device, param_bank):
	    ccs = PAGE3_CCS + PAGE4_CCS
	    channel = CHANNEL_MIDI_COMMAND
	    mode = Live.MidiMap.MapMode.absolute
		
#	    self.log("ccs: %s" % ccs)
	    for encoder in range(8):
		if (len(params) >= encoder):
		    if (param_bank[encoder] == ''):
			continue
                    param_name = param_bank[encoder]
                    parameter = None
                    parameter = self.helper.get_parameter_by_name(self.device, param_bank[encoder])
		    if parameter:
			mode2 = mode

                        fullname = self.helper.device_name(device) + "." + parameter.name
			ParamMap.map_with_feedback(midi_map_handle, channel, \
						   ccs[encoder], parameter, \
						   mode2)
		    else:
			self.log("Could not find parameter %s" % param_bank[encoder])
开发者ID:0438snappy,项目名称:mididuino,代码行数:22,代码来源:MidiCommandDeviceController.py

示例8: __init__

class FaderfoxScript:
    __filter_funcs__ = ['update_display', 'log', 'song']
    __module__ = __name__
    __doc__ = 'Automap script for Faderfox controllers'
    __version__ = 'V1.1'
    __name__ = 'Generic Faderfox Script'

    def __init__(self, c_instance):
        self.suffix = ''
        self.is_lv1 = False
        FaderfoxScript.realinit(self, c_instance)

    def realinit(self, c_instance):
        self.c_instance = c_instance
        self.helper = FaderfoxHelper(self)
        self.param_map = ParamMap(self)
        self.mixer_controller = None
        self.device_controller = None
        self.transport_controller = None
        self.components = []
        live = 'Live 6 & 7'
        if self.is_live_5():
            live = 'Live 5'
        self.show_message(self.__name__ + ' ' + self.__version__ + ' for ' + live)
        self.is_lv1 = False

    def is_live_5(self):
        return hasattr(Live, 'is_live_5')

    def log(self, string):
        pass

    def logfmt(self, fmt, *args):
        pass

    def disconnect(self):
        for c in self.components:
            c.disconnect()

    def application(self):
        return Live.Application.get_application()

    def song(self):
        return self.c_instance.song()

    def suggest_input_port(self):
        return str('')

    def suggest_output_port(self):
        return str('')

    def can_lock_to_devices(self):
        return True

    def lock_to_device(self, device):
        if self.device_controller:
            self.device_controller.lock_to_device(device)

    def unlock_to_device(self, device):
        if self.device_controller:
            self.device_controller.unlock_from_device(device)

    def set_appointed_device(self, device):
        if self.device_controller:
            self.device_controller.set_appointed_device(device)

    def toggle_lock(self):
        self.c_instance.toggle_lock()

    def suggest_map_mode(self, cc_no, channel):
        return Live.MidiMap.MapMode.absolute

    def restore_bank(self, bank):
        pass

    def show_message(self, message):
        if hasattr(self.c_instance, 'show_message'):
            self.c_instance.show_message(message)

    def instance_identifier(self):
        return self.c_instance.instance_identifier()

    def connect_script_instances(self, instanciated_scripts):
        pass

    def request_rebuild_midi_map(self):
        self.c_instance.request_rebuild_midi_map()

    def send_midi(self, midi_event_bytes):
        self.c_instance.send_midi(midi_event_bytes)

    def refresh_state(self):
        for c in self.components:
            c.refresh_state()

    def build_midi_map(self, midi_map_handle):
        self.log('script build midi map')
        script_handle = self.c_instance.handle()
        self.param_map.remove_mappings()
        for c in self.components:
#.........这里部分代码省略.........
开发者ID:SteveClement,项目名称:AbletonLive9_RemoteScripts,代码行数:101,代码来源:FaderfoxScript.py

示例9: map_device_params

    def map_device_params(self, script_handle, midi_map_handle):

        def map_params_by_number(device):
            ccs = []
            channel = CHANNEL_SETUP2
            mode = Live.MidiMap.MapMode.relative_two_compliment
            if self.parent.is_lv1:
                ccs = LV1_FX3_CCS + LV1_FX4_CCS
                channel = TRACK_CHANNEL_SETUP2
                mode = Live.MidiMap.MapMode.absolute
            else:
                ccs = FX3_CCS + FX4_CCS
                channel = CHANNEL_SETUP2
            for encoder in range(8):
                if len(device.parameters) >= encoder + 1:
                    ParamMap.map_with_feedback(midi_map_handle, channel, ccs[encoder], device.parameters[encoder + 1], mode)

        def map_params_by_name(device, param_bank):
            ccs = []
            channel = CHANNEL_SETUP2
            mode = Live.MidiMap.MapMode.relative_two_compliment
            if self.parent.is_lv1:
                ccs = LV1_FX3_CCS + LV1_FX4_CCS
                channel = TRACK_CHANNEL_SETUP2
                mode = Live.MidiMap.MapMode.absolute
            else:
                ccs = FX3_CCS + FX4_CCS
                channel = CHANNEL_SETUP2
            for encoder in range(8):
                if len(params) >= encoder:
                    if param_bank[encoder] == '':
                        continue
                    param_name = param_bank[encoder]
                    parameter = None
                    parameter = self.helper.get_parameter_by_name(self.device, param_bank[encoder])
                    if parameter:
                        mode2 = mode
                        fullname = self.helper.device_name(device) + '.' + parameter.name
                        if parameter.is_quantized and not self.parent.is_lv1 and not INVERT_QUANT_PARAM.has_key(fullname):
                            mode2 = Live.MidiMap.MapMode.relative_binary_offset
                        self.logfmt('parameter %s %s to %s (quant %s)', parameter, parameter.name, ccs[encoder], parameter.is_quantized)
                        ParamMap.map_with_feedback(midi_map_handle, channel, ccs[encoder], parameter, mode2)
                    else:
                        self.log('Could not find parameter %s' % param_bank[encoder])

        self.log('map device params %s' % self.device)
        if self.device:
            params = self.device.parameters
            device_bank = 0
            param_bank = 0
            device_name = self.helper.device_name(self.device)
            self.log("device name '%s'" % device_name)
            if device_name in XY_DEVICE_DICT.keys():
                xys = XY_DEVICE_DICT[device_name]
                if len(xys) > 0:
                    param1 = self.helper.get_parameter_by_name(self.device, xys[0][0])
                    param2 = self.helper.get_parameter_by_name(self.device, xys[0][1])
                    ccx = FX1_JOY_X_CC
                    ccy = FX1_JOY_Y_CC
                    channel = CHANNEL_SETUP2
                    if self.parent.is_lv1:
                        ccx = LV1_FX1_JOY_X_CC
                        ccy = LV1_FX1_JOY_Y_CC
                        channel = TRACK_CHANNEL_SETUP2
                    if param1:
                        ParamMap.map_with_feedback(midi_map_handle, channel, ccx, param1, Live.MidiMap.MapMode.absolute)
                    if param2:
                        ParamMap.map_with_feedback(midi_map_handle, channel, ccy, param2, Live.MidiMap.MapMode.absolute)
                if len(xys) > 1:
                    param1 = self.helper.get_parameter_by_name(self.device, xys[1][0])
                    param2 = self.helper.get_parameter_by_name(self.device, xys[1][1])
                    ccx = FX2_JOY_X_CC
                    ccy = FX2_JOY_Y_CC
                    channel = CHANNEL_SETUP2
                    if self.parent.is_lv1:
                        ccx = LV1_FX2_JOY_X_CC
                        ccy = LV1_FX2_JOY_Y_CC
                        channel = TRACK_CHANNEL_SETUP2
                    ParamMap.map_with_feedback(midi_map_handle, channel, ccx, param1, Live.MidiMap.MapMode.absolute)
                    ParamMap.map_with_feedback(midi_map_handle, channel, ccy, param2, Live.MidiMap.MapMode.absolute)
            if device_name in DEVICE_BOB_DICT.keys():
                param_bank = DEVICE_BOB_DICT[device_name]
                if device_name == 'Compressor2' and self.helper.get_parameter_by_name(self.device, 'Ext. In Gain'):
                    param_bank = CP2_BANK1_LIVE7
                self.log('class %s bank: %s' % (device_name, param_bank))
                self.show_bank_select('Best of parameters')
                map_params_by_name(self.device, param_bank)
            elif self.helper.device_is_plugin(self.device):
                self.show_bank_select('First eight parameters')
                map_params_by_number(self.device)
            else:
                self.log('Could not find %s in %s' % (device_name, DEVICE_BOB_DICT.keys()))
                return
开发者ID:OwenPratt,项目名称:AbletonLive9_RemoteScripts,代码行数:93,代码来源:FaderfoxDeviceController.py

示例10: map_track_params

    def map_track_params(self, script_handle, midi_map_handle):
        for idx in range(0, 16):
            tracks = tuple(self.parent.song().tracks) + tuple(self.parent.song().return_tracks)
            if len(tracks) > idx:
                track = tracks[idx]
                mixer_device = track.mixer_device
                parameter = mixer_device.volume
                ParamMap.map_with_feedback(midi_map_handle, CHANNEL_SETUP2, VOLUME_CCS[idx], parameter, Live.MidiMap.MapMode.absolute)
                sends = mixer_device.sends
                for send_idx in range(0, 4):
                    if len(sends) > send_idx:
                        parameter = sends[send_idx]
                        ParamMap.map_with_feedback(midi_map_handle, TRACK_CHANNEL_SETUP2, SEND_CCS[idx][send_idx], parameter, Live.MidiMap.MapMode.absolute)

                parameter = mixer_device.panning
                ParamMap.map_with_feedback(midi_map_handle, TRACK_CHANNEL_SETUP2, PAN_X_CC[idx], parameter, Live.MidiMap.MapMode.absolute)

        track = self.parent.song().master_track
        parameter = track.mixer_device.panning
        ParamMap.map_with_feedback(midi_map_handle, TRACK_CHANNEL_SETUP2, PAN_X_MASTER_CC, parameter, Live.MidiMap.MapMode.absolute)
        parameter = track.mixer_device.volume
        cc = MAIN_VOLUME_CC
        if self.parent.is_lv1:
            cc = LV1_MAIN_VOLUME_CC
        ParamMap.map_with_feedback(midi_map_handle, CHANNEL_SETUP2, cc, parameter, Live.MidiMap.MapMode.absolute)
        if hasattr(track.mixer_device, 'cue_volume'):
            parameter = track.mixer_device.cue_volume
            cc = CUE_VOLUME_CC
            if self.parent.is_lv1:
                cc = LV1_CUE_VOLUME_CC
            ParamMap.map_with_feedback(midi_map_handle, CHANNEL_SETUP2, cc, parameter, Live.MidiMap.MapMode.absolute)
        if hasattr(track.mixer_device, 'crossfader'):
            parameter = track.mixer_device.crossfader
            cc = CROSSFADER_CC
            ParamMap.map_with_feedback(midi_map_handle, CHANNEL_SETUP2, cc, parameter, Live.MidiMap.MapMode.absolute)
            if self.parent.is_lv1:
                cc = LV1_CROSSFADER_CC
                ParamMap.map_with_feedback(midi_map_handle, CHANNEL_SETUP2, cc, parameter, Live.MidiMap.MapMode.absolute)
开发者ID:cce,项目名称:buttons,代码行数:38,代码来源:FaderfoxMixerController.py

示例11: build_midi_map

    def build_midi_map(self, script_handle, midi_map_handle):
	def forward_note(chan, note):
	    Live.MidiMap.forward_midi_note(script_handle, midi_map_handle, chan, note)

	def forward_cc(chan, cc):
	    Live.MidiMap.forward_midi_cc(script_handle, midi_map_handle, chan, cc)
	idx = 0

        forward_cc(CHANNEL_MIDI_COMMAND, SCENE_SCROLL_CC)
        forward_cc(CHANNEL_MIDI_COMMAND, TRACK_SCROLL_CC)

	self.map_track_params(script_handle, midi_map_handle)
	
        self.on_track_selected()
        self.helper.send_page({'patch' : 1,
                               'page' : 0,
                               'type': 0,
                               'ccs' : PAGE1_CCS,
                               'channel' : [ CHANNEL_MIDI_COMMAND for i in range(0, 4)],
                               'macros' : [ [128, SCENE_SCROLL_CC],
                                            [0,   TRACK_SCROLL_CC],
                                            [0, 0],
                                            [0, 0]],
                               'names' : ['LV1 ', 'LV2 ', 'LV3 ', 'LV4 ']})

        track = self.parent.song().view.selected_track
        names = ['', '', '', '']
        if track:
            mixer_device = track.mixer_device
            names = ["LEV"]
            parameter = mixer_device.volume
            ParamMap.map_with_feedback(midi_map_handle, CHANNEL_MIDI_COMMAND, \
                                           PAGE2_CCS[0], \
                                           parameter, Live.MidiMap.MapMode.absolute)
            
            sends = mixer_device.sends
            for x in range(0, 1):
                if (len(sends) > x):
                    names.append("SD%s" % (x + 1))
                    parameter = sends[x]
                    ParamMap.map_with_feedback(midi_map_handle, \
                                                   CHANNEL_MIDI_COMMAND, \
                                                   PAGE2_CCS[x + 1], \
                                                   parameter, \
                                                   Live.MidiMap.MapMode.absolute)
                else:
                    names.append("")

            eq = self.helper.track_find_last_eq(track)
            if eq:
                names += ['LP', 'HP']
                params = self.helper.eq_params(eq)
                ParamMap.map_with_feedback(midi_map_handle, \
                                               CHANNEL_MIDI_COMMAND, \
                                               PAGE2_CCS[2], \
                                               params[0],\
                                               Live.MidiMap.MapMode.absolute)
                ParamMap.map_with_feedback(midi_map_handle, \
                                               CHANNEL_MIDI_COMMAND, \
                                               PAGE2_CCS[3], \
                                               params[2],\
                                               Live.MidiMap.MapMode.absolute)
            else:
                names += ['', '']
                
        self.helper.send_page({'patch' : 1,
                               'page' : 1,
                               'type': 0,
                               'ccs' : PAGE2_CCS,
                               'channel' : [ CHANNEL_MIDI_COMMAND for i in range(0, 4)],
                               'macros' : [ [128, SCENE_SCROLL_CC],
                                            [0,   TRACK_SCROLL_CC],
                                            [0, 0],
                                            [0, 0]],
                               'names': names})
开发者ID:0438snappy,项目名称:mididuino,代码行数:75,代码来源:MidiCommandMixerController.py

示例12: __init__

class FaderfoxScript:
    __module__ = __name__
    __filter_funcs__ = ["update_display", "log", "song"]
    __module__ = __name__
    __doc__ = "Automap script for Faderfox controllers"
    __version__ = "V1.1"
    __name__ = "Generic Faderfox Script"

    def __init__(self, c_instance):
        self.suffix = ""
        self.is_lv1 = False
        FaderfoxScript.realinit(self, c_instance)

    def realinit(self, c_instance):
        self.c_instance = c_instance
        self.helper = FaderfoxHelper(self)
        self.param_map = ParamMap(self)
        self.mixer_controller = None
        self.device_controller = None
        self.transport_controller = None
        self.components = []
        live = "Live 6 & 7"
        if self.is_live_5():
            live = "Live 5"
        self.show_message(((((self.__name__ + " ") + self.__version__) + " for ") + live))
        self.is_lv1 = False

    def is_live_5(self):
        return hasattr(Live, "is_live_5")

    def log(self, string):
        pass

    def logfmt(self, fmt, *args):
        pass

    def disconnect(self):
        for c in self.components:
            c.disconnect()

    def application(self):
        return Live.Application.get_application()

    def song(self):
        return self.c_instance.song()

    def suggest_input_port(self):
        return str("")

    def suggest_output_port(self):
        return str("")

    def can_lock_to_devices(self):
        return True

    def lock_to_device(self, device):
        if self.device_controller:
            self.device_controller.lock_to_device(device)

    def unlock_to_device(self, device):
        if self.device_controller:
            self.device_controller.unlock_from_device(device)

    def set_appointed_device(self, device):
        if self.device_controller:
            self.device_controller.set_appointed_device(device)

    def toggle_lock(self):
        self.c_instance.toggle_lock()

    def suggest_map_mode(self, cc_no, channel):
        return Live.MidiMap.MapMode.absolute

    def restore_bank(self, bank):
        pass

    def show_message(self, message):
        if hasattr(self.c_instance, "show_message"):
            self.c_instance.show_message(message)

    def instance_identifier(self):
        return self.c_instance.instance_identifier()

    def connect_script_instances(self, instanciated_scripts):
        pass

    def request_rebuild_midi_map(self):
        self.c_instance.request_rebuild_midi_map()

    def send_midi(self, midi_event_bytes):
        self.c_instance.send_midi(midi_event_bytes)

    def refresh_state(self):
        for c in self.components:
            c.refresh_state()

    def build_midi_map(self, midi_map_handle):
        self.log("script build midi map")
        script_handle = self.c_instance.handle()
        self.param_map.remove_mappings()
#.........这里部分代码省略.........
开发者ID:hbradlow,项目名称:LeapConductor,代码行数:101,代码来源:FaderfoxScript.py


注:本文中的ParamMap.ParamMap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。