Ejemplo n.º 1
0
class FireMixApp(QtCore.QThread):
    """
    Main logic of FireMix.  Operates the mixer tick loop.
    """
    def __init__(self, args, parent=None):
        self._running = False
        self.args = args
        self.settings = Settings()
        self.net = Networking(self)
        BufferUtils.set_app(self)
        self.scene = Scene(self)
        self.plugins = PluginLoader()
        self.mixer = Mixer(self)

        # Create the default layer.
        default_playlist = Playlist(self, self.args.playlist, 'last_playlist')
        default_layer = Layer(self, 'default')
        default_layer.set_playlist(default_playlist)
        self.mixer.add_layer(default_layer)

        if self.args.speech_layer:
            speech_playlist = Playlist(self, self.args.speech_playlist, 'last_speech_playlist')
            speech_layer = Layer(self, 'speech')
            speech_layer.set_playlist(speech_playlist)
            self.mixer.add_layer(speech_layer)

        if self.args.route_layer:
            route_playlist = Playlist(self, self.args.route_playlist, 'last_route_playlist')
            route_layer = Layer(self, 'routes')
            route_layer.set_playlist(route_playlist)
            self.mixer.add_layer(route_layer)

        self.scene.warmup()

        self.aubio_connector = None
        if not self.args.noaudio:
            self.aubio_connector = AubioConnector()
            self.aubio_connector.onset_detected.connect(self.mixer.onset_detected)

        self.osc_server = None
        if not self.args.noosc:
            self.osc_server = OscServer(
                self.args.osc_port, self.args.mixxx_osc_port, self.mixer)
            self.osc_server.start()

        if self.args.preset:
            log.info("Setting constant preset %s" % args.preset)
            self.mixer.set_constant_preset(args.preset)

        QtCore.QThread.__init__(self, parent)

    def run(self):
        self._running = True
        self.mixer.run()

    def stop(self):
        self._running = False
        self.mixer.stop()
        self.mixer.save()
        self.settings.save()
Ejemplo n.º 2
0
    def __init__(self, parent, args):
        QtCore.QThread.__init__(self, parent)
        self._running = False
        self.args = args
        self.settings = Settings()
        self.net = Networking(self)
        BufferUtils.set_app(self)
        self.scene = Scene(self)
        self.plugins = PluginLoader()
        self.mixer = Mixer(self)
        self.playlist = Playlist(self)
        self.qt_app = parent

        self.scene.warmup()

        self.aubio_connector = None
        if not self.args.noaudio:
            self.aubio_thread = QtCore.QThread()
            self.aubio_thread.start()
            self.aubio_connector = AubioConnector()
            self.aubio_connector.onset_detected.connect(
                self.mixer.onset_detected)
            self.aubio_connector.fft_data.connect(
                self.mixer.audio.update_fft_data)
            self.aubio_connector.pitch_data.connect(
                self.mixer.audio.update_pitch_data)
            self.aubio_connector.moveToThread(self.aubio_thread)

        self.mixer.set_playlist(self.playlist)

        if self.args.preset:
            log.info("Setting constant preset %s" % args.preset)
            self.mixer.set_constant_preset(args.preset)
Ejemplo n.º 3
0
class FireMixApp(QtCore.QThread):
    """
    Main logic of FireMix.  Operates the mixer tick loop.
    """
    def __init__(self, args, parent=None):
        self._running = False
        self.args = args
        self.settings = Settings()
        self.net = Networking(self)
        BufferUtils.set_app(self)
        self.scene = Scene(self)
        self.plugins = PluginLoader()
        self.mixer = Mixer(self)

        # Create the default layer.
        default_playlist = Playlist(self, self.args.playlist, 'last_playlist')
        default_layer = Layer(self, 'default')
        default_layer.set_playlist(default_playlist)
        self.mixer.add_layer(default_layer)

        if self.args.speech_layer:
            speech_playlist = Playlist(self, self.args.speech_playlist,
                                       'last_speech_playlist')
            speech_layer = Layer(self, 'speech')
            speech_layer.set_playlist(speech_playlist)
            self.mixer.add_layer(speech_layer)

        self.scene.warmup()

        self.aubio_connector = None
        if not self.args.noaudio:
            self.aubio_connector = AubioConnector()
            self.aubio_connector.onset_detected.connect(
                self.mixer.onset_detected)

        self.osc_server = None
        if not self.args.noosc:
            self.osc_server = OscServer(self.args.osc_port,
                                        self.args.mixxx_osc_port, self.mixer)
            self.osc_server.start()

        if self.args.preset:
            log.info("Setting constant preset %s" % args.preset)
            self.mixer.set_constant_preset(args.preset)

        QtCore.QThread.__init__(self, parent)

    def run(self):
        self._running = True
        self.mixer.run()

    def stop(self):
        self._running = False
        self.mixer.stop()
        self.mixer.save()
        self.settings.save()
