Exemplo n.º 1
0
 def rem_tracks_listener(self):
     try:
         if self.song().tracks_has_listener(self.tempo_change):
             self.song().remove_tracks_listener(self.tracks_change)
     except TypeError as te:
         try:
             log('Type error: {}'.format(te))
         finally:
             te = None
             del te
Exemplo n.º 2
0
 def rem_overdub_listener(self):
     try:
         if self.song().overdub_has_listener(self.overdub_change):
             self.song().remove_overdub_listener(self.overdub_change)
     except TypeError as te:
         try:
             log('Type error: {}'.format(te))
         finally:
             te = None
             del te
Exemplo n.º 3
0
 def rem_metronome_listener(self):
     try:
         if self.song().metronome_has_listener(self.metronome_change):
             self.song().remove_metronome_listener(self.metronome_change)
     except TypeError as te:
         try:
             log('Type error: {}'.format(te))
         finally:
             te = None
             del te
Exemplo n.º 4
0
 def add_clip_listeners(self):
     self.rem_clip_listeners()
     tracks = self.getslots()
     for track in range(len(tracks)):
         for clip in range(len(tracks[track])):
             c = tracks[track][clip]
             if c.clip is not None:
                 self.add_cliplistener(c.clip, track, clip)
                 log('ClipLauncher: added clip listener tr: ' + str(track) +
                     ' clip: ' + str(clip))
             self.add_slotlistener(c, track, clip)
Exemplo n.º 5
0
 def rem_session_automation_record_listener(self):
     try:
         if self.song().session_automation_record_has_listener(
                 self.session_automation_record_change):
             self.song().remove_session_automation_record_listener(
                 self.session_automation_record_change)
     except TypeError as te:
         try:
             log('Type error: {}'.format(te))
         finally:
             te = None
             del te
Exemplo n.º 6
0
    def update_display(self):
        """
        This function is run every 100ms, so we use it to initiate our Song.current_song_time
        listener to allow us to process incoming OSC commands as quickly as possible under
        the current listener scheme.
        """
        if self.basicAPI == 0:
            try:
                doc = self.song()
            except:
                log('could not get song handle')
                return

            try:
                self.basicAPI = NIControllerCallbacks.NIControllerCallbacks(
                    self._NIController__c_instance, self.oscEndpoint)
                self.time = 0
                doc.add_current_song_time_listener(
                    self.current_song_time_changed)
            except ConnectionError:
                self.oscEndpoint.send('/remix/echo',
                                      'setting up basicAPI failed')
                log('setting up basicAPI failed')
                return

        if self.oscEndpoint:
            try:
                self.oscEndpoint.process_incoming_udp()
            except ConnectionError:
                log('error processing incoming UDP packets:', sys.exc_info())
Exemplo n.º 7
0
 def slot_changestate(self, slot, x, y):
     tmptrack = Helpers.genericTrack(x)
     if tmptrack is None:
         return
     if slot.clip is not None:
         log('slot_changestate[' + str(x) + ', ' + str(y) + ']: added clip')
         self.add_cliplistener(slot.clip, x, y)
         self.oscEndpoint.send_message(Messages.clipInfo(x, y))
         self.oscEndpoint.send_message(Messages.clipStatus(x, y))
     else:
         log('slot_changestate[' + str(x) + ', ' + str(y) +
             ']: removed clip')
         if slot.clip in self.clisten:
             slot.clip.remove_playing_status_listener(
                 self.clisten[slot.clip])
         if slot.clip in self.pplisten:
             slot.clip.remove_playing_position_listener(
                 self.pplisten[slot.clip])
         if slot.clip in self.cnlisten:
             slot.clip.remove_name_listener(self.cnlisten[slot.clip])
         if slot.clip in self.cclisten:
             slot.clip.remove_color_listener(self.cclisten[slot.clip])
         self.oscEndpoint.send_message(Messages.clipRemoved(x, y))
Exemplo n.º 8
0
    def rem_device_listeners(self):
        for pr in self.prlisten:
            if pr is not None:
                try:
                    ocb = self.prlisten[pr]
                    if pr.value_has_listener(ocb):
                        pr.remove_value_listener(ocb)
                except TypeError as te:
                    try:
                        log('Type error: {}'.format(te))
                    finally:
                        te = None
                        del te

        self.prlisten = {}
        for tr in self.dlisten:
            if tr is not None:
                ocb = self.dlisten.get(tr)
                if ocb:
                    try:
                        if tr.view.selected_device_has_listener(ocb):
                            tr.view.remove_selected_device_listener(ocb)
                    except TypeError as te:
                        try:
                            log('Type error: {}'.format(te))
                        finally:
                            te = None
                            del te

        self.dlisten = {}
        for de in self.plisten:
            if de is not None:
                ocb = self.plisten[de]
                if de.parameters_has_listener(ocb):
                    de.remove_parameters_listener(ocb)

        self.plisten = {}
