missing www

This commit is contained in:
Sam 2023-06-03 14:43:53 +02:00
parent 5f7c61f616
commit cfc7c70d16
131 changed files with 11126 additions and 661 deletions

View file

@ -39,7 +39,7 @@ import sys
import os
ljpath = r'%s' % os.getcwd().replace('\\','/')
from . import midi3, launchpad
from . import midi3, gstt, launchpad
#import midimacros, maxwellmacros
import traceback
@ -230,25 +230,34 @@ class LPD8AddQueue(object):
# Modes :
#
# Load Matrix only macros (for the moment) in macros.json
# Load Matrix only macros (for the moment) in LPD8.json
def LoadMacros():
global macros
global macros, nbmacro
print()
print("Loading LPD8 Macros...")
#print()
#print("Loading LPD8 Macros...")
if os.path.exists('libs/matrix.json'):
#print('File libs/matrix.json exits')
f=open("libs/matrix.json","r")
if os.path.exists('LPD8.json'):
#print('File is LPD8.json')
f=open("LPD8.json","r")
elif os.path.exists('../LPD8.json'):
#print('File is ../lpd8.json')
f=open("../LPD8.json","r")
elif os.path.exists('libs3/LPD8.json'):
#print('File is libs/lpd8.json')
f=open("libs3/LPD8.json","r")
elif os.path.exists(ljpath+'/../../libs3/LPD8.json'):
#print('File is '+ljpath+'/../../libs/lpd8.json')
f=open(ljpath+"/../../libs3/LPD8.json","r")
elif os.path.exists(ljpath+'/../../libs/matrix.json'):
#print('File '+ljpath+'/../../libs/matrix.json exits')
f=open(ljpath+"/../../libs/matrix.json","r")
s = f.read()
macros = json.loads(s)
print((len(macros['OS']),"Macros"))
print("Loaded.")
#print(len(macros['OS']),"Macros")
nbmacro = len(macros[gstt.lpd8Layers[gstt.lpd8Layer]])
#print("Loaded.")
# return macroname number for given type 'OS', 'Maxwell'

View file

@ -4,7 +4,10 @@
'''
Ableton Link
alink v0.1
Ableton Link bridge to OSC & Redis
v0.2 available in miredis
LICENCE : CC
Sam Neurohack

View file

@ -51,7 +51,7 @@ ljpath = r'%s' % os.getcwd().replace('\\','/')
#import from LJ
sys.path.append(ljpath +'/libs/')
import lj23layers as lj
import lj
#
# Init
@ -285,8 +285,10 @@ try:
if data[0:7] != "Art-Net" or data[7] != "\0":
print("artnet package")
print('data',data)
#lj.WebStatus("Artnet package")
continue
OSCframe()
if ord(data[8]) != 0x00 or ord(data[9]) != 0x50:

View file

@ -30,7 +30,7 @@ CC NC BY
'''
import colorsys,time
import midi3,bhoreal,launchpad
from . import midi3,bhoreal,launchpad
# For Launchpad mini
mididest = "launchpad"

View file

@ -31,7 +31,7 @@ def handle():
argsparser.add_argument("-a","--align",help="Reset laser 0 alignement values",action="store_true")
argsparser.add_argument("-i","--iport",help="port number for builtin LJ OSC server (8002 by default)",type=int)
argsparser.add_argument("-n","--nozoidIP",help="IP for llstr' Nozoid OSC server port 8003 ('127.0.0.1' by default)",type=str)
argsparser.add_argument("-b","--bhoroscIP",help="IP for OSC output ('127.0.0.1' by default)",type=str)
argsparser.add_argument("-b","--oscserverip",help="IP for OSC output ('127.0.0.1' by default)",type=str)
argsparser.add_argument("-o","--oport",help="OSC output port number (8001 by default)",type=int)
argsparser.add_argument("-w","--webui",help="Regen the webui",action="store_true")
@ -99,7 +99,7 @@ def handle():
# Redis Computer IP
if args.redisIP != None:
gstt.LjayServerIP = args.redisIP
gstt.RediServerIP = args.redisIP
@ -116,8 +116,8 @@ def handle():
Settings.Write()
if args.bhoroscIP != None:
gstt.oscIPin = args.bhoroscIP
if args.oscserverip != None:
gstt.oscIPin = args.oscserverip
else:
gstt.oscIPin = '127.0.0.1'

View file