Ejemplo n.º 4
0
class FireMixApp(QtCore.QThread):
    """
    Main logic of FireMix.  Operates the mixer tick loop.
    """
    playlist_changed = QtCore.Signal()

    def __init__(self, parent, args):
        QtCore.QThread.__init__(self, parent)
        self._running = False
        self.args = args
        self.settings = Settings()
        self.net = Networking(self)
        BufferUtils.set_app(self)
        self.scene = Scene(self)
        self.plugins = PluginLoader()
        self.mixer = Mixer(self)
        self.playlist = Playlist(self)
        self.qt_app = parent

        self.scene.warmup()

        self.aubio_connector = None
        if not self.args.noaudio:
            self.aubio_thread = QtCore.QThread()
            self.aubio_thread.start()
            self.aubio_connector = AubioConnector()
            self.aubio_connector.onset_detected.connect(
                self.mixer.onset_detected)
            self.aubio_connector.fft_data.connect(
                self.mixer.audio.update_fft_data)
            self.aubio_connector.pitch_data.connect(
                self.mixer.audio.update_pitch_data)
            self.aubio_connector.moveToThread(self.aubio_thread)

        self.mixer.set_playlist(self.playlist)

        if self.args.preset:
            log.info("Setting constant preset %s" % args.preset)
            self.mixer.set_constant_preset(args.preset)

    def run(self):
        self._running = True
        self.mixer.run()

    def stop(self):
        self._running = False
        self.aubio_thread.quit()
        self.mixer.stop()
        self.playlist.save()
        self.settings.save()
Ejemplo n.º 5
0
class FireMixApp(QtCore.QThread):
    """
    Main logic of FireMix.  Operates the mixer tick loop.
    """
    playlist_changed = QtCore.Signal()

    def __init__(self, parent, args):
        QtCore.QThread.__init__(self, parent)
        self._running = False
        self.args = args
        self.settings = Settings()
        self.net = Networking(self)
        BufferUtils.set_app(self)
        self.scene = Scene(self)
        self.plugins = PluginLoader()
        self.mixer = Mixer(self)
        self.playlist = Playlist(self)
        self.qt_app = parent

        self.scene.warmup()

        self.aubio_connector = None
        if not self.args.noaudio:
            self.aubio_thread = QtCore.QThread()
            self.aubio_thread.start()
            self.aubio_connector = AubioConnector()
            self.aubio_connector.onset_detected.connect(self.mixer.onset_detected)
            self.aubio_connector.fft_data.connect(self.mixer.audio.update_fft_data)
            self.aubio_connector.pitch_data.connect(self.mixer.audio.update_pitch_data)
            self.aubio_connector.moveToThread(self.aubio_thread)

        self.mixer.set_playlist(self.playlist)

        if self.args.preset:
            log.info("Setting constant preset %s" % args.preset)
            self.mixer.set_constant_preset(args.preset)

    def run(self):
        self._running = True
        self.mixer.run()

    def stop(self):
        self._running = False
        self.aubio_thread.quit()
        self.mixer.stop()
        self.playlist.save()
        self.settings["last-preset"] = self.playlist.active_preset.name()
        self.settings.save()
