def main(): logging.basicConfig(level=logging.ERROR) log = logging.getLogger("firemix") parser = argparse.ArgumentParser(description="Firelight mixer and preset host") parser.add_argument("scene", type=str, help="Scene file to load (create scenes with FireSim)") parser.add_argument("--playlist", type=str, help="Playlist file to load", default=None) parser.add_argument("--profile", action='store_const', const=True, default=False, help="Enable profiling") parser.add_argument("--nogui", dest='gui', action='store_false', default=True, help="Disable GUI") parser.add_argument("--preset", type=str, help="Specify a preset name to run only that preset (useful for debugging)") parser.add_argument("--verbose", "-v", action='count', default=0, help="Enable verbose log output. Specify more than once for more output") parser.add_argument("--noaudio", action='store_const', const=True, default=False, help="Disable audio processing client") args = parser.parse_args() if args.verbose >= 2: log.setLevel(logging.DEBUG) elif args.verbose >= 1: log.setLevel(logging.INFO) log.info("Booting FireMix...") qt_app = QtWidgets.QApplication(sys.argv) if qdarkstyle is not None: qt_app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5()) app = FireMixApp(qt_app, args) signal.signal(signal.SIGINT, functools.partial(sig_handler, app)) app.start() if args.gui: gui = FireMixGUI(app=app) app.gui = gui gui.show() else: # When the UI isn't running, the Qt application spends all its time # running in its event loop (implemented in C). During that time, we # can't process any (Unix) signals in Python. So, in order to handle # signals, we have to occationally execute some Python code. We just do # nothing when the timeout fires. timer = QtCore.QTimer() timer.start(500) timer.timeout.connect(lambda: None) qt_app.exec_() if args.profile: print("------ TICK TIME HISTOGRAM ------") elapsed = (app.mixer._stop_time - app.mixer._start_time) print("%d frames in %0.2f seconds (%0.2f FPS) " % (app.mixer._num_frames, elapsed, old_div(app.mixer._num_frames, elapsed))) for c in sorted(app.mixer._tick_time_data.keys()): print("[%d fps]:\t%4d\t%0.2f%%" % (c, app.mixer._tick_time_data[c], (old_div(float(app.mixer._tick_time_data[c]), app.mixer._num_frames)) * 100.0))
help="Enable audio processing client") args = parser.parse_args() if args.verbose: log.setLevel(logging.DEBUG) log.info("Booting FireMix...") qt_app = QtGui.QApplication(sys.argv) app = FireMixApp(args, parent=qt_app) app.start() if not args.nogui: gui = FireMixGUI(app=app) gui.show() qt_app.exec_() if args.profile: print "------ TICK TIME HISTOGRAM ------" elapsed = (app.mixer._stop_time - app.mixer._start_time) print "%d frames in %0.2f seconds (%0.2f FPS) " % ( app.mixer._num_frames, elapsed, app.mixer._num_frames / elapsed) for c in sorted(app.mixer._tick_time_data.iterkeys()): print "[%d fps]:\t%4d\t%0.2f%%" % ( c, app.mixer._tick_time_data[c], (float(app.mixer._tick_time_data[c]) / app.mixer._num_frames) * 100.0)