コード例 #1
0
 def _replace(self, old_piece_ids, replacement_piece):
     logger.info("_replacing\n%s\nwith %s" % (
             "\n".join([str(self._pieces[piece_id]) for piece_id in old_piece_ids]),
             replacement_piece))
     for old_piece_id in old_piece_ids:
         del self._pieces[old_piece_id]
     self._add_piece(replacement_piece)
コード例 #2
0
ファイル: orchestra.py プロジェクト: alex-berman/tforms
 def _load_sounds(self):
     if self.synth:
         print "loading sounds"
         for filenum in range(len(self._files_to_play)):
             file_info = self._files_to_play[filenum]
             if file_info["playable_file_index"] != -1:
                 logger.info("load_sound(%s)" % file_info["decoded_name"])
                 result = self._load_sound_stubbornly(filenum, file_info["decoded_name"])
                 logger.info("load_sound result: %s" % result)
         print "OK"
コード例 #3
0
ファイル: orchestra.py プロジェクト: alex-berman/tforms
 def _play_until_end(self):
     logger.info("entering _play_until_end")
     self._playing = True
     self.stopwatch.start()
     time.sleep(self._leading_pause)
     no_more_events = False
     while self._playing and not no_more_events:
         event = self._get_next_chunk_or_segment()
         if event:
             self._handle_event(event)
         else:
             no_more_events = True
     logger.info("leaving _play_until_end")
コード例 #4
0
 def add(self, new_piece):
     logger.info("add(%s)" % new_piece)
     overlapping_pieces = self._overlapping_pieces(new_piece)
     if len(overlapping_pieces) > 0:
         if len(overlapping_pieces) > 1:
             self._add_generation(new_piece, overlapping_pieces)
         else:
             parent = self._pieces[overlapping_pieces[0]]
             if self.growth_time_limit is None or (new_piece.t - parent.t) < self.growth_time_limit:
                 self._grow(new_piece, overlapping_pieces)
             else:
                 self._add_generation(new_piece, overlapping_pieces)
     else:
         logger.info("new piece %s" % new_piece)
         self._add_piece(new_piece)
コード例 #5
0
ファイル: orchestra.py プロジェクト: alex-berman/tforms
 def play_non_realtime(self, quit_on_end=False):
     logger.info("entering play_non_realtime")
     self._was_stopped = False
     self._num_finished_visualizers = 0
     if self._loop:
         while True:
             self._play_until_end()
             if not self._was_stopped:
                 self._wait_for_visualizers_to_finish()
             self.set_time_cursor(0)
     else:
         self._play_until_end()
         if not self._was_stopped:
             self._wait_for_visualizers_to_finish()
         if quit_on_end:
             self._quit()
     logger.info("leaving play_non_realtime")
コード例 #6
0
ファイル: sequencer.py プロジェクト: alex-berman/tforms
def log_open_files():
    global logger
    import subprocess
    n = 0
    p = subprocess.Popen("ls -l /proc/self/fd/", shell=True, stdout=subprocess.PIPE)
    logger.info("output from ls -l /proc/self/fd/:")
    for line in p.stdout:
        line = line.strip()
        logger.info(line)
        n += 1
    logger.info("num open files: %s" % n)
コード例 #7
0
ファイル: orchestra.py プロジェクト: alex-berman/tforms
def warn(logger, message):
    logger.info(message)
    print >> sys.stderr, "WARNING: %s" % message