@ -25,6 +25,7 @@ UpdateAllwww()
/grid/lasernumber value (0 or 1) : switch given laser with grid display on or off
/black/lasernumber value (0 or 1) : set given laser to black on or off
/emergency value (0 or 1) : set all lasers to black on or off
/ip/lasernumber value : change given laser IP i.e '192.168.1.1'
@ -94,14 +95,15 @@ Bob could use /pl/2/0 and /pl/2/1 and Lisa could use /pl/2/2 and /pl/2/3.
import types, time, socket, math
from libs3 import gstt
import redis
from libs3 import OSC3
from libs3 import settings, plugins, homographyp,log
r = redis.StrictRedis(host=gstt.LjayServerIP , port=6379, db=0)
#r = redis.StrictRedis(host=gstt.LjayServerIP , port=6379, db=0, password='-+F816Y+-')
r = redis.StrictRedis(host=gstt.RediServerIP , port=6379, db=0)
#r = redis.StrictRedis(host=gstt.RediServerIP , port=6379, db=0, password='-+F816Y+-')
GenericCommands = ["start","align","ljclient","scene","addest","deldest","dest","clientnumber","vcvrack","fft","mitraille","faceosc","midigen","viewgen","audiogen","noteon","cc","ljpong","ljwars","mouse","emergency","simu","status","run","nozoid","planet","live","words","ai","bank0","pose","lj","cycl","glyph","pong","maxw","custom1","square","regen","trckr","aurora","line1","ForwardUI","settings","debug","pl","plugins"]
GenericCommands = ["start", "align", "ljclient", "scene", "addest", "deldest", "dest", "clientnumber", "vcvrack", "fft", "mitraille", "faceosc", "midigen", "viewgen", "audiogen", "noteon", "cc", "ljpong", "ljwars", "mouse", "emergency", "simu", "status", "run", "nozoid", "planet", "live", "words", "ai", "bank0", "pose", "lj", "cycl", "glyph", "pong", "maxw", "custom1", "square", "regen", "trckr", "aurora", "line1", "ForwardUI", "settings", "debug", "pl", "plugins"]
def UserOn(laser):
@ -125,6 +127,7 @@ def BlackOn(laser):
print("Black for laser ", laser)
plugins.sendWSall("/status Black on laser " + str(laser))
sendOSCUI('/black/'+str(laser),1)
r.set('/order/'+str(laser), 2)
@ -132,9 +135,11 @@ def GridOn(laser):
print("Grid for laser ", laser)
plugins.sendWSall("/status Grid on laser " + str(laser))
sendOSCUI('/grid/'+str(laser),1)
r.set('/order/'+str(laser), 3)
def Resampler(laser,args):
# lsteps is a string like : "[ (1.0, 8),(0.25, 3), (0.75, 3), (1.0, 10)]"
@ -178,8 +183,8 @@ def SceneChange(newscene):
# Change current laser and send "/scim lasernumber to each plugin"
def NoteOn(note):
print("NoteOn", note)
print("NoteOn", note)
# Change laser client
if note < 8:
LasClientChange(note)
@ -197,6 +202,11 @@ def NoteOn(note):
print("Current Laser switched to", gstt.Laser)
plugins.sendWSall("/status Laser " + str(gstt.Laser))
plugins.SendAll(["/scim", str(gstt.Laser), 1])
print("sending cropper data..")
plugins.sendWSall("/loffset/X/" + str(gstt.Laser) +" " +str(gstt.centerX[gstt.Laser]))
plugins.sendWSall("/loffset/Y/" + str(gstt.Laser) +" " +str(gstt.centerY[gstt.Laser]))
plugins.sendWSall("/scale/X/" + str(gstt.Laser) +" " + str(gstt.zoomX[gstt.Laser]))
plugins.sendWSall("/scale/Y/" + str(gstt.Laser) +" " +str(gstt.zoomY[gstt.Laser]))
def Scim(path, tags, args, source):
@ -231,6 +241,7 @@ def ForwardUI(path, tags, args, source):
print("OSC /forwardui to WebUI :", line)
print('from path', path, 'args', args)
plugins.sendWSall(line)
sendOSCUI('/status',line)
def CC(number, value):
@ -244,14 +255,14 @@ def Mouse(x1,y1,x2,y2):
def handler(oscpath, args):
print("OSC handler in commands.py got /"+ str(oscpath)+ " with args :",args)
#print("OSC handler in commands.py got /"+ str(oscpath)+ " with args :",args)
if gstt.debug > 0:
print("OSC handler in commands.py got /"+ str(oscpath)+ " with args :",args)
# 2 incoming cases : generic or specific for a given lasernumber :
#
# Generic : Commands without a laser number
#
@ -277,9 +288,6 @@ def handler(oscpath, args):
r.set(oscpath, args[0])
#/scene/scenenumber/start 0 or 1
if oscpath[1] == "scene":
@ -333,7 +341,8 @@ def handler(oscpath, args):
print("Black requested for laser ", laser)
BlackOn(laser)
print("EMERGENCY MODE")
plugins.sendWSall("/status EMERGENCY MODE")
plugins.sendWSall("/status EMERGENCY MODE")
else:
for laser in range(gstt.lasernumber):
print("Back to normal for laser ", laser)
@ -458,20 +467,19 @@ def handler(oscpath, args):
print("No grid for laser ", laser)
UserOn(laser)
# /ip/lasernumber value
if oscpath[1] == "ip":
print("New IP for laser ", laser)
gstt.lasersIPS[laser]= args[0]
settings.Write()
# /kpps/lasernumber value
# Live change of kpps is not implemented in newdac.py. Change will effect next startup.
if oscpath[1] == "kpps":
print("New kpps for laser ", laser, " next startup", int(args[0]))
gstt.kpps[laser]= int(args[0])
settings.Write()
sendOSCUI('/kpps/' + str(laser), args[0])
r.set('/kpps/' + str(laser), str(args[0]))
r.set('/order/'+str(laser), 7)
@ -479,6 +487,7 @@ def handler(oscpath, args):
if oscpath[1] == "angle":
print("New Angle modification for laser ", oscpath[2], ":", float(args[0]))
gstt.finANGLE[laser] = math.radians(float(args[0]))
sendOSCUI('/angle/' + str(laser), gstt.finANGLE[laser])
NewEDH(laser)
print("New angle", gstt.finANGLE[laser])
@ -486,10 +495,11 @@ def handler(oscpath, args):
if oscpath[1] == "intens":
print("LJ2 : New intensity requested for laser ", laser, ":", int(args[0]))
plugins.sendWSall("/status Intensity " + str(args[0]))
sendOSCUI('/intens/' + str(laser), args[0])
r.set('/intensity/' + str(laser), str(args[0]))
r.set('/order/'+str(laser), 6)
# /resampler/lasernumber lsteps
# lsteps is a string like "[ (1.0, 8),(0.25, 3), (0.75, 3), (1.0, 10)]"
@ -535,42 +545,91 @@ def handler(oscpath, args):
gstt.swapY[laser]= 1
NewEDH(laser)
# /loffset/X/lasernumber value
if oscpath[1] == "loffset" and oscpath[2] == "X":
if -32000 < int(args[0]) < 32000:
if -32000 < float(args[0]) < 32000:
print("offset/X laser", laser, "modified to", args[0])
gstt.centerX[laser] = int(args[0])
gstt.centerX[laser] = float(args[0])
NewEDH(laser)
# /loffset/Y/lasernumber value
if oscpath[1] == "loffset" and oscpath[2] == "Y":
if -32000 < int(args[0]) < 32000:
if -32000 < float(args[0]) < 32000:
print("offset/Y laser", laser, "modified to", args[0])
gstt.centerY[laser] = int(args[0])
gstt.centerY[laser] = float(args[0])
NewEDH(laser)
# /scale/X/lasernumber value
if oscpath[1] == "scale" and oscpath[2] == "X":
gstt.zoomX[laser] = int(args[0])
gstt.zoomX[laser] = float(args[0])
print("scale/X laser", laser , "modified to", gstt.zoomX[laser])
NewEDH(laser)
# /scale/Y/lasernumber value
if oscpath[1] == "scale" and oscpath[2] == "Y":
gstt.zoomY[laser] = int(args[0])
gstt.zoomY[laser] = float(args[0])
print("scale/Y laser", laser, "modified to", gstt.zoomY[laser])
NewEDH(laser)
# OSC UI feedback
def sendOSCUI(oscaddress,oscargs=''):
if gstt.TouchOSCUI == True:
oscmsg = OSC3.OSCMessage()
oscmsg.setAddress(oscaddress)
oscmsg.append(oscargs)
oscui = OSC3.OSCClient()
oscui.connect((gstt.TouchOSCIP, 8001))
#print("main sending OSC UI message :", oscmsg, "to", gstt.TouchOSCIP, ":8001")
if gstt.debug >0:
print("main sending OSC UI message :", oscmsg, "to", gstt.TouchOSCIP, ":8001")
try:
oscui.sendto(oscmsg, (gstt.TouchOSCIP, 8001))
oscmsg.clearData()
except:
print ('Connection to OSC UI refused : died ?')
pass
def UpdateOSCUI(laserid):
sendOSCUI("/ip/" + str(laserid), str(gstt.lasersIPS[laserid]))
sendOSCUI("/kpps/" + str(laserid), str(gstt.kpps[laserid]))
sendOSCUI("/intens/" + str(laserid), str(gstt.intens[laserid]))
sendOSCUI("/red/" + str(laserid), str(gstt.red[laserid]))
sendOSCUI("/green/" + str(laserid), str(gstt.green[laserid]))
sendOSCUI("/blue/" + str(laserid), str(gstt.blue[laserid]))
sendOSCUI("/loffset/X/" + str(laserid), str(gstt.centerX[laserid]))
sendOSCUI("/loffset/Y/" + str(laserid), str(gstt.centerY[laserid]))
sendOSCUI("/scale/X/" + str(laserid), str(gstt.zoomX[laserid]))
sendOSCUI("/scale/Y/" + str(laserid), str(gstt.zoomY[laserid]))
sendOSCUI("/angle/" + str(laserid), str(gstt.finANGLE[laserid]))
sendOSCUI("/type/" + str(laserid), str(gstt.lasertype[laserid]))
if gstt.swapX[laserid] == 1:
sendOSCUI("/swap/X/" + str(laserid), 1)
else:
sendOSCUI("/swap/X/" + str(laserid), 0)
if gstt.swapY[laserid] == 1:
sendOSCUI("/swap/Y/" + str(laserid), 1)
else:
sendOSCUI("/swap/Y/" + str(laserid), 0)
#
# Different useful codes for some commands
#
def Updatepage(file_name):
print("updating", file_name)