Ejemplo n.º 6
0
    def __init__(self, parent, args):
        QtCore.QThread.__init__(self, parent)
        self._running = False
        self.args = args
        self.settings = Settings()
        self.net = Networking(self)
        BufferUtils.set_app(self)
        self.scene = Scene(self)
        self.plugins = PluginLoader()
        self.mixer = Mixer(self)
        self.playlist = Playlist(self)
        self.qt_app = parent

        self.scene.warmup()

        self.aubio_connector = None
        if not self.args.noaudio:
            self.aubio_thread = QtCore.QThread()
            self.aubio_thread.start()
            self.aubio_connector = AubioConnector()
            self.aubio_connector.onset_detected.connect(self.mixer.onset_detected)
            self.aubio_connector.fft_data.connect(self.mixer.audio.update_fft_data)
            self.aubio_connector.pitch_data.connect(self.mixer.audio.update_pitch_data)
            self.aubio_connector.moveToThread(self.aubio_thread)

        self.mixer.set_playlist(self.playlist)

        if self.args.preset:
            log.info("Setting constant preset %s" % args.preset)
            self.mixer.set_constant_preset(args.preset)
Ejemplo n.º 7
0
    def __init__(self, parent, args):
        QtCore.QThread.__init__(self, parent)
        self._running = False
        self.args = args
        self.settings = Settings()
        self.net = Networking(self)
        BufferUtils.set_app(self)
        self.scene = Scene(self)
        self.plugins = PluginLoader()
        self.mixer = Mixer(self)
        self.playlist = Playlist(self)
        self.qt_app = parent
        self.gui = None

        self.scene.warmup()

        self.mixer.set_playlist(self.playlist)

        if self.args.preset:
            log.info("Setting constant preset %s" % args.preset)
            self.mixer.set_constant_preset(args.preset)
Ejemplo n.º 8
0
class FireMixApp(QtCore.QThread):
    """
    Main logic of FireMix.  Operates the mixer tick loop.
    """
    playlist_changed = QtCore.Signal()

    def __init__(self, args, parent=None):
        self._running = False
        self.args = args
        self.settings = Settings()
        self.net = Networking(self)
        self.scene = Scene(self)
        self.plugins = PluginLoader()
        self.mixer = Mixer(self)
        self.playlist = Playlist(self)

        self.aubio_connector = None
        if self.args.audio:
            self.aubio_connector = AubioConnector()
            self.aubio_connector.onset_detected.connect(self.mixer.onset_detected)

        self.mixer.set_playlist(self.playlist)

        if self.args.preset:
            log.info("Setting constant preset %s" % args.preset)
            self.mixer.set_constant_preset(args.preset)

        QtCore.QThread.__init__(self, parent)

    def run(self):
        self._running = True
        self.mixer.run()

    def stop(self):
        self._running = False
        self.mixer.stop()
        self.playlist.save()
        self.settings.save()
        self.scene.save()
Ejemplo n.º 9
0
class FireMixApp(QtCore.QThread):
    """
    Main logic of FireMix.  Operates the mixer tick loop.
    """
    playlist_changed = QtCore.pyqtSignal()

    def __init__(self, parent, args):
        QtCore.QThread.__init__(self, parent)
        self._running = False
        self.args = args
        self.settings = Settings()
        self.net = Networking(self)
        BufferUtils.set_app(self)
        self.scene = Scene(self)
        self.plugins = PluginLoader()
        self.mixer = Mixer(self)
        self.playlist = Playlist(self)
        self.qt_app = parent
        self.gui = None

        self.scene.warmup()

        self.mixer.set_playlist(self.playlist)

        if self.args.preset:
            log.info("Setting constant preset %s" % args.preset)
            self.mixer.set_constant_preset(args.preset)

    def run(self):
        self._running = True
        self.mixer.start()

    def stop(self):
        self._running = False
        self.mixer.stop()
        self.playlist.save()
        self.settings.save()
Ejemplo n.º 10
0
class FireMixApp(QtCore.QThread):
    """
    Main logic of FireMix.  Operates the mixer tick loop.
    """
    playlist_changed = QtCore.pyqtSignal()

    def __init__(self, parent, args):
        QtCore.QThread.__init__(self, parent)
        self._running = False
        self.args = args
        self.settings = Settings()
        self.net = Networking(self)
        BufferUtils.set_app(self)
        self.scene = Scene(self)
        self.plugins = PluginLoader()
        self.mixer = Mixer(self)
        self.playlist = Playlist(self)
        self.qt_app = parent
        self.gui = None

        self.scene.warmup()

        self.mixer.set_playlist(self.playlist)

        if self.args.preset:
            log.info("Setting constant preset %s" % args.preset)
            self.mixer.set_constant_preset(args.preset)

    def run(self):
        self._running = True
        self.mixer.start()

    def stop(self):
        self._running = False
        self.mixer.stop()
        self.playlist.save()
        self.settings.save()
