Exemplo n.º 1
0
def OSCrawcc(path, tags, args, source):

    if path.find(" ") != -1:
        newargs = path.split(" ")
        args = []
        #print(newargs, len(newargs))
        for arg in range(len(newargs) - 1):
            args.append(newargs[arg + 1])
        print(path, args)

    layer = int(args[0])
    number = int(args[1])
    value = int(args[2])

    #print("OSC rawcc")
    midix.SendUI(
        '/beatstep/' + "m" + str(layer + 1) + str(number + 1) + '/value',
        [format(value, "03d")])
    #print('/beatstep/'+ "m" +str(layer+1)+ str(number+1) + '/value', [format(value, "03d")])
    #ccs[layer][number] = value

    print(encoders[number], ": value", value, "steps", Layer[layer]['steps'],
          "stepmax", Layer[layer]['stepmax'], "lineSize",
          Layer[layer]['lineSize'])
    #print("Aurora OSC Got rawCC for layer", layer, "encoder", encoders[number], "value", value)
    #print(value, Layer[layer]['stepmax'])
    if value * 2 < Layer[layer]['stepmax']:

        Layer[layer][encoders[number]] = value * 5
        Layer[layer]['stepvals'] = anim.sbilinear(Layer[layer]['steps'], 0,
                                                  Layer[layer]['stepmax'])
Exemplo n.º 2
0
def animSpeeds():

    print("Compute animations speed for", lasernumber, "lasers...")

    for l in range(lasernumber):
        Layer[l]['stepvals'] = anim.sbilinear(Layer[l]['steps'], 0,
                                              Layer[l]['stepmax'])
Exemplo n.º 3
0
def animSpeeds():

    print("Compute animations speed...")

    for l in range(3):
        Layer[l]['stepvals'] = anim.sbilinear(Layer[l]['steps'], 0,
                                              Layer[l]['stepmax'])
Exemplo n.º 4
0
def OSCcc(path, tags, args, source):

    print("Aurora OSC Got CC")
    channel = int(args[0])
    ccnumber = int(args[1])
    ccvalue = int(args[2])

    Layer[channel]['step'] = 0
    Layer[channel]['steps'] = ccnumber * 5
    Layer[channel]['stepmax'] = ccvalue * 5
    Layer[channel]['stepvals'] = anim.sbilinear(Layer[channel]['steps'], 0,
                                                Layer[channel]['stepmax'])
Exemplo n.º 5
0
def OSCstepmax(path, tags, args, source):

    layer = int(args[0])
    value = float(args[1])
    print("aurora OSC got stepmax", value, (value * 5), "layer", layer)

    if value * 2 < Layer[layer]['stepmax']:

        Layer[layer]['step'] = 0
        Layer[layer]['stepmax'] = value * 5
        Layer[layer]['stepvals'] = anim.sbilinear(Layer[layer]['steps'], 0,
                                                  Layer[layer]['stepmax'])
Exemplo n.º 6
0
def OSCrawcc(path, tags, args, source):
    #global step, steps, stepmax, stepvals

    layer = int(args[0])
    number = int(args[1])
    value = int(args[2])

    midix.SendUI('/beatstep/' + "m" + str(layer) + str(number + 1) + '/value',
                 [format(value, "03d")])
    ccs[layer][number] = value

    print(encoders[number], ": value", value, "steps", Layer[layer]['steps'],
          "stepmax", Layer[layer]['stepmax'], "lineSize",
          Layer[layer]['lineSize'])
    #print("maxwell OSC Got rawCC for layer", layer, "encoder", encoders[number], "value", value)
    #print(value, Layer[layer]['stepmax'])
    if value * 2 < Layer[layer]['stepmax']:

        Layer[layer][encoders[number]] = value * 5
        Layer[layer]['stepvals'] = anim.sbilinear(Layer[layer]['steps'], 0,
                                                  Layer[layer]['stepmax'])