View file

@ -29,10 +29,14 @@ LaserNumber = 4
SceneNumber = 0
MaxScenes = 3
screen_size = [400,400]
xy_center = [screen_size[0]/2,screen_size[1]/2]
LjayServerIP = '192.168.1.13'
ScreenX = [-1500,1500]
ScreenY = [-1500,1500]
screen_size = [400,400]
#xy_center = [screen_size[0]/2,screen_size[1]/2]
xy_center = [0,0]
RediServerIP = '192.168.1.13'
oscIPin = '192.168.1.15'
nozoscIP = '192.168.1.15'
wwwIP = '192.168.1.15'
@ -60,8 +64,12 @@ dacnumber = 0
# ** Will be overridden by LJ.conf file values **
kpps = [25000,25000,25000,25000]
lasertype = ["LOCAL","LOCAL","LOCAL","LOCAL"]
dacfamily = ["etherdream","etherdream","etherdream","etherdream"]
intensity = [-1,-1,-1,-1]
intens = [-1,-1,-1,-1]
red = [100,100,100,100]
green = [100,100,100,100]
blue = [100,100,100,100]
# gstt.GridDisplay : if = 1 Curve points actually sent to PL are replaced by a grid
GridDisplay = [0,0,0,0]
@ -141,11 +149,31 @@ warpdest = [[[ 1. , 0. , 0.],[ 0. , 1. , 0.],[ 0. , 0. , 1.]],
[[ 1. , 0. , 0.],[ 0. , 1. , 0.],[ 0. , 0. , 1.]]
]
BeatstepLayer = 1
BeatstepLayers = ['XY','Live',"Align","Zregulators"]
TouchOSCPort = 8101
BhorealLayer = 0
BhorealLayers = ['Maxwell1','Maxwell2','Maxwell3']
LaunchpadLayer = 0
LaunchpadLayers = ['Maxwell1','Maxwell2','OS']
BeatstepLayer = 0
BeatstepLayers = ['XY','TraRot',"HueInt","Zregulators"]
BCRLayer = 0
BCRLayers = ['Main','Second']
SequencerLayer = 3
SequencerLayers = ['XY','TraRot',"HueInt","Zregulators"]
lpd8Layer = 0
lpd8Layers = ['Maxwell1','Maxwell2','Maxwell3','OS']
TouchOSCUI = False
TouchOSCPort = 8001
# TouchOSCIP is now auto assigned when /connect is received
TouchOSCIP = '192.168.2.67' # iPad 1
#TouchOSCIP = '192.168.2.67' # iPad 1
#TouchOSCIP = '192.168.2.156' # iPad mini
#TouchOSCIP = '192.168.43.146' # iPad mini @ fuzz
#TouchOSCIP = '192.168.151.213' # CCN

