예제 #1
0
def Run():

    log.infog("Running...")
    try:
        while lj.oscrun:

            # If you want an idea
            # t0 = time.time()
            lj.OSCframe()
            if linked:
                alink.BeatEvent()

            AllFX()

            time.sleep(0.002)

            #t1 = time.time()
            # looptime = t1 - t0
            # 25 frames/sec -> 1 frame is 0.04 sec long
            # if looptime is 0.01 sec
            # 0.04/0.01 = 4 loops with the same anim
            # so speedanim is 1 / 4 = 0.25
            # speedanim = 1 / (0.04 / looptime)

            lj.DrawDests()
            #print("Took %f" % (t1 - t0, ))

    #except KeyboardInterrupt:
    #    pass
    except Exception:
        log.err("Exception")
        traceback.print_exc()

    # Gently stop on CTRL C
    finally:

        lj.WebStatus("Aurora Disconnected")
        log.info("Stopping OSC...")
        lj.OSCstop()

        log.infog("Aurora Stopped.")
예제 #2
0
def prepareStarfield():

    print("Init starfields...")
    lj.WebStatus("Init starfields...")

    for field in range(lasernumber):

        StarFields.append({
            'stars': [],
            'starfieldcount': 0,
            'starspeed': 0.05,
            'displayedstars': 5,
            'num_stars': 50,
            'max_depth': 20
        })
        for i in range(StarFields[field]['num_stars']):

            # A star is represented as a list with this format: [X,Y,Z]
            star = [
                randrange(-25, 25),
                randrange(-25, 25),
                randrange(1, StarFields[field]['max_depth'])
            ]
            StarFields[field]['stars'].append(star)
예제 #3
0
def Run():

    Left = []
    Right = []
    counter = 0
    lj.WebStatus("Square")
    lj.SendLJ("/square/start 1")

    # OSC Server callbacks
    print("Starting OSC server at", myIP, " port", OSCinPort, "...")
    oscserver.addMsgHandler("/square/ljscene", OSCljscene)

    # Add OSC generic plugins commands : 'default", /ping, /quit, /pluginame/obj, /pluginame/var, /pluginame/adddest, /pluginame/deldest
    lj.addOSCdefaults(oscserver)

    try:

        while lj.oscrun:

            lj.OSCframe()
            Left = []
            Right = []

            x = vertices[0][0]
            y = vertices[0][1]
            z = vertices[0][2]

            # LJ tracers will "move" the laser to this first point in black, then move to the next with second point color.
            # For more accuracy in dac emulator, repeat this first point.

            # Generate all points in square.
            for point in face:
                x = vertices[point][0]
                y = vertices[point][1]
                z = vertices[point][2]

                Left.append(Proj(x + LeftShift(z * 25), y, z, 0, counter, 0))
                Right.append(Proj(x + RightShift(z * 25), y, z, 0, counter, 0))

            lj.PolyLineOneColor(Left,
                                c=Leftsquare.color,
                                layer=Leftsquare.layer,
                                closed=Leftsquare.closed)
            lj.PolyLineOneColor(Right,
                                c=Rightsquare.color,
                                layer=Rightsquare.layer,
                                closed=Rightsquare.closed)

            lj.DrawDests()

            time.sleep(0.1)

            counter += 1
            if counter > 360:
                counter = 0

    except KeyboardInterrupt:
        pass

    # Gently stop on CTRL C

    finally:

        lj.ClosePlugin()
예제 #4
0
def OSCljscene(path, tags, args, source):

    print("Got /square/ljscene with value", args[0])
    lj.WebStatus("square to virtual " + str(args[0]))
    ljscene = args[0]
    lj.Ljscene(ljscene)
예제 #5
0
def OSCandots(path, tags, args, source):

    if int(args[1]) > 2:
        Layer[int(args[0])]['scandots'] = int(args[1])
    else:
        lj.WebStatus("2 dots minimum")
예제 #6
0
def OSCljscene(path, tags, args, source):

    log.info("Aurora OSC : got /aurora/ljscene with value" + str(args[0]))
    lj.WebStatus("aurora to virtual " + str(args[0]))
    ljscene = args[0]
    lj.ljscene(ljscene)
예제 #7
0
def UpdateAuroraUI():

    lj.WebStatus("Aurora Connected")
예제 #8
0
# Redis Computer IP
if args.redisIP != None:
    redisIP = args.redisIP
else:
    redisIP = '127.0.0.1'

# myIP
if args.myIP != None:
    myIP = args.myIP
else:
    myIP = '127.0.0.1'

r = lj.Config(redisIP, 255, "artnet")

lj.WebStatus("Artnet init...")


def lhex(h):
    return ':'.join(x.encode('hex') for x in h)


def senddmx0():
    for channel in range(1, 512):
        senddmx(channel, 0)


def senddmx(channel, value):

    print("Setting channel %d to %d" % (i, value))
    #mydmx.setChannel((channel + 1 ), value, autorender=True)
예제 #9
0
def OSCljscene(path, tags, args, source):

    print("maxwell OSC : got /maxwell/ljscene with value", args[0])
    lj.WebStatus("maxwell to virtual " + str(args[0]))
    ljscene = args[0]
    lj.ljscene(ljscene)
예제 #10
0
def UpdatemaxwellUI():

    lj.WebStatus("Maxwell say sthng")
예제 #11
0
            gstt.morphing = 0
        '''


#X0 = anim.COORDobject("X0",0, 0, 0, 0)
#L0 = LAYERobject("0", "saw", 100, 150, red, True, 0, 500, 200, [], 300, 255)


# Update Pose webUI
def UpdatemaxwellUI():

    lj.WebStatus("Maxwell say sthng")


print('Loading Maxwell...')
lj.WebStatus("Loading Maxwell...")

print("Starting OSC server at", gstt.myIP, "port", OSCinPort, "...")
oscserver.addMsgHandler("/maxwell/ljscene", OSCljscene)

oscserver.addMsgHandler("/maxwell/noteon", OSCnoteon)
#oscserver.addMsgHandler("/maxwell/fx", OSCfx)

oscserver.addMsgHandler("/maxwell/noteoff", OSCnoteoff)
#oscserver.addMsgHandler("/maxwell/color", OSCcolor)

oscserver.addMsgHandler("/maxwell/bpm", OSCbpm)
oscserver.addMsgHandler("/maxwell/clock", OSClock)
oscserver.addMsgHandler("/maxwell/start", OSCstart)
oscserver.addMsgHandler("/maxwell/stop", OSCstop)
oscserver.addMsgHandler("/maxwell/part", OSCpart)