Exemplo n.º 7
0
def OSChandler(path, tags, args, source):
    global TrckrPts

    oscaddress = ''.join(path.split("/"))
    #print()
    print("Aurora default OSC Handler : " + str(path) + " from Client : " +
          str(source[0]))

    if len(args) > 0:
        pass

    #Convert from TouchOSC full text OSC style (no args)
    if path.find(" ") != -1:

        prevargs = []
        if len(args) > 0:
            prevargs = args
            print(prevargs)
        newargs = path.split(" ")
        args = []
        #print(newargs, len(newargs))
        for arg in range(len(newargs) - 1):
            args.append(newargs[arg + 1])

        args.append(prevargs[0])

        print("correction", path, args)
        #log.info("with args " + str(args))

    # /aurora/fx/layernumber FXname
    if path.find('/aurora/fx') == 0:

        #print("path", path, 'args', args)
        #print("layer", path[11:12])
        layer = int(path[11:12])

        if layer <= lasernumber - 1:
            fx = args[0]
            if fx in FXs:

                Layer[layer]['FX'] = "anim." + fx
                print("Aurora default OSC got FX generator for layer", layer,
                      ":", Layer[layer]['FX'])
                lj.SendLJ("/line1", [fx])
                midix.SendUI('/status', [fx])
            else:
                print("unknwon FX.")
        else:
            print("NOT POSSIBLE : only", lasernumber,
                  "laser requested at startup")
            lj.SendLJ("/line1", str(lasernumber) + " Laser")

    # /aurora/color/layernumber colorname
    if path.find('/aurora/color') == 0:

        #if args[1] =='1':
        layer = int(path[14:15])
        if layer <= lasernumber - 1:
            color = args[0]
            Layer[layer]['color'] = eval(color)
            print("Aurora default OSc for Layer", layer, Layer[layer]['FX'],
                  "Got color change to", color)
        else:
            print("NOT POSSIBLE : only", lasernumber,
                  "laser requested at startup")
            lj.SendLJ("/line1", str(lasernumber) + " Laser")

    #                      [0,1] or [0,127]
    # /aurora/x/layernumber coord
    if path.find('/aurora/x') == 0:

        layer = int(path[10:11])
        value = float(args[0])
        if value > 1:
            value = value / 127
        #print("xdefault layer", layer, "value", value)
        Layer[layer]['Xcoord'] = value * screen_size[0]
        print("Aurora default OSC got X coord for layer", layer, ":",
              Layer[layer]['Xcoord'])
        midix.SendUI('/status', ["X : " + str(value * screen_size[0])])
    #                      [0,1] or [0,127]
    # /aurora/y/layernumber coord
    if path.find('/aurora/y') == 0:

        layer = int(path[10:11])
        value = float(args[0])
        if value > 1:
            value = value / 127
        #print("ydefault layer", layer, "value", value)
        Layer[layer]['Ycoord'] = value * screen_size[1]
        print("Aurora default OSC got Y coord for layer", layer, ":",
              Layer[layer]['Ycoord'])
        midix.SendUI('/status', ["Y : " + str(value * screen_size[0])])

    # /aurora/trckr/frame layernumber framenumber points
    if path.find('aurora/trckr/frame') == 0:

        if debug != 0:
            print("Aurora default OSC got trckr frame", args[1], "for layer",
                  args[0], "with path", path)
            print(len(args), "args", args)

        counter = 0
        '''
       TrckrPts = []
       for dot in range(2,len(args)-1,2):

         TrckrPts.append([float(args[dot]), float(args[dot+1])])
       '''

        TrckrPts[args[0]] = []
        for dot in range(2, len(args) - 1, 2):

            TrckrPts[args[0]].append([float(args[dot]), float(args[dot + 1])])

    # /aurora/word/layer word
    if path.find('/aurora/word') == 0:

        layer = int(path[13:14])
        value = args[0]
        Layer[layer]['word'] = value
        print("Aurora default OSC got word", args[0], "for layer", layer)
        midix.SendUI('/status', ["Word : " + str(value * screen_size[0])])

    # /aurora/word/layer word
    if path.find('/aurora/rawcc') == 0:

        layer = int(args[0])
        number = int(args[1])
        value = int(args[2])
        midix.SendUI(
            '/beatstep/' + "m" + str(layer + 1) + str(number + 1) + '/value',
            [format(value, "03d")])
        #ccs[layer][number] = value

        print(encoders[number], ": value", value, "steps",
              Layer[layer]['steps'], "stepmax", Layer[layer]['stepmax'],
              "lineSize", Layer[layer]['lineSize'])
        print("Aurora Default OSC Got rawCC for layer", layer, "encoder",
              encoders[number], "value", value)
        #print(value, Layer[layer]['stepmax'])
        if value * 2 < Layer[layer]['stepmax']:

            Layer[layer][encoders[number]] = value * 5
            Layer[layer]['stepvals'] = anim.sbilinear(Layer[layer]['steps'], 0,
                                                      Layer[layer]['stepmax'])

    # /aurora/scim
    if path.find('/aurora/scim') == 0:

        print("OScim sending to LJ2 /scim", int(args[0]) + 24)
        lj.SendLJ("/scim", [int(args[0]) + 24])