BUgfixs
This commit is contained in:
parent
98f039b2ee
commit
012bef55b1
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
|
*.DS_Store
|
||||||
# ---> Python
|
# ---> Python
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
4
client.py
Normal file → Executable file
4
client.py
Normal file → Executable file
@ -60,8 +60,8 @@ print ("Arguments parsing if needed...")
|
|||||||
argsparser = argparse.ArgumentParser(description="Jamidi Client v0.1b commands help mode")
|
argsparser = argparse.ArgumentParser(description="Jamidi Client v0.1b commands help mode")
|
||||||
argsparser.add_argument("-s","--servername",help="servername: 'local', 'xrkia' ('local' by default)", type=str)
|
argsparser.add_argument("-s","--servername",help="servername: 'local', 'xrkia' ('local' by default)", type=str)
|
||||||
|
|
||||||
argsparser.add_argument('--default',help="All incoming midi <-> default midi device. Default option." , dest='default', action='store_true')
|
# argsparser.add_argument('--default',help="All incoming midi <-> default midi device. Default option." , dest='default', action='store_true')
|
||||||
argsparser.add_argument('--no-default',help="Do not send reset values to local device a startup.", dest='default', action='store_false')
|
argsparser.add_argument('-nodefault',help="Do not send reset values to local device a startup.", dest='default', action='store_false')
|
||||||
argsparser.set_defaults(default=True)
|
argsparser.set_defaults(default=True)
|
||||||
|
|
||||||
args = argsparser.parse_args()
|
args = argsparser.parse_args()
|
||||||
|
46
jamidi.json
46
jamidi.json
@ -6,7 +6,9 @@
|
|||||||
"type": "serverconf",
|
"type": "serverconf",
|
||||||
"name": "local",
|
"name": "local",
|
||||||
"IP": "127.0.0.1",
|
"IP": "127.0.0.1",
|
||||||
"port": 8081
|
"port": 8081,
|
||||||
|
"oscport": 8082,
|
||||||
|
"udport": 8083
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -17,7 +19,9 @@
|
|||||||
"type": "serverconf",
|
"type": "serverconf",
|
||||||
"name": "llstrvpn",
|
"name": "llstrvpn",
|
||||||
"IP": "10.8.0.46",
|
"IP": "10.8.0.46",
|
||||||
"port": 8081
|
"port": 8081,
|
||||||
|
"oscport": 8082,
|
||||||
|
"udport": 8083
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -28,7 +32,9 @@
|
|||||||
"type": "serverconf",
|
"type": "serverconf",
|
||||||
"name": "xrkia",
|
"name": "xrkia",
|
||||||
"IP": "xrkia.org",
|
"IP": "xrkia.org",
|
||||||
"port": 8081
|
"port": 8081,
|
||||||
|
"oscport": 8082,
|
||||||
|
"udport": 8083
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -39,7 +45,29 @@
|
|||||||
"type": "serverconf",
|
"type": "serverconf",
|
||||||
"name": "tmlsr",
|
"name": "tmlsr",
|
||||||
"IP": "laser.teamlaser.fr",
|
"IP": "laser.teamlaser.fr",
|
||||||
"port": 8081
|
"port": 8081,
|
||||||
|
"oscport": 8082,
|
||||||
|
"udport": 8083
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
"sq-1": [
|
||||||
|
{
|
||||||
|
"_comment": "SQ-1 device parameters",
|
||||||
|
"type": "mididevice",
|
||||||
|
"mididevice": "UM-ONE:UM-ONE MIDI 1 20:0",
|
||||||
|
"midichan" : 3,
|
||||||
|
"xname" : "sq-1(3)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
"sq-1": [
|
||||||
|
{
|
||||||
|
"_comment": "SQ-1 device parameters",
|
||||||
|
"type": "mididevice",
|
||||||
|
"mididevice": "UM-ONE:UM-ONE MIDI 1 20:0",
|
||||||
|
"midichan" : 4,
|
||||||
|
"xname" : "sq-1(4)"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -93,6 +121,16 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
"maxwell": [
|
||||||
|
{
|
||||||
|
"_comment": "Mawell device parameters",
|
||||||
|
"type": "mididevice",
|
||||||
|
"mididevice": "to Maxwell 1",
|
||||||
|
"midichan" : 0,
|
||||||
|
"xname" : "ocs2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
"default": [
|
"default": [
|
||||||
{
|
{
|
||||||
|
151
libs/midi3.py
151
libs/midi3.py
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
@ -13,6 +14,8 @@ Midi Handler :
|
|||||||
by Sam Neurohack
|
by Sam Neurohack
|
||||||
from /team/laser
|
from /team/laser
|
||||||
|
|
||||||
|
Midi conversions from https://github.com/craffel/pretty-midi
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -32,6 +35,7 @@ import weakref
|
|||||||
import sys
|
import sys
|
||||||
from sys import platform
|
from sys import platform
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
is_py2 = sys.version[0] == '2'
|
is_py2 = sys.version[0] == '2'
|
||||||
@ -103,13 +107,90 @@ STATUS_MAP = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def GetTime():
|
||||||
|
return time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())
|
||||||
|
|
||||||
notes = ["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"]
|
notes = ["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"]
|
||||||
def midi2note(midinote):
|
def midi2note(midinote):
|
||||||
|
|
||||||
print("midinote",midinote, "note", notes[midinote%12]+str(round(midinote/12)))
|
print(GetTime(),"midinote",midinote, "note", notes[midinote%12]+str(round(midinote/12)))
|
||||||
return notes[midinote%12]+str(round(midinote/12))
|
return notes[midinote%12]+str(round(midinote/12))
|
||||||
|
|
||||||
|
|
||||||
|
def note2midi(note_name):
|
||||||
|
"""Converts a note name in the format
|
||||||
|
``'(note)(accidental)(octave number)'`` (e.g. ``'C#4'``) to MIDI note
|
||||||
|
number.
|
||||||
|
``'(note)'`` is required, and is case-insensitive.
|
||||||
|
``'(accidental)'`` should be ``''`` for natural, ``'#'`` for sharp and
|
||||||
|
``'!'`` or ``'b'`` for flat.
|
||||||
|
If ``'(octave)'`` is ``''``, octave 0 is assumed.
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
note_name : str
|
||||||
|
A note name, as described above.
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
note_number : int
|
||||||
|
MIDI note number corresponding to the provided note name.
|
||||||
|
Notes
|
||||||
|
-----
|
||||||
|
Thanks to Brian McFee.
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Map note name to the semitone
|
||||||
|
pitch_map = {'C': 0, 'D': 2, 'E': 4, 'F': 5, 'G': 7, 'A': 9, 'B': 11}
|
||||||
|
# Relative change in semitone denoted by each accidental
|
||||||
|
acc_map = {'#': 1, '': 0, 'b': -1, '!': -1}
|
||||||
|
|
||||||
|
# Reg exp will raise an error when the note name is not valid
|
||||||
|
try:
|
||||||
|
# Extract pitch, octave, and accidental from the supplied note name
|
||||||
|
match = re.match(r'^(?P<n>[A-Ga-g])(?P<off>[#b!]?)(?P<oct>[+-]?\d+)$',
|
||||||
|
note_name)
|
||||||
|
|
||||||
|
pitch = match.group('n').upper()
|
||||||
|
offset = acc_map[match.group('off')]
|
||||||
|
octave = int(match.group('oct'))
|
||||||
|
except:
|
||||||
|
raise ValueError('Improper note format: {}'.format(note_name))
|
||||||
|
# Convert from the extrated ints to a full note number
|
||||||
|
return 12*(octave + 1) + pitch_map[pitch] + offset
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def hz2midi(frequency):
|
||||||
|
"""Convert a frequency in Hz to a (fractional) note number.
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
frequency : float
|
||||||
|
Frequency of the note in Hz.
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
note_number : float
|
||||||
|
MIDI note number, can be fractional.
|
||||||
|
"""
|
||||||
|
# MIDI note numbers are defined as the number of semitones relative to C0
|
||||||
|
# in a 440 Hz tuning
|
||||||
|
return 12*(np.log2(frequency) - np.log2(440.0)) + 69
|
||||||
|
|
||||||
|
def midi2hz(note_number):
|
||||||
|
"""Convert a (fractional) MIDI note number to its frequency in Hz.
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
note_number : float
|
||||||
|
MIDI note number, can be fractional.
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
note_frequency : float
|
||||||
|
Frequency of the note in Hz.
|
||||||
|
"""
|
||||||
|
# MIDI note numbers are defined as the number of semitones relative to C0
|
||||||
|
# in a 440 Hz tuning
|
||||||
|
return 440.0*(2.0**((note_number - 69)/12.0))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Send through websocket.
|
# Send through websocket.
|
||||||
# Different websocket library for client (websocket) or server (websocket_server.
|
# Different websocket library for client (websocket) or server (websocket_server.
|
||||||
# ws object is added here by main.py or client.py startup : midi3.ws =
|
# ws object is added here by main.py or client.py startup : midi3.ws =
|
||||||
@ -139,7 +220,7 @@ def MidinProcess(inqueue, portname):
|
|||||||
time.sleep(0.001)
|
time.sleep(0.001)
|
||||||
msg = inqueue_get()
|
msg = inqueue_get()
|
||||||
print("")
|
print("")
|
||||||
print("Generic from", portname,"msg : ", msg)
|
print(GetTime(),"Generic from", portname,"msg : ", msg)
|
||||||
|
|
||||||
|
|
||||||
# Noteon message on all midi channels
|
# Noteon message on all midi channels
|
||||||
@ -148,9 +229,9 @@ def MidinProcess(inqueue, portname):
|
|||||||
MidiChannel = msg[0]-144
|
MidiChannel = msg[0]-144
|
||||||
MidiNote = msg[1]
|
MidiNote = msg[1]
|
||||||
MidiVel = msg[2]
|
MidiVel = msg[2]
|
||||||
print("NOTE ON :", MidiNote, 'velocity :', MidiVel, "Channel", MidiChannel)
|
print(GetTime(),"NOTE ON :", MidiNote, 'velocity :', MidiVel, "Channel", MidiChannel)
|
||||||
#NoteOn(msg[1],msg[2],mididest)
|
#NoteOn(msg[1],msg[2],mididest)
|
||||||
print("Midi in process send /"+findJamName(portname, MidiChannel)+"/noteon "+str(msg[1])+" "+str(msg[2]))
|
print(GetTime(),"Midi in process send /"+findJamName(portname, MidiChannel)+"/noteon "+str(msg[1])+" "+str(msg[2]))
|
||||||
wssend("/"+findJamName(portname, MidiChannel)+"/noteon "+str(msg[1])+" "+str(msg[2]))
|
wssend("/"+findJamName(portname, MidiChannel)+"/noteon "+str(msg[1])+" "+str(msg[2]))
|
||||||
|
|
||||||
'''
|
'''
|
||||||
@ -174,15 +255,15 @@ def MidinProcess(inqueue, portname):
|
|||||||
# Note Off or Note with 0 velocity on all midi channels
|
# Note Off or Note with 0 velocity on all midi channels
|
||||||
if NOTE_OFF -1 < msg[0] < 145 or (NOTE_OFF -1 < msg[0] < 160 and msg[2] == 0):
|
if NOTE_OFF -1 < msg[0] < 145 or (NOTE_OFF -1 < msg[0] < 160 and msg[2] == 0):
|
||||||
|
|
||||||
print(NOTE_OFF)
|
print(GetTime(),"NOTE_OFF :",NOTE_OFF)
|
||||||
if msg[0] > 143:
|
if msg[0] > 143:
|
||||||
MidiChannel = msg[0]-144
|
MidiChannel = msg[0]-144
|
||||||
else:
|
else:
|
||||||
MidiChannel = msg[0]-128
|
MidiChannel = msg[0]-128
|
||||||
|
|
||||||
print("NOTE OFF :", MidiNote, 'velocity :', MidiVel, "Channel", MidiChannel)
|
print(GetTime(),"NOTE OFF :", MidiNote, 'velocity :', MidiVel, "Channel", MidiChannel)
|
||||||
#NoteOff(msg[1],msg[2], mididest)
|
#NoteOff(msg[1],msg[2], mididest)
|
||||||
print("Midi in process send /"+findJamName(portname, MidiChannel)+"/noteoff "+str(msg[1]))
|
print(GetTime(),"Midi in process send /"+findJamName(portname, MidiChannel)+"/noteoff "+str(msg[1]))
|
||||||
wssend("/"+findJamName(portname, MidiChannel)+"/noteoff "+str(msg[1]))
|
wssend("/"+findJamName(portname, MidiChannel)+"/noteoff "+str(msg[1]))
|
||||||
|
|
||||||
|
|
||||||
@ -191,8 +272,8 @@ def MidinProcess(inqueue, portname):
|
|||||||
|
|
||||||
MidiChannel = msg[0]-175
|
MidiChannel = msg[0]-175
|
||||||
#findJamName(portname, MidiChannel)
|
#findJamName(portname, MidiChannel)
|
||||||
print("channel", MidiChannel, " ",findJamName(portname, MidiChannel), " CC :", msg[1], msg[2])
|
print(GetTime(),"channel", MidiChannel, " ",findJamName(portname, MidiChannel), " CC :", msg[1], msg[2])
|
||||||
print("Midi in process send /"+findJamName(portname, MidiChannel)+"/cc/"+str(msg[1])+" "+str(msg[2])+" to WS")
|
print(GetTime(),"Midi in process send /"+findJamName(portname, MidiChannel)+"/cc/"+str(msg[1])+" "+str(msg[2])+" to WS")
|
||||||
wssend("/"+findJamName(portname, MidiChannel)+"/cc/"+str(msg[1])+" "+str(msg[2]))
|
wssend("/"+findJamName(portname, MidiChannel)+"/cc/"+str(msg[1])+" "+str(msg[2]))
|
||||||
|
|
||||||
|
|
||||||
@ -290,7 +371,7 @@ class OutObject():
|
|||||||
self._instances.add(weakref.ref(self))
|
self._instances.add(weakref.ref(self))
|
||||||
OutObject.counter += 1
|
OutObject.counter += 1
|
||||||
|
|
||||||
print("Adding OutDevice name", self.name, "kind", self.kind, "port", self.port)
|
print(GetTime(),"Adding OutDevice name", self.name, "kind", self.kind, "port", self.port)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getinstances(cls):
|
def getinstances(cls):
|
||||||
@ -314,8 +395,8 @@ def OutConfig():
|
|||||||
#
|
#
|
||||||
if len(OutDevice) == 0:
|
if len(OutDevice) == 0:
|
||||||
print("")
|
print("")
|
||||||
print("MIDIout...")
|
print(GetTime(),"MIDIout...")
|
||||||
print("List and attach to available devices on host with IN port :")
|
print(GetTime(),"List and attach to available devices on host with IN port :")
|
||||||
|
|
||||||
# Display list of available midi IN devices on the host, create and start an OUT instance to talk to each of these Midi IN devices
|
# Display list of available midi IN devices on the host, create and start an OUT instance to talk to each of these Midi IN devices
|
||||||
midiout = rtmidi.MidiOut()
|
midiout = rtmidi.MidiOut()
|
||||||
@ -331,7 +412,7 @@ def OutConfig():
|
|||||||
OutDevice.append(OutObject(name, "generic", port))
|
OutDevice.append(OutObject(name, "generic", port))
|
||||||
|
|
||||||
#print "")
|
#print "")
|
||||||
print(len(OutDevice), "Out devices")
|
print(GetTime(),len(OutDevice), "Out devices")
|
||||||
#ListOutDevice()
|
#ListOutDevice()
|
||||||
MidInsNumber = len(OutDevice)+1
|
MidInsNumber = len(OutDevice)+1
|
||||||
|
|
||||||
@ -339,7 +420,7 @@ def ListOutDevice():
|
|||||||
|
|
||||||
for item in OutObject.getinstances():
|
for item in OutObject.getinstances():
|
||||||
|
|
||||||
print(item.name)
|
print(GetTime(),item.name)
|
||||||
|
|
||||||
def FindOutDevice(name):
|
def FindOutDevice(name):
|
||||||
|
|
||||||
@ -355,14 +436,14 @@ def FindOutDevice(name):
|
|||||||
def DelOutDevice(name):
|
def DelOutDevice(name):
|
||||||
|
|
||||||
Outnumber = Findest(name)
|
Outnumber = Findest(name)
|
||||||
print('deleting OutDevice', name)
|
print(GetTime(),'deleting OutDevice', name)
|
||||||
|
|
||||||
if Outnumber != -1:
|
if Outnumber != -1:
|
||||||
print('found OutDevice', Outnumber)
|
print(GetTime(),'found OutDevice', Outnumber)
|
||||||
delattr(OutObject, str(name))
|
delattr(OutObject, str(name))
|
||||||
print("OutDevice", Outnumber,"was removed")
|
print(GetTime(),"OutDevice", Outnumber,"was removed")
|
||||||
else:
|
else:
|
||||||
print("OutDevice was not found")
|
print(GetTime(),"OutDevice was not found")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -387,7 +468,7 @@ class InObject():
|
|||||||
self._instances.add(weakref.ref(self))
|
self._instances.add(weakref.ref(self))
|
||||||
InObject.counter += 1
|
InObject.counter += 1
|
||||||
|
|
||||||
print("Adding InDevice name", self.name, "kind", self.kind, "port", self.port)
|
print(GetTime(),"Adding InDevice name", self.name, "kind", self.kind, "port", self.port)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getinstances(cls):
|
def getinstances(cls):
|
||||||
@ -407,16 +488,16 @@ class InObject():
|
|||||||
def InConfig():
|
def InConfig():
|
||||||
|
|
||||||
print("")
|
print("")
|
||||||
print("MIDIin...")
|
print(GetTime(),"MIDIin...")
|
||||||
|
|
||||||
# client mode
|
# client mode
|
||||||
if debug > 0:
|
if debug > 0:
|
||||||
if clientmode == True:
|
if clientmode == True:
|
||||||
print("midi3 in client mode")
|
print(GetTime(),"midi3 in client mode")
|
||||||
else:
|
else:
|
||||||
print("midi3 in server mode")
|
print(GetTime(),"midi3 in server mode")
|
||||||
|
|
||||||
print("List and attach to available devices on host with OUT port :")
|
print(GetTime(),"List and attach to available devices on host with OUT port :")
|
||||||
|
|
||||||
if platform == 'darwin':
|
if platform == 'darwin':
|
||||||
mido.set_backend('mido.backends.rtmidi/MACOSX_CORE')
|
mido.set_backend('mido.backends.rtmidi/MACOSX_CORE')
|
||||||
@ -437,7 +518,7 @@ def InConfig():
|
|||||||
try:
|
try:
|
||||||
#print name, name.find("RtMidi output"))
|
#print name, name.find("RtMidi output"))
|
||||||
if name.find("RtMidi output") > -1:
|
if name.find("RtMidi output") > -1:
|
||||||
print("No thread started for device", name)
|
print(GetTime(),"No thread started for device", name)
|
||||||
else:
|
else:
|
||||||
portin = object
|
portin = object
|
||||||
port_name = ""
|
port_name = ""
|
||||||
@ -460,7 +541,7 @@ def InConfig():
|
|||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
#print "")
|
#print "")
|
||||||
print(InObject.counter, "In devices")
|
print(GetTime(),InObject.counter, "In devices")
|
||||||
#ListInDevice()
|
#ListInDevice()
|
||||||
|
|
||||||
|
|
||||||
@ -469,7 +550,7 @@ def ListInDevice():
|
|||||||
#print "known IN devices :"
|
#print "known IN devices :"
|
||||||
for item in InObject.getinstances():
|
for item in InObject.getinstances():
|
||||||
|
|
||||||
print(item.name)
|
print(GetTime(),item.name)
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
def FindInDevice(name):
|
def FindInDevice(name):
|
||||||
@ -486,14 +567,14 @@ def FindInDevice(name):
|
|||||||
def DelInDevice(name):
|
def DelInDevice(name):
|
||||||
|
|
||||||
Innumber = Findest(name)
|
Innumber = Findest(name)
|
||||||
print('deleting InDevice', name)
|
print(GetTime(),'deleting InDevice', name)
|
||||||
|
|
||||||
if Innumber != -1:
|
if Innumber != -1:
|
||||||
print('found InDevice', Innumber)
|
print(GetTime(),'found InDevice', Innumber)
|
||||||
delattr(InObject, str(name))
|
delattr(InObject, str(name))
|
||||||
print("InDevice", Innumber,"was removed")
|
print(GetTime(),"InDevice", Innumber,"was removed")
|
||||||
else:
|
else:
|
||||||
print("InDevice was not found")
|
print(GetTime(),"InDevice was not found")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -517,18 +598,18 @@ def MidiMsg(midimsg, mididest):
|
|||||||
|
|
||||||
desterror = -1
|
desterror = -1
|
||||||
|
|
||||||
print("jamidi3 got midimsg", midimsg, "for", mididest)
|
print(GetTime(),"jamidi3 got midimsg", midimsg, "for", mididest)
|
||||||
|
|
||||||
for port in range(len(OutDevice)):
|
for port in range(len(OutDevice)):
|
||||||
# To mididest
|
# To mididest
|
||||||
if midiname[port].find(mididest) != -1:
|
if midiname[port].find(mididest) != -1:
|
||||||
if debug>0:
|
if debug>0:
|
||||||
print("jamidi 3 sending to name", midiname[port], "port", port, ":", midimsg)
|
print(GetTime(),"jamidi 3 sending to name", midiname[port], "port", port, ":", midimsg)
|
||||||
midiport[port].send_message(midimsg)
|
midiport[port].send_message(midimsg)
|
||||||
desterror = 0
|
desterror = 0
|
||||||
|
|
||||||
if desterror == -1:
|
if desterror == -1:
|
||||||
print("mididest",mididest, ": ** This midi destination doesn't exists **")
|
print(GetTime(),"mididest",mididest, ": ** This midi destination doesn't exists **")
|
||||||
|
|
||||||
# send midi msg over ws.
|
# send midi msg over ws.
|
||||||
#if clientmode == True:
|
#if clientmode == True:
|
||||||
@ -566,7 +647,7 @@ def findJamName(mididevice, midichan):
|
|||||||
|
|
||||||
#print(v[0]["mididevice"],v[0]["midichan"], type(v[0]["midichan"]))
|
#print(v[0]["mididevice"],v[0]["midichan"], type(v[0]["midichan"]))
|
||||||
if (v[0]["mididevice"] == mididevice) and (v[0]["midichan"] == midichan):
|
if (v[0]["mididevice"] == mididevice) and (v[0]["midichan"] == midichan):
|
||||||
print("Incoming event from", k, "xname", v[0]["xname"])
|
print(GetTime(),"Incoming event from", k, "xname", v[0]["xname"])
|
||||||
return v[0]["xname"]
|
return v[0]["xname"]
|
||||||
return "None"
|
return "None"
|
||||||
|
|
||||||
@ -575,7 +656,7 @@ def findJamName(mididevice, midichan):
|
|||||||
def findJamDevices(name):
|
def findJamDevices(name):
|
||||||
|
|
||||||
devices = []
|
devices = []
|
||||||
print ("searching", name)
|
print (GetTime(),"searching", name)
|
||||||
for (k, v) in Confs.items():
|
for (k, v) in Confs.items():
|
||||||
|
|
||||||
if v[0]["type"] == "mididevice":
|
if v[0]["type"] == "mididevice":
|
||||||
|
9
main.py
9
main.py
@ -58,7 +58,7 @@ argsparser.set_defaults(broadcast=True)
|
|||||||
|
|
||||||
args = argsparser.parse_args()
|
args = argsparser.parse_args()
|
||||||
|
|
||||||
# Mode
|
# Server name
|
||||||
if args.servername:
|
if args.servername:
|
||||||
servername = args.servername
|
servername = args.servername
|
||||||
else:
|
else:
|
||||||
@ -201,7 +201,12 @@ def new_client(client, wserver):
|
|||||||
|
|
||||||
Players+=1
|
Players+=1
|
||||||
sendWSall("/status Hello %d" %(client['id']))
|
sendWSall("/status Hello %d" %(client['id']))
|
||||||
sendWSall("/players %d" %(Players))
|
if Players > 1:
|
||||||
|
#sendWSall("/players %d" %(Players))
|
||||||
|
sendWSall("/players (players:%d)" %(Players))
|
||||||
|
else:
|
||||||
|
sendWSall("/players (player:%d)" %(Players))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Called for every WS client disconnecting
|
# Called for every WS client disconnecting
|
||||||
|
BIN
web/.DS_Store
vendored
BIN
web/.DS_Store
vendored
Binary file not shown.
BIN
web/knobs/.DS_Store
vendored
BIN
web/knobs/.DS_Store
vendored
Binary file not shown.
BIN
web/knobs/load.png
Normal file
BIN
web/knobs/load.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
web/knobs/save.png
Normal file
BIN
web/knobs/save.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
162
web/mmo3.html
162
web/mmo3.html
@ -28,6 +28,12 @@
|
|||||||
color: #ccc;
|
color: #ccc;
|
||||||
font-size: 2ex;
|
font-size: 2ex;
|
||||||
}
|
}
|
||||||
|
#smalltext{
|
||||||
|
font-family: "Lucida Grande", Verdana, Arial, sans-serif;
|
||||||
|
text-align: center;
|
||||||
|
color: #ccc;
|
||||||
|
font-size: 1.6ex;
|
||||||
|
}
|
||||||
.encoders{
|
.encoders{
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
@ -93,7 +99,7 @@
|
|||||||
Buttons Line
|
Buttons Line
|
||||||
|
|
||||||
<div></div>
|
<div></div>
|
||||||
<div class="buttons-container" id="text">
|
<div class="buttons-container" id="smalltext">
|
||||||
<div>
|
<div>
|
||||||
<webaudio-switch id="select" value="1" height="35" width="100" tooltip="Switch-B" src="knobs/select.png" type="toggle" onclick="socket.emit('message', '/select');"></webaudio-switch>
|
<webaudio-switch id="select" value="1" height="35" width="100" tooltip="Switch-B" src="knobs/select.png" type="toggle" onclick="socket.emit('message', '/select');"></webaudio-switch>
|
||||||
</div>
|
</div>
|
||||||
@ -119,22 +125,22 @@
|
|||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/0" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/0" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">FQ -0</div>
|
<div id="smalltext">FQ -0</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/1" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/1" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">Mod 1 -1</div>
|
<div id="smalltext">Mod 1 -1</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/2" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/2" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">Mod 2 -2</div>
|
<div id="smalltext">Mod 2 -2</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/3" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/3" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">Mod 3 -3</div>
|
<div id="smalltext">Mod 3 -3</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -147,22 +153,22 @@
|
|||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/5" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/5" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">FQ -5</div>
|
<div id="smalltext">FQ -5</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/6" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/6" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">Mod 1 -6</div>
|
<div id="smalltext">Mod 1 -6</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/7" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/7" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">Mod 2 -7</div>
|
<div id="smalltext">Mod 2 -7</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/8" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/8" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">Mod 3 -8</div>
|
<div id="smalltext">Mod 3 -8</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -175,22 +181,22 @@
|
|||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/9" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/9" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">FQ -9</div>
|
<div id="smalltext">FQ -9</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/10" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/10" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">Mod 1 -10</div>
|
<div id="smalltext">Mod 1 -10</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/11" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/11" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">Mod 2 -11</div>
|
<div id="smalltext">Mod 2 -11</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/12" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/12" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">Mod 3 -12</div>
|
<div id="smalltext">Mod 3 -12</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- LFO 1 vertical Grid -->
|
<!-- LFO 1 vertical Grid -->
|
||||||
@ -201,22 +207,22 @@
|
|||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/13" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/13" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">FQ -13</div>
|
<div id="smalltext">FQ -13</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/14" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/14" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">WF -14</div>
|
<div id="smalltext">WF -14</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/15" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/15" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">SYM -15</div>
|
<div id="smalltext">SYM -15</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/16" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/16" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">ATTACK -16</div>
|
<div id="smalltext">ATTACK -16</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -228,22 +234,22 @@
|
|||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/17" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/17" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">FQ 1 -17</div>
|
<div id="smalltext">FQ 1 -17</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/18" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/18" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">FQ 2 -18</div>
|
<div id="smalltext">FQ 2 -18</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/19" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/19" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">MOD -19</div>
|
<div id="smalltext">MOD -19</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/20" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/20" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">DECAY -20</div>
|
<div id="smalltext">DECAY -20</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -255,22 +261,22 @@
|
|||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/21" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/21" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">FQ -21</div>
|
<div id="smalltext">FQ -21</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/22" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/22" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">Param 1 -22</div>
|
<div id="smalltext">Param 1 -22</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/23" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/23" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">Param 2 -23</div>
|
<div id="smalltext">Param 2 -23</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/24" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/24" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">SUSTAIN -24</div>
|
<div id="smalltext">SUSTAIN -24</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -282,22 +288,22 @@
|
|||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/25" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/25" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">OSC 1 -25</div>
|
<div id="smalltext">OSC 1 -25</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/26" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/26" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">OSC 2 -26</div>
|
<div id="smalltext">OSC 2 -26</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/27" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/27" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">OSC 3 -27</div>
|
<div id="smalltext">OSC 3 -27</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/28" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/28" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">RELEASE -28</div>
|
<div id="smalltext">RELEASE -28</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -309,7 +315,7 @@
|
|||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="mmo3/cc/29" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="mmo3/cc/29" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">VOL -29</div>
|
<div id="smalltext">VOL -29</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
@ -330,14 +336,24 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div align ="center" class="encoders">
|
||||||
|
<webaudio-switch id="store" value="1" height="45" width="45" tooltip="Switch-B" src="knobs/save.png" type="toggle"></webaudio-switch>
|
||||||
|
<webaudio-switch id="load" value="1" height="45" width="45" tooltip="Switch-B" src="knobs/load.png" type="toggle"></webaudio-switch>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="title" align ="center" style="font-family: 'Lucida Grande', Verdana, Arial, sans-serif;
|
||||||
|
text-align: center;color: #ddd;font-size: 2ex;">
|
||||||
|
<a href="ocs2.html">OCS-2</a>
|
||||||
|
<span id="players"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- LJ style WS : A nettoyer ! -->
|
<!-- LJ style WS : A nettoyer ! -->
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
<!-- var LJ = 'ws://xrkia.org:8081/' -->
|
var LJ = 'ws://xrkia.org:8081/'
|
||||||
<!-- var LJ = 'ws://laser.teamlaser.fr:8081/' -->
|
<!-- var LJ = 'ws://laser.teamlaser.fr:8081/' -->
|
||||||
var LJ = 'ws://127.0.0.1:8081/'
|
<!-- var LJ = 'ws://127.0.0.1:8081/' -->
|
||||||
var _WS = {
|
var _WS = {
|
||||||
uri: LJ,
|
uri: LJ,
|
||||||
ws: null,
|
ws: null,
|
||||||
@ -363,7 +379,7 @@
|
|||||||
|
|
||||||
onMessage: function (e) {
|
onMessage: function (e) {
|
||||||
var res = e.data.split(" ");
|
var res = e.data.split(" ");
|
||||||
console.log(e.data)
|
//console.log(e.data)
|
||||||
//console.log(res[0].substring(0,6))
|
//console.log(res[0].substring(0,6))
|
||||||
//console.log(res)
|
//console.log(res)
|
||||||
//console.log(res[0].slice(1))
|
//console.log(res[0].slice(1))
|
||||||
@ -377,8 +393,11 @@
|
|||||||
divtext.innerHTML="MMO-3";
|
divtext.innerHTML="MMO-3";
|
||||||
break;
|
break;
|
||||||
case "/playe":
|
case "/playe":
|
||||||
divtext.innerHTML="MMO-3 ("+res[1]+" player(s))";
|
//divtext.innerHTML="OCS-2 ("+res[1]+" player(s))";
|
||||||
divtextp.innerHTML=" ("+res[1]+" player(s))";
|
//divtextp.innerHTML=" ("+res[1]+" player(s))";
|
||||||
|
divtext.innerHTML="MMO-3 "+res[1];
|
||||||
|
divtextp.innerHTML=" "+res[1];
|
||||||
|
//console.log(res)
|
||||||
break;
|
break;
|
||||||
case "/simul":
|
case "/simul":
|
||||||
pl = e.data.slice(7);
|
pl = e.data.slice(7);
|
||||||
@ -389,8 +408,20 @@
|
|||||||
//console.log("plpoint");
|
//console.log("plpoint");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log("test "+res[0].slice(1)+" "+res[1]);
|
//console.log(e);
|
||||||
document.getElementById(res[0].slice(1)).value = res[1];
|
//console.log(res[0].slice(1))
|
||||||
|
//console.log(document.getElementById(res[0].slice(1)));
|
||||||
|
//console.log(res[0].slice(1)+" "+res[1])
|
||||||
|
//let documentX = document.getElementById(res[0].slice(1));
|
||||||
|
//documentX.value=res[1];
|
||||||
|
|
||||||
|
//document.getElementById(res[0].slice(1)).value = res[1];
|
||||||
|
document.getElementById(res[0].slice(1)).setAttribute('value',res[1]);
|
||||||
|
//document.getElementById(res[0].slice(1)).setValue(res[1],true);
|
||||||
|
document.getElementById(res[0].slice(1)).setValue(res[1],false);
|
||||||
|
|
||||||
|
//console.log(documentX.value)
|
||||||
|
//console.log(document.getElementById(res[0].slice(1)));
|
||||||
_WS.showin(e.data);
|
_WS.showin(e.data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -447,6 +478,7 @@
|
|||||||
var message="";
|
var message="";
|
||||||
var log=[];
|
var log=[];
|
||||||
var knobs = document.getElementsByTagName('webaudio-knob');
|
var knobs = document.getElementsByTagName('webaudio-knob');
|
||||||
|
var knobState = []
|
||||||
|
|
||||||
for(var i = 0; i < knobs.length; i++){
|
for(var i = 0; i < knobs.length; i++){
|
||||||
knobs[i].addEventListener("input",Dump,false);
|
knobs[i].addEventListener("input",Dump,false);
|
||||||
@ -467,7 +499,7 @@
|
|||||||
function Dump(e) {
|
function Dump(e) {
|
||||||
var str="";
|
var str="";
|
||||||
str=e.type + " : " + e.target.id + " : " + e.target.value + " ";
|
str=e.type + " : " + e.target.id + " : " + e.target.value + " ";
|
||||||
console.log(str);
|
//console.log(str);
|
||||||
log.unshift(str);
|
log.unshift(str);
|
||||||
log.length=1;
|
log.length=1;
|
||||||
str="";
|
str="";
|
||||||
@ -476,6 +508,53 @@
|
|||||||
if(log[i])
|
if(log[i])
|
||||||
str+=log[i]+"<br/>";
|
str+=log[i]+"<br/>";
|
||||||
}
|
}
|
||||||
|
//var evview=document.getElementById("events");
|
||||||
|
//evview.innerHTML=str;
|
||||||
|
//console.log( e.type + "/" + e.target.id + "/" + e.target.value);
|
||||||
|
//console.log('/' + e.target.id + ' ' + e.target.value + ' ' + e.type);
|
||||||
|
//socket.emit('message', '/' + e.target.id + ' ' + e.target.value);
|
||||||
|
|
||||||
|
if (e.target.id === "load" || e.target.id === "store") {
|
||||||
|
|
||||||
|
if (e.type === "change") {
|
||||||
|
|
||||||
|
if (e.target.id === "store") {
|
||||||
|
//var knobState = []
|
||||||
|
//var knobs = document.getElementsByTagName('webaudio-knob');
|
||||||
|
for (var i = 0; i < knobs.length; i++) {
|
||||||
|
var knob = knobs[i] ;
|
||||||
|
//console.log(knob) ;
|
||||||
|
knobState[i] = knob.getAttribute('id')+" "+knob.getAttribute('value') ;
|
||||||
|
localStorage.setItem(knob.getAttribute('id'),knob.getAttribute('value')) ;
|
||||||
|
}
|
||||||
|
//console.log(knobState) ;
|
||||||
|
console.log('store clique') ;
|
||||||
|
}
|
||||||
|
if (e.target.id === "load") {
|
||||||
|
if (knobState.length > 0) {
|
||||||
|
for (var i = 0; i < knobState.length; i++) {
|
||||||
|
ccstate=knobState[i] ;
|
||||||
|
_WS.send("/" + ccstate) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (var i = 0; i < knobs.length; i++) {
|
||||||
|
var knob = knobs[i];
|
||||||
|
var value = localStorage.getItem(knob.getAttribute('id'));
|
||||||
|
if ( value != null) {
|
||||||
|
ccstate = knob.getAttribute('id')+" "+value;
|
||||||
|
_WS.send("/" + ccstate) ;
|
||||||
|
console.log(ccstate) ;
|
||||||
|
}
|
||||||
|
else console.log("no localstorage");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('load clique') ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
_WS.send("/" + e.target.id + " " + e.target.value);
|
_WS.send("/" + e.target.id + " " + e.target.value);
|
||||||
|
|
||||||
@ -495,12 +574,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<div id="title" align ="center" style="font-family: 'Lucida Grande', Verdana, Arial, sans-serif;
|
|
||||||
text-align: center;color: #ddd;font-size: 2ex;">
|
|
||||||
<a href="ocs2.html">OCS-2</a>
|
|
||||||
<span id="players"></span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
169
web/ocs2.html
169
web/ocs2.html
@ -28,6 +28,12 @@
|
|||||||
color: #ccc;
|
color: #ccc;
|
||||||
font-size: 2ex;
|
font-size: 2ex;
|
||||||
}
|
}
|
||||||
|
#smalltext{
|
||||||
|
font-family: "Lucida Grande", Verdana, Arial, sans-serif;
|
||||||
|
text-align: center;
|
||||||
|
color: #ccc;
|
||||||
|
font-size: 1.6ex;
|
||||||
|
}
|
||||||
.encoders{
|
.encoders{
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
@ -93,7 +99,7 @@
|
|||||||
Buttons Line
|
Buttons Line
|
||||||
|
|
||||||
<div></div>
|
<div></div>
|
||||||
<div class="buttons-container" id="text">
|
<div class="buttons-container" id="smalltext">
|
||||||
<div>
|
<div>
|
||||||
<webaudio-switch id="select" value="1" height="35" width="100" tooltip="Switch-B" src="knobs/select.png" type="toggle" onclick="socket.emit('message', '/select');"></webaudio-switch>
|
<webaudio-switch id="select" value="1" height="35" width="100" tooltip="Switch-B" src="knobs/select.png" type="toggle" onclick="socket.emit('message', '/select');"></webaudio-switch>
|
||||||
</div>
|
</div>
|
||||||
@ -119,22 +125,22 @@
|
|||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/0" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/0" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">FQ -0</div>
|
<div id="smalltext">FQ -0</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/1" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/1" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">WF -1</div>
|
<div id="smalltext">WF -1</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/2" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/2" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">Mod 1 -2</div>
|
<div id="smalltext">Mod 1 -2</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/3" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/3" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">Mod 2 -3</div>
|
<div id="smalltext">Mod 2 -3</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -147,22 +153,22 @@
|
|||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/5" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/5" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">FQ -5</div>
|
<div id="smalltext">FQ -5</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/6" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/6" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">WF -6</div>
|
<div id="smalltext">WF -6</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/7" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/7" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">Mod 1 -7</div>
|
<div id="smalltext">Mod 1 -7</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/8" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/8" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">Mod 2 -8</div>
|
<div id="smalltext">Mod 2 -8</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -175,22 +181,22 @@
|
|||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/9" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/9" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">FQ -9</div>
|
<div id="smalltext">FQ -9</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/10" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/10" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">Q -10</div>
|
<div id="smalltext">Q -10</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/11" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/11" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">Mod 1 -11</div>
|
<div id="smalltext">Mod 1 -11</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/12" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/12" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">Mod 2 -12</div>
|
<div id="smalltext">Mod 2 -12</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- LFO 1 vertical Grid -->
|
<!-- LFO 1 vertical Grid -->
|
||||||
@ -201,22 +207,22 @@
|
|||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/13" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/13" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">FQ -13</div>
|
<div id="smalltext">FQ -13</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/14" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/14" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">WF -14</div>
|
<div id="smalltext">WF -14</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/15" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/15" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">SYM -15</div>
|
<div id="smalltext">SYM -15</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/16" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/16" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">ATTACK -16</div>
|
<div id="smalltext">ATTACK -16</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -228,22 +234,22 @@
|
|||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/17" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/17" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">FQ -17</div>
|
<div id="smalltext">FQ -17</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/18" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/18" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">WF -18</div>
|
<div id="smalltext">WF -18</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/19" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/19" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">SYM -19</div>
|
<div id="smalltext">SYM -19</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/20" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/20" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">DECAY -20</div>
|
<div id="smalltext">DECAY -20</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -255,22 +261,22 @@
|
|||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/21" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/21" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">FQ -21</div>
|
<div id="smalltext">FQ -21</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/22" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/22" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">MOD -22</div>
|
<div id="smalltext">MOD -22</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/23" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/23" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">WET EFFECT -23</div>
|
<div id="smalltext">WET EFFECT -23</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/24" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/24" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">SUSTAIN -24</div>
|
<div id="smalltext">SUSTAIN -24</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -282,22 +288,22 @@
|
|||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/25" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/25" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">PARAM 1 -25</div>
|
<div id="smalltext">PARAM 1 -25</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/26" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/26" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">PARAM 2 -26</div>
|
<div id="smalltext">PARAM 2 -26</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/27" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/27" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">MOD EFFECT -27</div>
|
<div id="smalltext">MOD EFFECT -27</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/28" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/28" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">RELEASE -28</div>
|
<div id="smalltext">RELEASE -28</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -309,17 +315,17 @@
|
|||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/29" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/29" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">MIX 1/2 -29</div>
|
<div id="smalltext">MIX 1/2 -29</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/30" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/30" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">MOD -30</div>
|
<div id="smalltext">MOD -30</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<div><webaudio-knob id="ocs2/cc/31" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
<div><webaudio-knob id="ocs2/cc/31" diameter="70" min="0" max="127" value="64"></webaudio-knob> </div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div id="text">VOL -31</div>
|
<div id="smalltext">VOL -31</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="encoders">
|
<div class="encoders">
|
||||||
<webaudio-switch id="ocs2/reset" value="1" height="70" width="70" tooltip="Switch-B" src="knobs/rebuild.png" type="toggle"></webaudio-switch>
|
<webaudio-switch id="ocs2/reset" value="1" height="70" width="70" tooltip="Switch-B" src="knobs/rebuild.png" type="toggle"></webaudio-switch>
|
||||||
@ -334,14 +340,24 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div align ="center" class="encoders">
|
||||||
|
<webaudio-switch id="store" value="1" height="45" width="45" tooltip="Switch-B" src="knobs/save.png" type="toggle"></webaudio-switch>
|
||||||
|
<webaudio-switch id="load" value="1" height="45" width="45" tooltip="Switch-B" src="knobs/load.png" type="toggle"></webaudio-switch>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="title" align ="center" style="font-family: 'Lucida Grande', Verdana, Arial, sans-serif;
|
||||||
|
text-align: center;color: #ddd;font-size: 2ex;">
|
||||||
|
<a href="mmo3.html">MMO-3</a>
|
||||||
|
<span id="players"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- LJ style WS : A nettoyer ! -->
|
<!-- LJ style WS : A nettoyer ! -->
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
<!-- var LJ = 'ws://xrkia.org:8081/' -->
|
var LJ = 'ws://xrkia.org:8081/'
|
||||||
<!-- var LJ = 'ws://laser.teamlaser.fr:8081/' -->
|
<!-- var LJ = 'ws://laser.teamlaser.fr:8081/' -->
|
||||||
var LJ = 'ws://127.0.0.1:8081/'
|
<!-- var LJ = 'ws://127.0.0.1:8081/' -->
|
||||||
var _WS = {
|
var _WS = {
|
||||||
uri: LJ,
|
uri: LJ,
|
||||||
ws: null,
|
ws: null,
|
||||||
@ -367,7 +383,7 @@
|
|||||||
|
|
||||||
onMessage: function (e) {
|
onMessage: function (e) {
|
||||||
var res = e.data.split(" ");
|
var res = e.data.split(" ");
|
||||||
console.log(e.data)
|
//console.log(e.data)
|
||||||
//console.log(res[0].substring(0,6))
|
//console.log(res[0].substring(0,6))
|
||||||
//console.log(res)
|
//console.log(res)
|
||||||
//console.log(res[0].slice(1))
|
//console.log(res[0].slice(1))
|
||||||
@ -381,20 +397,27 @@
|
|||||||
divtext.innerHTML="OCS-2";
|
divtext.innerHTML="OCS-2";
|
||||||
break;
|
break;
|
||||||
case "/playe":
|
case "/playe":
|
||||||
divtext.innerHTML="OCS-2 ("+res[1]+" player(s))";
|
//divtext.innerHTML="OCS-2 ("+res[1]+" player(s))";
|
||||||
divtextp.innerHTML=" ("+res[1]+" player(s))";
|
//divtextp.innerHTML=" ("+res[1]+" player(s))";
|
||||||
break;
|
divtext.innerHTML="OCS-2 "+res[1];
|
||||||
case "/simul":
|
divtextp.innerHTML=" "+res[1];
|
||||||
pl = e.data.slice(7);
|
//console.log(res)
|
||||||
//console.log(pl)
|
|
||||||
pl2 = eval(pl.replace(/[()]/g, ''));
|
|
||||||
break;
|
|
||||||
case "/plpoi":
|
|
||||||
//console.log("plpoint");
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//console.log(e);
|
//console.log(e);
|
||||||
document.getElementById(res[0].slice(1)).value = res[1];
|
//console.log(res[0].slice(1))
|
||||||
|
//console.log(document.getElementById(res[0].slice(1)));
|
||||||
|
//console.log(res[0].slice(1)+" "+res[1])
|
||||||
|
//let documentX = document.getElementById(res[0].slice(1));
|
||||||
|
//documentX.value=res[1];
|
||||||
|
|
||||||
|
//document.getElementById(res[0].slice(1)).value = res[1];
|
||||||
|
document.getElementById(res[0].slice(1)).setAttribute('value',res[1]);
|
||||||
|
//document.getElementById(res[0].slice(1)).setValue(res[1],true);
|
||||||
|
document.getElementById(res[0].slice(1)).setValue(res[1],false);
|
||||||
|
|
||||||
|
//console.log(documentX.value)
|
||||||
|
//console.log(document.getElementById(res[0].slice(1)));
|
||||||
_WS.showin(e.data);
|
_WS.showin(e.data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -451,6 +474,7 @@
|
|||||||
var message="";
|
var message="";
|
||||||
var log=[];
|
var log=[];
|
||||||
var knobs = document.getElementsByTagName('webaudio-knob');
|
var knobs = document.getElementsByTagName('webaudio-knob');
|
||||||
|
var knobState = []
|
||||||
|
|
||||||
for(var i = 0; i < knobs.length; i++){
|
for(var i = 0; i < knobs.length; i++){
|
||||||
knobs[i].addEventListener("input",Dump,false);
|
knobs[i].addEventListener("input",Dump,false);
|
||||||
@ -471,7 +495,7 @@
|
|||||||
function Dump(e) {
|
function Dump(e) {
|
||||||
var str="";
|
var str="";
|
||||||
str=e.type + " : " + e.target.id + " : " + e.target.value + " ";
|
str=e.type + " : " + e.target.id + " : " + e.target.value + " ";
|
||||||
console.log(str);
|
//console.log(str);
|
||||||
log.unshift(str);
|
log.unshift(str);
|
||||||
log.length=1;
|
log.length=1;
|
||||||
str="";
|
str="";
|
||||||
@ -483,8 +507,51 @@
|
|||||||
//var evview=document.getElementById("events");
|
//var evview=document.getElementById("events");
|
||||||
//evview.innerHTML=str;
|
//evview.innerHTML=str;
|
||||||
//console.log( e.type + "/" + e.target.id + "/" + e.target.value);
|
//console.log( e.type + "/" + e.target.id + "/" + e.target.value);
|
||||||
//console.log('/' + e.target.id + ' ' + e.target.value);
|
//console.log('/' + e.target.id + ' ' + e.target.value + ' ' + e.type);
|
||||||
//socket.emit('message', '/' + e.target.id + ' ' + e.target.value);
|
//socket.emit('message', '/' + e.target.id + ' ' + e.target.value);
|
||||||
|
|
||||||
|
if (e.target.id === "load" || e.target.id === "store") {
|
||||||
|
|
||||||
|
if (e.type === "change") {
|
||||||
|
|
||||||
|
if (e.target.id === "store") {
|
||||||
|
//var knobState = []
|
||||||
|
//var knobs = document.getElementsByTagName('webaudio-knob');
|
||||||
|
for (var i = 0; i < knobs.length; i++) {
|
||||||
|
var knob = knobs[i] ;
|
||||||
|
//console.log(knob) ;
|
||||||
|
knobState[i] = knob.getAttribute('id')+" "+knob.getAttribute('value') ;
|
||||||
|
localStorage.setItem(knob.getAttribute('id'),knob.getAttribute('value')) ;
|
||||||
|
}
|
||||||
|
//console.log(knobState) ;
|
||||||
|
console.log('store clique') ;
|
||||||
|
}
|
||||||
|
if (e.target.id === "load") {
|
||||||
|
if (knobState.length > 0) {
|
||||||
|
for (var i = 0; i < knobState.length; i++) {
|
||||||
|
ccstate=knobState[i] ;
|
||||||
|
_WS.send("/" + ccstate) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (var i = 0; i < knobs.length; i++) {
|
||||||
|
var knob = knobs[i];
|
||||||
|
var value = localStorage.getItem(knob.getAttribute('id'));
|
||||||
|
if ( value != null) {
|
||||||
|
ccstate = knob.getAttribute('id')+" "+value;
|
||||||
|
_WS.send("/" + ccstate) ;
|
||||||
|
console.log(ccstate) ;
|
||||||
|
}
|
||||||
|
else console.log("no localstorage");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('load clique') ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
_WS.send("/" + e.target.id + " " + e.target.value);
|
_WS.send("/" + e.target.id + " " + e.target.value);
|
||||||
|
|
||||||
if (e.target.id === "on" && e.type === "change") {
|
if (e.target.id === "on" && e.type === "change") {
|
||||||
@ -503,13 +570,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="title" align ="center" style="font-family: 'Lucida Grande', Verdana, Arial, sans-serif;
|
|
||||||
text-align: center;color: #ddd;font-size: 2ex;">
|
|
||||||
<a href="mmo3.html">MMO-3</a>
|
|
||||||
<span id="players"></span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user