View file

@ -10,7 +10,7 @@ v0.7.0
LICENCE : CC
Sam Neurohack
Homographies for align + swap corrections and warp corrections
Homographies for LJ settings corrections and DISABLED warp corrections
Align + swap homography if found with 4 original points and corrected coordinates
Warp correction is disabled for the moment. Should be computed at warp edition : set 1 curve 1
@ -67,11 +67,12 @@ import math
from scipy.linalg import svd,lstsq
import ast
from libs3 import gstt
from libs3 import commands
#from globalVars import xy_center
import redis
r = redis.StrictRedis(host=gstt.LjayServerIP, port=6379, db=0)
r = redis.StrictRedis(host=gstt.RediServerIP, port=6379, db=0)
def find(points1,points2):
if points1.shape[0] != points2.shape[0] : raise ValueError("The number of input and output points mismatches")
@ -160,32 +161,49 @@ def apply(H,points):
# Align and axis swap corrections
# Reference points
pointsref = np.array([(300.0, 400.0), (500.0, 400.0), (500.0, 200.0), (300.0, 200.0)])
pointsref = np.array([(-1500.0, 1500.0), (1500.0, 1500.0), (1500.0, -1500.0), (-1500.0, -1500.0)])
# wad : pointsref = np.array([(300.0, 400.0), (500.0, 400.0), (500.0, 200.0), (300.0, 200.0)])
ScreenX = [-1500,1500]
ScreenY = [-1500,1500]
def EDpoint(mylaser, xxx_todo_changeme):
# Compute refpoint transformation in EtherDream space according to settings webpage (= LJ.conf)
def EDpoint(mylaser, refpt):
#print "current point : ", pygamex, pygamey
(pygamex,pygamey) = xxx_todo_changeme
XX = refpt[0]
YY = refpt[1]
CosANGLE = math.cos(gstt.finANGLE[mylaser])
SinANGLE = math.sin(gstt.finANGLE[mylaser])
#if zoom is a percentage of 65535 etherdream space
#x = (((XX * CosANGLE) - (YY * SinANGLE))) * gstt.zoomX[mylaser] * 65535 + gstt.centerX[mylaser]
#y = (((XX * SinANGLE) + (YY * CosANGLE))) * gstt.zoomY[mylaser] * 65535 + gstt.centerY[mylaser]
x = (((XX * CosANGLE) - (YY * SinANGLE))) * gstt.zoomX[mylaser] + gstt.centerX[mylaser]
y = (((XX * SinANGLE) + (YY * CosANGLE))) * gstt.zoomY[mylaser] + gstt.centerY[mylaser]
'''
Was :
(pygamex,pygamey) = refpt
XX = pygamex - gstt.xy_center[0]
YY = pygamey - gstt.xy_center[1]
CosANGLE = math.cos(gstt.finANGLE[mylaser])
SinANGLE = math.sin(gstt.finANGLE[mylaser])
x = (gstt.xy_center[0] + ((XX * CosANGLE) - (YY * SinANGLE)) - gstt.xy_center[0]) * gstt.zoomX[mylaser] + gstt.centerX[mylaser]
y = (gstt.xy_center[1] + ((XX * SinANGLE) + (YY * CosANGLE)) - gstt.xy_center[1]) * gstt.zoomY[mylaser] + gstt.centerY[mylaser]
'''
#print()
#print("EDpoint computing...")
#print("Reference point :",refpt[0], refpt[1])
#print("Projected point :", x * gstt.swapX[mylaser] , y * gstt.swapY[mylaser])
#print("Laser :", mylaser)
#print("Reference center : 0 0")
#print("swaps :", gstt.swapX[mylaser], gstt.swapY[mylaser])
#print("zooms :", gstt.zoomX[mylaser], gstt.zoomY[mylaser])
#print("angle :", gstt.finANGLE[mylaser])
#print("Projection center at :", gstt.centerX[mylaser], gstt.centerY[mylaser])
if gstt.debug >1:
#print "global center :", xy_center
print("EDpoint computing...")
print("Laser :", mylaser, "center at : ", gstt.centerX[mylaser], gstt.centerY[mylaser])
print("Pygame point",pygamex,",",pygamey)
'''
print "swaps : ", (gstt.swapX[mylaser]), str(gstt.swapY[mylaser])
print "zooms : ", gstt.zoomX[mylaser], gstt.zoomY[mylaser]
print "angles : ", gstt.finANGLE[mylaser]
'''
print("Result point : ", x * gstt.swapX[mylaser] , y * gstt.swapY[mylaser])
commands.UpdateOSCUI(mylaser)
return [x * gstt.swapX[mylaser] , y * gstt.swapY[mylaser]]
'''
@ -203,7 +221,7 @@ def EDpoint((pygamex,pygamey)):
'''
# New total homography from always the same reference points : ED (= align + swap) transform + warp transform.
# New total homography from always the same reference points to EtherDream space according to LJ settings transform + warp DISABLED transform.
# WARP IS DISABLED. Some bug tracking is needed !
def newEDH(mylaser):
@ -226,8 +244,10 @@ def newEDH(mylaser):
if r.set('/EDH/'+str(mylaser), np.array2string(gstt.EDH[mylaser], separator=',')) == True:
r.set('/order/'+str(mylaser), 1)
print("New EDH sent.")
print()
else:
print("New EDH not sent.")
print()
'''
# Laser bit 0 = 0 and bit 1 = 1 : New EDH
order = r.get('/order')

View file

@ -53,12 +53,12 @@ import sys
sys.path.append('libs/')
import os
import midi3, gstt
from . import midi3, gstt
#import midimacros, maxwellmacros
import traceback
from queue import Queue
import scrolldisp, maxwellccs, beatstep, bhoreal
from . import scrolldisp, maxwellccs, bhoreal # , beatstep
#from libs import macros
import json, subprocess
from OSC3 import OSCServer, OSCClient, OSCMessage
@ -744,17 +744,16 @@ def padCC(buttonname, state):
launchqueue = Queue()
ModeCallback = "ModeNo"
#
# Modes : Top lines functions
#
# Load Matrix only macros (for the moment) in launchpad.json
def LoadMacros():
global macros, nbmacro
@ -762,9 +761,9 @@ def LoadMacros():
#print()
print("Loading Launchpad Macros...")
if os.path.exists('libs/launchpad.json'):
#print('File is libs/launchpad.json')
f=open("libs/launchpad.json","r")
if os.path.exists('libs3/launchpad.json'):
#print('File is libs3/launchpad.json')
f=open("libs3/launchpad.json","r")
elif os.path.exists('../launchpad.json'):
#print('File is ../launchpad.json')
@ -774,9 +773,9 @@ def LoadMacros():
#print('File is launchpad.json')
f=open("launchpad.json","r")
elif os.path.exists(ljpath+'/../../libs/launchpad.json'):
#print('File is '+ljpath+'/../../libs/launchpad.json')
f=open(ljpath+"/../../libs/launchpad.json","r")
elif os.path.exists(ljpath+'/../../libs3/launchpad.json'):
#print('File is '+ljpath+'/../../libs3/launchpad.json')
f=open(ljpath+"/../../libs3/launchpad.json","r")
s = f.read()
macros = json.loads(s)

View file

@ -4,7 +4,7 @@
'''
lj23layers v0.7.6 for LJ v0.8+
lj v0.7.6 for LJ v0.8+
LJ functions (API) for python plugins/clients
@ -279,7 +279,7 @@ def Config(redIP,client,myname):
ClientNumber = client
#print ("client configured",ClientNumber)
name = myname
print ("lj23layers : Plugin declare its name :",name)
print ("lj : Plugin declare its name :",name)
#print layer
return r
@ -355,10 +355,10 @@ def SendLJ(oscaddress,oscargs=''):
osclientlj = OSCClient()
osclientlj.connect((redisIP, 8002))
#print("lj23layers for", name, "sending OSC message :", oscmsg, "to", redisIP, ":8002")
#print("lj for", name, "sending OSC message :", oscmsg, "to", redisIP, ":8002")
if gstt.debug >0:
print("lj23layers for", name, "sending OSC message :", oscmsg, "to", redisIP, ":8002")
print("lj for", name, "sending OSC message :", oscmsg, "to", redisIP, ":8002")
try:
osclientlj.sendto(oscmsg, (redisIP, 8002))
@ -384,7 +384,7 @@ def SendResol(oscaddress,oscargs):
osclientresol = OSCClient()
osclientresol.connect((oscIPresol, oscPORTresol))
print("lj23layers sending OSC message : ", oscmsg, "to Resolume", oscIPresol, ":", oscPORTresol)
print("lj sending OSC message : ", oscmsg, "to Resolume", oscIPresol, ":", oscPORTresol)
try:
osclientresol.sendto(oscmsg, (oscIPresol, oscPORTresol))
oscmsg.clearData()
@ -429,7 +429,7 @@ def OSCframe():
def OSCping(path, tags, args, source):
#def OSCping():
if gstt.debug >0:
print(name, "lj23layers got /ping from LJ -> reply /pong", name)
print(name, "lj got /ping from LJ -> reply /pong", name)
SendLJ("/pong",name)
@ -447,7 +447,7 @@ def OSCquit(path, tags, args, source):
global oscrun
oscrun = False
print('lj23layers got /quit for',name)
print('lj got /quit for',name)
#WebStatus(name + " quit.")
#SendLJ("/"+name+"/start",0)
#print("Stopping OSC...")
@ -459,7 +459,7 @@ def OSCquit(path, tags, args, source):
def OSChandler(path, tags, args, source):
oscaddress = ''.join(path.split("/"))
print("lj23layers Default OSC Handler for",name,": msg from Client :" + str(source[0]),)
print("lj Default OSC Handler for",name,": msg from Client :" + str(source[0]),)
print("OSC address", path)
if len(args) > 0:
print("with args", args)