Ejemplo n.º 11
0
    def __init__(self, parent, args):
        QtCore.QThread.__init__(self, parent)
        self._running = False
        self.args = args
        self.settings = Settings()
        self.net = Networking(self)
        BufferUtils.set_app(self)
        self.scene = Scene(self)
        self.plugins = PluginLoader()
        self.mixer = Mixer(self)
        self.playlist = Playlist(self)
        self.qt_app = parent
        self.gui = None

        self.scene.warmup()

        self.mixer.set_playlist(self.playlist)

        if self.args.preset:
            log.info("Setting constant preset %s" % args.preset)
            self.mixer.set_constant_preset(args.preset)
Ejemplo n.º 12
0
    def __init__(self, args, parent=None):
        self._running = False
        self.args = args
        self.settings = Settings()
        self.net = Networking(self)
        self.scene = Scene(self)
        self.plugins = PluginLoader()
        self.mixer = Mixer(self)
        self.playlist = Playlist(self)

        self.aubio_connector = None
        if self.args.audio:
            self.aubio_connector = AubioConnector()
            self.aubio_connector.onset_detected.connect(self.mixer.onset_detected)

        self.mixer.set_playlist(self.playlist)

        if self.args.preset:
            log.info("Setting constant preset %s" % args.preset)
            self.mixer.set_constant_preset(args.preset)

        QtCore.QThread.__init__(self, parent)
Ejemplo n.º 13
0
    def __init__(self, args, parent=None):
        self._running = False
        self.args = args
        self.settings = Settings()
        self.net = Networking(self)
        self.scene = Scene(SceneLoader(self))
        self.plugins = PluginLoader()
        self.mixer = Mixer(self)
        self.playlist = Playlist(self)

        self.aubio_connector = None
        if self.args.audio:
            self.aubio_connector = AubioConnector()
            self.aubio_connector.onset_detected.connect(self.mixer.onset_detected)

        self.mixer.set_playlist(self.playlist)

        if self.args.preset:
            log.info("Setting constant preset %s" % args.preset)
            self.mixer.set_constant_preset(args.preset)

        QtCore.QThread.__init__(self, parent)
Ejemplo n.º 14
0
if __name__ == "__main__":
    import sys
    import os
    sys.path.append(os.getcwd())

from sliar_model.basic_agent import BasicAgent
from lib.scene import Scene
from random import randint
from lib.wall import Wall
from sliar_model.covid import Covid
from sliar_model.reporter import NewInfectionCount, EndWhenNoInfected

scene = Scene()
scene.add_reporter(NewInfectionCount())
scene.add_reporter(EndWhenNoInfected())
personGenerator = scene.generator(BasicAgent)

(personGenerator.use_arg(personGenerator.random_position_in_scene).use_arg(
    personGenerator.random_velocity_with_magnitude_range(1, 5)))

personGenerator.generate().infect_with(Covid)

for i in range(100):
    personGenerator.generate()

scene.run()
Ejemplo n.º 15
0
from lib.model import CreatorModel
from lib.config import Config
from lib.renderer import Renderer
from lib.scene import Scene
import torch

if __name__ == '__main__':

    test_model = False
    test_renderer = True

    if test_model:
        model = CreatorModel()
        height = Config.ImageHeight
        width = Config.ImageWidth
        channels = (1 + Config.SnapshotCount) * 3
        state = torch.autograd.Variable(torch.rand(1, channels, height, width))
        print(state.data.size())
        output = model.forward(state)
        print(output.data.size())

    if test_renderer:
        renderer = Renderer()
        scene = Scene()

        renderer.render(scene)