Exemplo n.º 9
0
 def clip_changestate(self, clip, x, y):
     log('clip_changestate[' + str(x) + ', ' + str(y) + ']')
     self.oscEndpoint.send_message(Messages.clipStatus(x, y))
Exemplo n.º 10
0
 def clip_name(self, clip, x, y):
     log('clip_name[' + str(x) + ', ' + str(y) + ']')
     self.oscEndpoint.send_message(Messages.clipInfo(x, y))
Exemplo n.º 11
0
 def clip_looping(self, clip, x, y):
     log('clip_looping[' + str(x) + ', ' + str(y) + ']')
     self.oscEndpoint.send_message(Messages.clipStatus(x, y))
Exemplo n.º 12
0
    def rem_mixer_listeners(self):
        for type in ('volume', 'panning', 'crossfader'):
            for tr in self.masterlisten[type]:
                if tr is not None:
                    cb = self.masterlisten[type][tr]
                    test = eval('tr.mixer_device.' + type +
                                '.value_has_listener(cb)')
                    if test == 1:
                        eval('tr.mixer_device.' + type +
                             '.remove_value_listener(cb)')

        for type in ('arm', 'solo', 'mute'):
            for tr in self.mlisten[type]:
                if tr is not None:
                    cb = self.mlisten[type].get(tr)
                if cb:
                    if type == 'arm':
                        if tr is not None:
                            try:
                                tmp = tr.can_be_armed
                                if tmp:
                                    if tr.arm_has_listener(cb):
                                        tr.remove_arm_listener(cb)
                            except TypeError as te:
                                try:
                                    log('Type error: {}'.format(te))
                                finally:
                                    te = None
                                    del te

                    try:
                        test = eval('tr.' + type + '_has_listener(cb)')
                        if test:
                            eval('tr.remove_' + type + '_listener(cb)')
                    except TypeError as te:
                        try:
                            log('Type error: {}'.format(te))
                        finally:
                            te = None
                            del te

        for type in ('volume', 'panning'):
            for tr in self.mlisten[type]:
                if tr is not None:
                    cb = self.mlisten[type].get(tr)
                    if cb:
                        try:
                            test = eval('tr.mixer_device.' + type +
                                        '.value_has_listener(cb)')
                            if test == 1:
                                eval('tr.mixer_device.' + type +
                                     '.remove_value_listener(cb)')
                        except TypeError as te:
                            try:
                                log('Type error: {}'.format(te))
                            finally:
                                te = None
                                del te

        for tr in self.mlisten['sends']:
            if tr is not None:
                sends = self.mlisten['sends'].get(tr)
                if sends:
                    for send in sends:
                        if send is not None:
                            try:
                                cb = sends.get(send)
                                if send.value_has_listener(cb):
                                    send.remove_value_listener(cb)
                            except TypeError as te:
                                try:
                                    log('Type error: {}'.format(te))
                                finally:
                                    te = None
                                    del te

        for tr in self.mlisten['name']:
            if tr is not None:
                cb = self.mlisten['name'].get(tr)
                if cb and cb is not None:
                    try:
                        if tr.name_has_listener(cb):
                            tr.remove_name_listener(cb)
                    except TypeError as te:
                        try:
                            log('Type error: {}'.format(te))
                        finally:
                            te = None
                            del te

        for tr in self.mlisten['oml']:
            if tr is not None:
                cb = self.mlisten['oml'].get(tr)
                if cb and cb is not None:
                    try:
                        if tr.output_meter_left_has_listener(cb):
                            tr.remove_output_meter_left_listener(cb)
                    except TypeError as te:
                        try:
                            log('Type error: {}'.format(te))
                        finally:
                            te = None
                            del te

        for tr in self.mlisten['omr']:
            if tr is not None:
                cb = self.mlisten['omr'].get(tr)
                if cb:
                    try:
                        tmp = tr.output_meter_right_has_listener(cb)
                        if tmp:
                            tr.remove_output_meter_right_listener(cb)
                    except TypeError as te:
                        try:
                            log('Type error: {}'.format(te))
                        finally:
                            te = None
                            del te

        for type in ('solo', 'mute'):
            for tr in self.rlisten[type]:
                if tr is not None:
                    cb = self.rlisten[type].get(tr)
                    if cb:
                        try:
                            test = eval('tr.' + type + '_has_listener(cb)')
                            if test == 1:
                                eval('tr.remove_' + type + '_listener(cb)')
                        except TypeError as te:
                            try:
                                log('Type error: {}'.format(te))
                            finally:
                                te = None
                                del te

        for type in ('volume', 'panning'):
            for tr in self.rlisten[type]:
                if tr is not None:
                    cb = self.rlisten[type].get(tr)
                    if cb:
                        try:
                            test = eval('tr.mixer_device.' + type +
                                        '.value_has_listener(cb)')
                            if test == 1:
                                eval('tr.mixer_device.' + type +
                                     '.remove_value_listener(cb)')
                        except TypeError as te:
                            try:
                                log('Type error: {}'.format(te))
                            finally:
                                te = None
                                del te

        for tr in self.rlisten['sends']:
            if tr is not None:
                sends = self.rlisten['sends'].get(tr)
                if sends:
                    for send in sends:
                        if send is not None:
                            try:
                                cb = sends.get(send)
                                if send.value_has_listener(cb):
                                    send.remove_value_listener(cb)
                            except TypeError as te:
                                try:
                                    log('Type error: {}'.format(te))
                                finally:
                                    te = None
                                    del te

        for tr in self.rlisten['name']:
            if tr is not None:
                cb = self.rlisten['name'].get(tr)
                if cb:
                    try:
                        if tr.name_has_listener(cb):
                            tr.remove_name_listener(cb)
                    except TypeError as te:
                        try:
                            log('Type error: {}'.format(te))
                        finally:
                            te = None
                            del te

        self.mlisten = {
            'solo': {},
            'mute': {},
            'arm': {},
            'panning': {},
            'volume': {},
            'sends': {},
            'name': {},
            'oml': {},
            'omr': {}
        }
        self.rlisten = {
            'solo': {},
            'mute': {},
            'panning': {},
            'volume': {},
            'sends': {},
            'name': {}
        }
        self.masterlisten = {'panning': {}, 'volume': {}, 'crossfader': {}}
