예제 #1
0
파일: menu.py 프로젝트: Naelitz/soundclip
 def on_panic(self, button):
     """
     Callback for the Panic Button. Stops all running cues and automation tasks
     """
     p = self.__main_window.project
     ft = p.panic_fade_time
     delta = now()-self.__last_panic_time
     logger.warning("PANIC! Stopping all cues and automation over {0} ms. It has been {1}ms since the last panic".format(ft, delta))
     self.__main_window.send_stop_all(fade=ft if delta > 1000 else 0)
     self.__last_panic_time = delta
     self.__main_window.refocus_cuelist()
예제 #2
0
파일: audio.py 프로젝트: Naelitz/soundclip
    def tick(self):
        if self.playing or self.paused:
            if self.__fading:
                # Adjust volume according to fade curve
                if self.__fade_start_time == -1:
                    self.__fade_start_time = now()

                current_time = now()

                v, cont = self.__fade_func(self.__fade_start_vol, self.__fade_target_volume,
                                           int(self.__fade_start_time), int(self.__fade_duration),
                                           current_time, self.__fade_func_args) \
                    if callable(self.__fade_func) else self.__fade_target_volume

                logger.debug("Fade Curve returned target volume {0}. Continuing: {1}".format(v, cont))

                # Clamp result
                if self.__fade_start_vol < self.__fade_target_volume <= v:
                    logger.debug("CLAMPING: Higher than target volume")
                    v = self.__fade_target_volume
                    self.__fading = False
                elif self.__fade_start_vol > self.__fade_target_volume >= v:
                    logger.debug("CLAMPING: Lower than target volume")
                    v = self.__fade_target_volume
                    self.__fading = False
                elif not cont:
                    logger.debug("CLAMPING: Fade Function asked to stop")
                    v = self.__fade_target_volume
                    self.__fading = False

                # Apply Volume Change
                self.__vol.set_property('volume', v)

                # If we're done fading, run callback
                if not self.__fading and callable(self.__fade_complete_func):
                    self.__fade_complete_func()
            self.emit('tick')
        self.__last_update_time = now()
        return self.__active