Link protocol bugfixs

This commit is contained in:
sam 2020-10-06 20:07:12 +02:00
parent cc93d13e22
commit ede9b2731d
5 changed files with 93 additions and 13 deletions

View File

@ -24,7 +24,7 @@ cmake ..
cmake --build .
'''
import midix
#import midix
import sys
prevphase = 0
@ -61,7 +61,7 @@ def BeatEvent():
#print("LINK BPM:",bpm)
sys.stdout.write("Beat "+str(beats_str) + ' \r')
sys.stdout.flush()
midix.SendUI('/beats', [beats_str])
#midix.SendUI('/beats', [beats_str])
#alink.SendOSCUI('/states/cc/'+str(ccnumber), [value])
currentbeat = float(beats_str)
@ -84,7 +84,7 @@ def newtempo(tempo):
lnk.startStopSyncEnabled = True
bpm = tempo
print(("New BPM", bpm))
midix.SendUI('/bpm', [bpm])
#midix.SendUI('/bpm', [bpm])
else:
print("Link is disabled")

View File

@ -196,7 +196,7 @@ def NoteOn(note):
gstt.Laser = note -24
print("Current Laser switched to", gstt.Laser)
plugins.sendWSall("/status Laser " + str(gstt.Laser))
plugins.SendAll(["/scim", str(gstt.Laser), "1"])
plugins.SendAll(["/scim", str(gstt.Laser), 1])
def Scim(path, tags, args, source):
@ -268,9 +268,18 @@ def handler(oscpath, args):
if oscpath[1] == "pl":
print("new pl for", "/"+oscpath[1]+"/"+oscpath[2]+"/"+oscpath[3], ":", args[0])
# was r.set(oscpath, args[0])
r.set("/"+oscpath[1]+"/"+oscpath[2]+"/"+oscpath[3], args[0])
if oscpath[0] == "pl" :
r.set(oscpath, args[0])
#/scene/scenenumber/start 0 or 1
if oscpath[1] == "scene":

View File

@ -40,6 +40,9 @@ Laser objects (name and convenient group of parameters for one or several point
"Destinations" : Tell for given Layer a scene/Laser ("destination").
Each Layer can have different destination (i.e to display same stuff on different laser)
Redis :
- fromKey(keyname) Ask redis for a given key
- toKey(keyname,keyvalue) Write to redis key
OSC and plugins functions :
@ -325,6 +328,18 @@ def toRedis(n,a):
# Store encoded data in Redis
return r.set(n,encoded)
# Ask redis for a given key
def fromKey(keyname):
return r.get(keyname)
#
# Write to redis key
def toKey(keyname,keyvalue):
# Store encoded data in Redis
return r.set(keyname,keyvalue)
#
# OSC functions

View File

@ -27,13 +27,15 @@ sys.path.append(ljpath +'/../libs3/')
#import from LJ
sys.path.append(ljpath +'/libs3/')
sys.path.append('../libs3')
import lj23layers as lj
import gstt
# link
currentBeat = 0.0
currentBPM = 0
screen_size = [700,700]
xy_center = [screen_size[0]/2,screen_size[1]/2]
@ -261,6 +263,17 @@ def sbilinear(samples, min, max):
#print ('linear',samparray)
return samparray
'''
lj.fromKey("/midi/cc/1/0")
Linkbeat = lj.fromKey("/beat")
if Linkbeat != currentbeat:
currentbeat = Linkbeat
Linkbpm = lj.fromKey("/bpm")
if Linkbpm != currentbpm:
currentbpm = Linkbpm
'''
#
# FXs
@ -268,9 +281,24 @@ def sbilinear(samples, min, max):
'''
Beatstep memory 2 Aurora simplex
'''
def ScanV(LAY):
ccmidi0= int(lj.fromKey("/midi/cc/1/0"))
dots = []
arr = randlinear2(LAY['scandots'],0, LAY['lineSize']*ccmidi0/100)
#arr = slinear(LAY['scandots'], LAY['lineSize'], 0)
#print(arr)
for y in arr:
#print(y, LAY['lineSize'] )
dots.append((0 + LAY['lineSize']/2, y - LAY['lineSize']/2, 0))
return dots
''' Original
def ScanV(LAY):
dots = []
@ -282,7 +310,7 @@ def ScanV(LAY):
dots.append((0 + LAY['lineSize']/2, y - LAY['lineSize']/2, 0))
return dots
'''
def ScanH(LAY):
@ -293,7 +321,27 @@ def ScanH(LAY):
#print(dots)
return dots
def Wave(LAY):
global currentBeat
currentBPM =lj.fromKey("/bpm")
LinkBeat = lj.fromKey("/beat")
# New Beat ?
if LinkBeat != currentBeat:
currentBeat = LinkBeat
dots = []
x = slinear(round(LAY['lineSize']), 0, LAY['lineSize'])
y = ssine(round(LAY['lineSize']), LAY['wavefreq'], 0)
for ww in range(round(LAY['lineSize'])):
dots.append((50+x[ww], 50+y[ww] * LAY['radius'], 0))
return dots
''' Original
def Wave(LAY):
dots = []
@ -304,7 +352,7 @@ def Wave(LAY):
dots.append((50+x[ww], 50+y[ww] * LAY['radius'], 0))
return dots
'''
def Circle(LAY):

View File

@ -149,7 +149,7 @@ import sys
import ast
import os
import time,traceback
import midix, anim, user
import midix
import log
ljpath = r'%s' % os.getcwd().replace('\\','/')
@ -207,6 +207,8 @@ viewer_distance = 2.2
inv = math.pi/2
ccmidi =[0]*15
print()
log.info('Startup...')
# print("Arguments parsing if needed...")
@ -272,6 +274,7 @@ else:
lj.Config(redisIP, ljscene, "aurora")
import anim, user
ccs =[[0] * 140] *4
@ -1118,12 +1121,17 @@ def AllFX():
# Generic generators : return dots list
else:
dots = eval(LAY['FX']+"(LAY)")
if LAY['FX'] != "Zero" or lent(dots) != 0:
#print(dots, LAY['color'])
lj.rPolyLineOneColor(dots, c = LAY['color'], layer = l, closed = LAY['closed'], xpos = LAY['Xcoord'] + LAY['stepvals'][LAY['step']] - (LAY['lineSize']/2), ypos = Layer[l]['Ycoord'], resize = LAY['scale'] * audioR, rotx = LAY['Xrotdirec'], roty = LAY['Yrotdirec'], rotz = LAY['Zrotdirec'])
#print(dots, LAY['color'])
for cc in range(15):
ccmidi[cc] = int(lj.fromKey("/midi/cc/1/"+str(cc)))
#print(ccmidi)
lj.rPolyLineOneColor(dots, c = LAY['color'], layer = l, closed = LAY['closed'], xpos = LAY['Xcoord'] + LAY['stepvals'][LAY['step']] - (LAY['lineSize']/2), ypos = Layer[l]['Ycoord'], resize = LAY['scale'] * audioR, rotx = LAY['Xrotdirec'], roty = LAY['Yrotdirec'], rotz = LAY['Zrotdirec'])
#lj.rPolyLineOneColor(dots, c = LAY['color'], layer = l, closed = LAY['closed'], xpos = LAY['Xcoord'] - (ccmidi[0]-64)*4 - (LAY['lineSize']/2), ypos = Layer[l]['Ycoord'] + (ccmidi[1]-64)*4, resize = LAY['scale'] * audioR * (ccmidi[2])/50, rotx = LAY['Xrotdirec']+(ccmidi[3]*3), roty = LAY['Yrotdirec']+(ccmidi[3]*3), rotz = LAY['Zrotdirec']+(ccmidi[3]*3))
else:
lj.rPolyLineOneColor((0,0,0), c = 0, layer = l, closed = LAY['closed'], xpos = LAY['Xcoord'] + LAY['stepvals'][LAY['step']] - (LAY['lineSize']/2), ypos = Layer[l]['Ycoord'], resize = LAY['scale'] * audioR, rotx = LAY['Xrotdirec'], roty = LAY['Yrotdirec'], rotz = LAY['Zrotdirec'])
lj.rPolyLineOneColor((0,0,0), c = 0, layer = l, closed = LAY['closed'], xpos = LAY['Xcoord'] + LAY['stepvals'][LAY['step']] - (LAY['lineSize']/2), ypos = Layer[l]['Ycoord'], resize = LAY['scale'] * audioR, rotx = LAY['Xrotdirec'], roty = LAY['Yrotdirec'], rotz = LAY['Zrotdirec'])
# OSC cc Audio reactive audioR -> size
# Animation