예제 #1
0
파일: GenericScript.py 프로젝트: jhlax/les
    def _init_transport_component(self, transport_controls, global_channel):
        def make_transport_button(control, name, is_momentary=True):
            return ButtonElement(is_momentary,
                                 MIDI_CC_TYPE,
                                 global_channel,
                                 transport_controls[control],
                                 name=name)

        if transport_controls:
            momentary_seek = 'NORELEASE' not in transport_controls.keys()
            layer_specs = {}
            if has_specification_for('STOP', transport_controls):
                layer_specs['stop_button'] = make_transport_button(
                    'STOP', 'Stop_Button')
            if has_specification_for('PLAY', transport_controls):
                layer_specs['play_button'] = make_transport_button(
                    'PLAY', 'Play_Button')
            if has_specification_for('REC', transport_controls):
                layer_specs['record_button'] = make_transport_button(
                    'REC', 'Record_Button')
            if has_specification_for('LOOP', transport_controls):
                layer_specs['loop_button'] = make_transport_button(
                    'LOOP', 'Loop_Button')
            if has_specification_for('FFWD', transport_controls):
                layer_specs['seek_forward_button'] = make_transport_button(
                    'FFWD', 'FFwd_Button', is_momentary=momentary_seek)
            if has_specification_for('RWD', transport_controls):
                layer_specs['seek_backward_button'] = make_transport_button(
                    'RWD', 'Rwd_Button', is_momentary=momentary_seek)
            transport = TransportComponent(name='Transport')
            transport.layer = Layer(**layer_specs)
 def _create_transport(self):
     transport = TransportComponent(play_toggle_model_transform=lambda v: v)
     transport.layer = Layer(record_button=self._modified_start_stop_button, play_button=self._start_stop_button)
     return transport