View file

@ -5,7 +5,7 @@ lj3 v0.7.5 for LJ v0.8+
Some LJ functions useful for python clients
lj3 is deprecated use lj23
lj3 is deprecated use lj
OSC functions commented, waiting working on OSC in python3

View file

@ -23,7 +23,7 @@ from rtmidi.midiconstants import (CHANNEL_PRESSURE, CONTROLLER_CHANGE, NOTE_ON,
PITCH_BEND, POLY_PRESSURE, PROGRAM_CHANGE)
import os, json
import midi3
from . import midi3
if os.uname()[1]=='raspberrypi':
pass

View file

@ -186,7 +186,7 @@ def OSCsend(name, oscaddress, oscargs =''):
try:
if gstt.debug > 0:
print("Midi OSCSend : sending", oscmsg, "to", name, "at", gstt.LjayServerIP, ":", PluginPort)
print("Midi OSCSend : sending", oscmsg, "to", name, "at", gstt.RediServerIP, ":", PluginPort)
osclient.sendto(oscmsg, (ip, port))
oscmsg.clearData()
#if gstt.debug >0:

View file

@ -50,10 +50,9 @@ import weakref
import sys
from sys import platform
print()
print('Midi startup...')
from libs3 import gstt
import gstt, bhoreal, launchpad, LPD8
from libs3 import bhoreal, launchpad, LPD8, beatstep
from queue import Queue
from OSC3 import OSCServer, OSCClient, OSCMessage
@ -386,7 +385,7 @@ def OutConfig():
#
if len(OutDevice) == 0:
print("")
#print("")
print("MIDIout...")
print("List and attach to available devices on host with IN port :")
@ -416,7 +415,7 @@ def OutConfig():
OutDevice.append(OutObject(name, "launchpad", port))
print("Launchpad mini start animation")
launchpad.Here = port
launchpad.StartLaunchPad(port)
launchpad.Start(port)
time.sleep(0.2)
# Search for a LPD8