Exemplo n.º 13
0
    def rem_clip_listeners(self):
        for slot in self.slisten:
            if slot is not None:
                cb = self.slisten.get(slot)
                try:
                    tmp = slot.has_clip_has_listener(cb)
                    if tmp:
                        slot.remove_has_clip_listener(cb)
                except TypeError as te:
                    try:
                        log('Type error: {}'.format(te))
                    finally:
                        te = None
                        del te

        self.slisten = {}
        for clip in self.clisten:
            if clip is not None:
                try:
                    if clip.playing_status_has_listener(
                            self.clisten.get(clip)):
                        clip.remove_playing_status_listener(
                            self.clisten.get(clip))
                except TypeError:
                    log()

        self.clisten = {}
        for clip in self.pplisten:
            if clip is not None:
                try:
                    if clip.playing_position_has_listener(
                            self.pplisten.get(clip)):
                        clip.remove_playing_position_listener(
                            self.pplisten.get(clip))
                except TypeError as te:
                    try:
                        log('Type error: {}'.format(te))
                    finally:
                        te = None
                        del te

        self.pplisten = {}
        for clip in self.cnlisten:
            if clip is not None:
                try:
                    if clip.name_has_listener(self.cnlisten.get(clip)):
                        clip.remove_name_listener(self.cnlisten.get(clip))
                except TypeError as te:
                    try:
                        log('Type error: {}'.format(te))
                    finally:
                        te = None
                        del te

        self.cnlisten = {}
        for clip in self.cclisten:
            if clip is not None:
                try:
                    if clip.color_has_listener(self.cclisten.get(clip)):
                        clip.remove_color_listener(self.cclisten.get(clip))
                except TypeError as te:
                    try:
                        log('Type error: {}'.format(te))
                    finally:
                        te = None
                        del te

        self.cclisten = {}
        for clip in self.wlisten:
            if clip is not None and clip.is_audio_clip:
                try:
                    if clip.warping_has_listener(self.wlisten.get(clip)):
                        clip.remove_warping_listener(self.wlisten.get(clip))
                except TypeError as te:
                    try:
                        log('Type error: {}'.format(te))
                    finally:
                        te = None
                        del te

        self.wlisten = {}
        for clip in self.llisten:
            if clip is not None:
                try:
                    if clip.looping_has_listener(self.llisten.get(clip)):
                        clip.remove_looping_listener(self.llisten.get(clip))
                except TypeError as te:
                    try:
                        log('Type error: {}'.format(te))
                    finally:
                        te = None
                        del te

        self.llisten = {}