Ejemplo n.º 16
0
if __name__ == '__main__':

	savePath = Filename( 'saveData/' )

	files = { 'main': Filename('config/settings.cfg') }
	configs = {}

	for s in ['players', 'playerIds', 'blockTypes', 'blockTypeIds']:
		files[ s ] = savePath + s + '.dat'

	for name, filename in files.items(): files[name] = FileObject( filename )
	for name, fileObj in files.items(): configs[ name ] = Config( fileObj )
	for config in configs.values(): config.process()

	scene = Scene()

	playerFactory = PlayerFactory( configs['players'], configs['playerIds'] )
	blockTypeFactory = BlockTypeFactory( configs['blockTypes']
			, configs['blockTypeIds'], scene.loader
			)

	playerFactory.process()
	blockTypeFactory.process()

	world = World( configs['main'], playerFactory, blockTypeFactory )
	world.setup()

	# assume we are at position (0, 0, 0)
	for chunk in world.getChunks( Vec3(0, 0, 0) ): chunk.load( scene.render )
Ejemplo n.º 17
0
import math

from matplotlib import patches

from lib.Interpolation import Interpolation
from lib.data.interval import Interval
from lib.data.options import Options
from lib.data.property import Property
from lib.movie import Movie
from lib.scene import Scene
from lib.shapes.animated_grid import AnimatedGrid
from lib.animation_initializers.value_animation import ValueAnimation

# Create a new movie with one scene
movie = Movie()
scene = Scene()
movie.scenes.append(scene)

# Create a grid with center (0, 0), with 30 points in each direction that are .05 apart
grid = AnimatedGrid((0, 0), 30, .05)

# Add the visible parts of the grid to the scene
scene.add_artists(grid.artists)

# Add a circle (the "unit circle") to the scene
scene.add_artists([patches.Circle((0, 0), .5, facecolor='None')])

interpolation = Interpolation.quintic

# Add an animation of the theta parameters of the points in the grid to the scene (rotate every point pi radians with
#  respect to the origin)
Ejemplo n.º 18
0
    def __init__(self, args, parent=None):
        self._running = False
        self.args = args
        self.settings = Settings()
        self.net = Networking(self)
        BufferUtils.set_app(self)
        self.scene = Scene(self)
        self.plugins = PluginLoader()
        self.mixer = Mixer(self)

        # Create the default layer.
        default_playlist = Playlist(self, self.args.playlist, 'last_playlist',
                                    subdir = 'Music')
        default_audiolist = Audiolist(self, self.args.audiobehaviors, 'last_audiolist',
                                      subdir = 'Music')
        default_layer = MusicLayer(self)
        default_layer.set_playlist(default_playlist)
        default_layer.set_audiolist(default_audiolist)
        default_layer.setForeground()
        self.mixer.add_layer(default_layer)

        if self.args.speech_layer or self.args.all:
            speech_playlist = Playlist(self, self.args.speech_playlist,
                                       'last_speech_playlist', subdir = 'Speech')
            speech_audiolist = Audiolist(self, self.args.speech_audiobehaviors,
                                         'last_speech_audiolist', subdir = 'Speech')
            speech_layer = SpeechLayer(self)
            speech_layer.set_playlist(speech_playlist)
            speech_layer.set_audiolist(speech_audiolist)
            speech_layer.setBackground()
            self.mixer.add_layer(speech_layer)

        if self.args.leap_layer or self.args.all:
            leap_playlist = Playlist(self, self.args.leap_playlist,
                                     'last_leap_playlist', subdir = 'Leap')
            leap_audiolist = Audiolist(self, self.args.leap_audiobehaviors,
                                       'last_leap_audiolist', subdir = 'Leap')
            leap_layer = LeapLayer(self)
            leap_layer.set_playlist(leap_playlist)
            leap_layer.set_audiolist(leap_audiolist)
            leap_layer.setBackground()
            self.mixer.add_layer(leap_layer)
            

        self.scene.warmup()

        self.aubio_connector = None
        if not self.args.noaudio:
            self.aubio_connector = AubioConnector()
            self.aubio_connector.onset_detected.connect(self.mixer.onset_detected)

        self.osc_server = None
        if not self.args.noosc:
            self.osc_server = OscServer(
                self.args.osc_port, self.args.mixxx_osc_port, self.mixer)
            self.osc_server.start()

        if self.args.preset:
            log.info("Setting constant preset %s" % args.preset)
            self.mixer.set_constant_preset(args.preset)

        QtCore.QThread.__init__(self, parent)