View file

@ -12,6 +12,9 @@ Plugins Handler.
from OSC3 import OSCServer, OSCClient, OSCMessage
from websocket_server import WebsocketServer
from libs3 import gstt
# ?
from libs3 import commands
import os
import subprocess
import sys
@ -24,10 +27,20 @@ def Init(wserver):
def sendWSall(message):
print("WS sending %s" % (message))
#if gstt.debug >0:
#print("WS sending %s" % (message))
WSserver.send_message_to_all(message)
if message[:7] == '/status':
commands.sendOSCUI('/status', message[8:])
print("plugins WSall", message)
if message[:5] == '/line1':
commands.sendOSCUI('/line1', message[6:])
print("plugins WSall", message)
# What is plugin's OSC port ?
def Port(name):
@ -54,7 +67,6 @@ def Data(name):
return gstt.plugins.get(name)
def Kill(name):
#data = Data(name)
@ -111,7 +123,7 @@ def Start(name):
#PluginProcess = os.execv([PluginPath[0], ljpath + "/" + PluginPath[1]])
if gstt.debug >0:
print("LJ path :", ljpath)
print("LJ path :", gstt.ljpath)
print("New process pid for ", name, ":", PluginProcess.pid)
'''
@ -153,16 +165,16 @@ def OSCsend(name, oscaddress, oscargs =''):
#sendWSall("/status Checking "+ name + "...")
osclientplugin = OSCClient()
osclientplugin.connect((gstt.LjayServerIP, PluginPort))
osclientplugin.connect((gstt.RediServerIP, PluginPort))
oscmsg = OSCMessage()
oscmsg.setAddress(oscaddress)
oscmsg.append(oscargs)
try:
if gstt.debug > 0:
print("Plugins manager : OSCsending", oscmsg,"to plugin", name, "at", gstt.LjayServerIP, ":", PluginPort)
print("Plugins manager : OSCsending", oscmsg,"to plugin", name, "at", gstt.RediServerIP, ":", PluginPort)
osclientplugin.sendto(oscmsg, (gstt.LjayServerIP, PluginPort))
osclientplugin.sendto(oscmsg, (gstt.RediServerIP, PluginPort))
oscmsg.clearData()
if gstt.debug >0:
print(oscaddress, oscargs, "was sent to",name)
@ -170,7 +182,7 @@ def OSCsend(name, oscaddress, oscargs =''):
except:
if gstt.debug > 0:
print('OSCSend : Connection to plugin IP', gstt.LjayServerIP ,':', PluginPort,'refused : died ?')
print('OSCSend : Connection to plugin IP', gstt.RediServerIP ,':', PluginPort,'refused : died ?')
#sendWSall("/status No plugin.")
#sendWSall("/status " + name + " is offline")
#sendWSall("/" + name + "/start 0")
@ -208,7 +220,6 @@ def Send(name, oscpath):
#if oscpath.find(name) != -1:
if oscpath[0].find(name) != -1:
print("pinging..", name)
# Plugin is online ?
if Ping(name):
@ -220,7 +231,6 @@ def Send(name, oscpath):
print('')
print("Plugins manager got", oscpath, "for plugin", name, "currently online.")
# If start 0, try to kill plugin
if oscpath[0].find("start") != -1 and oscpath[1] == "0":

View file

@ -38,7 +38,7 @@ bhoreal.Cls()
#from unicorn_hat_sim import unicornhat as u
import bhorunicornhat as u
from . import bhorunicornhat as u
import time, math, sys
class ScrollDisp:

View file

@ -19,10 +19,11 @@ import numpy as np
def Write():
config.set('General', 'lasernumber', str(gstt.LaserNumber))
config.set('General', 'ljayserverip', str(gstt.LjayServerIP))
config.set('General', 'rediserverip', str(gstt.RediServerIP))
config.set('General', 'wwwip', str(gstt.wwwIP))
config.set('General', 'bhoroscip', str(gstt.oscIPin))
config.set('General', 'oscserverip', str(gstt.oscIPin))
config.set('General', 'nozoscip', str(gstt.nozoscIP))
config.set('General', 'wsport', str(gstt.wsPORT))
config.set('General', 'debug', str(gstt.debug))
config.set('General', 'autostart', gstt.autostart)
@ -30,7 +31,12 @@ def Write():
laser = 'laser' + str(i)
config.set(laser, 'ip', str(gstt.lasersIPS[i]))
config.set(laser, 'type', str(gstt.lasertype[i]))
config.set(laser, 'dac_family', str(gstt.dacfamily[i]))
config.set(laser, 'kpps', str(gstt.kpps[i]))
config.set(laser, 'intens', str(gstt.intens[i]))
config.set(laser, 'red', str(gstt.red[i]))
config.set(laser, 'green', str(gstt.green[i]))
config.set(laser, 'blue', str(gstt.blue[i]))
config.set(laser, 'centerx', str(gstt.centerX[i]))
config.set(laser, 'centery', str(gstt.centerY[i]))
config.set(laser, 'zoomx', str(gstt.zoomX[i]))
@ -48,11 +54,12 @@ def Write():
def Read():
gstt.LaserNumber = config.getint('General', 'lasernumber')
gstt.LjayServerIP= config.get('General', 'ljayserverip')
gstt.RediServerIP= config.get('General', 'rediserverip')
gstt.wwwIP= config.get('General', 'wwwip')
gstt.oscIPin = config.get('General', 'bhoroscip')
gstt.nozoscip = config.get('General', 'nozoscip')
gstt.oscIPin = config.get('General', 'oscserverip')
gstt.nozoscIP = config.get('General', 'nozoscip')
gstt.debug = config.get('General', 'debug')
gstt.wsPORT = config.getint('General', 'wsport')
gstt.plugins = ast.literal_eval(config.get('plugins', 'plugins'))
gstt.autostart = config.get('General', 'autostart')
@ -61,14 +68,19 @@ def Read():
laser = 'laser' + str(i)
gstt.lasersIPS[i]= config.get(laser, 'ip')
gstt.lasertype[i]= config.get(laser, 'type')
gstt.dacfamily[i] = config.get(laser, 'dac_family')
gstt.kpps[i] = config.getint(laser, 'kpps')
gstt.intens[i] = config.getfloat(laser, 'intens')
gstt.red[i] = config.getint(laser, 'red')
gstt.green[i] = config.getint(laser, 'green')
gstt.blue[i] = config.getint(laser, 'blue')
#gstt.lasersPLcolor[i] = config.getint(laser, 'color')
gstt.centerX[i]= config.getint(laser, 'centerx')
gstt.centerY[i] = config.getint(laser, 'centery')
gstt.centerX[i]= config.getfloat(laser, 'centerx')
gstt.centerY[i] = config.getfloat(laser, 'centery')
gstt.zoomX[i] = config.getfloat(laser, 'zoomx')
gstt.zoomY[i] = config.getfloat(laser, 'zoomy')
gstt.sizeX[i] = config.getint(laser, 'sizex')
gstt.sizeY[i] = config.getint(laser, 'sizey')
gstt.sizeX[i] = config.getfloat(laser, 'sizex')
gstt.sizeY[i] = config.getfloat(laser, 'sizey')
gstt.finANGLE[i] = config.getfloat(laser, 'finangle')
gstt.swapX[i] = config.getint(laser, 'swapx')
gstt.swapY[i] = config.getint(laser, 'swapy')

View file

@ -88,11 +88,14 @@ import binascii
black_points = [(278.0,225.0,0),(562.0,279.0,0),(401.0,375.0,0),(296.0,454.0,0),(298.0,165.0,0)]
grid_points = [(300.0,200.0,0),(500.0,200.0,65280),(500.0,400.0,65280),(300.0,400.0,65280),(300.0,200.0,65280),(300.0,200.0,0),(200.0,100.0,0),(600.0,100.0,65280),(600.0,500.0,65280),(200.0,500.0,65280),(200.0,100.0,65280)]
r = redis.StrictRedis(host=gstt.LjayServerIP, port=6379, db=0)
# r = redis.StrictRedis(host=gstt.LjayServerIP , port=6379, db=0, password='-+F816Y+-')
r = redis.StrictRedis(host=gstt.RediServerIP, port=6379, db=0)
# r = redis.StrictRedis(host=gstt.RediServerIP , port=6379, db=0, password='-+F816Y+-')
ackstate = {'61': 'ACK', '46': 'FULL', '49': "INVALID", '21': 'STOP', '64': "NO CONNECTION ?", '35': "NO CONNECTION ?" , '97': 'ACK', '70': 'FULL', '73': "INVALID", '33': 'STOP', '100': "NOCONNECTION", '48': "NOCONNECTION", 'a': 'ACK', 'F': 'FULL', 'I': "INVALID", '!': 'STOP', 'd': "NO CONNECTION ?", '0': "NO CONNECTION ?"}
lstate = {'0': 'IDLE', '1': 'PREPARE', '2': "PLAYING", '64': "NOCONNECTION ?" }
ScreenX = [-1500,1500]
ScreenY = [-1500,1500]
def pack_point(laser, intensity, x, y, r, g, b, i = -1, u1 = 0, u2 = 0, flags = 0):
"""Pack some color values into a struct dac_point."""
@ -120,26 +123,26 @@ def pack_point(laser, intensity, x, y, r, g, b, i = -1, u1 = 0, u2 = 0, flags =
if x < -32767:
if gstt.debug >1:
log.err("Tracer "+ str(laser) +" : x coordinates " + str(x) + " was below -32767")
x = -32000
x = -32700
if x > 32767:
if gstt.debug >1:
log.err("Tracer "+ str(laser) +" : x coordinates "+ str(x) + " was bigger than 32767")
x = 32000
x = 32700
if y < -32767:
if gstt.debug >1:
log.err("Tracer "+ str(laser) +" : y coordinates "+ str(y) + " was below -32767")
y = -32000
y = -32700
if y > 32767:
if gstt.debug >1:
log.err("Tracer "+ str(laser) +" : y coordinates "+ str(y) + " was bigger than 32767")
y = 32000
y = 32700
return struct.pack("<HhhHHHHHH", flags, x, y, r, g, b, i, u1, u2)