nodeskini 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/client/archive/bundle.js +11528 -0
- package/client/archive/golem.html +60 -0
- package/client/archive/golemClient.js +595 -0
- package/client/archive/golembundle.js +11634 -0
- package/client/archive/sequencer.html +43 -0
- package/client/archive/sequenceurClient.js +815 -0
- package/client/archive/stylegolem.css +158 -0
- package/client/archive/stylesequenceur.css +204 -0
- package/client/clientListe/Sortable-master/.circleci/config.yml +33 -0
- package/client/clientListe/Sortable-master/.editorconfig +15 -0
- package/client/clientListe/Sortable-master/.github/ISSUE_TEMPLATE/bug-report.md +73 -0
- package/client/clientListe/Sortable-master/.github/ISSUE_TEMPLATE/custom-template.md +48 -0
- package/client/clientListe/Sortable-master/.github/ISSUE_TEMPLATE/feature-request.md +41 -0
- package/client/clientListe/Sortable-master/.jshintrc +25 -0
- package/client/clientListe/Sortable-master/.testcaferc.json +7 -0
- package/client/clientListe/Sortable-master/CONTRIBUTING.md +26 -0
- package/client/clientListe/Sortable-master/LICENSE +21 -0
- package/client/clientListe/Sortable-master/README.md +813 -0
- package/client/clientListe/Sortable-master/Sortable.js +3709 -0
- package/client/clientListe/Sortable-master/Sortable.min.js +2 -0
- package/client/clientListe/Sortable-master/Sortable.min.old.js +2 -0
- package/client/clientListe/Sortable-master/Sortable.min.old.old.js +2 -0
- package/client/clientListe/Sortable-master/babel.config.js +27 -0
- package/client/clientListe/Sortable-master/bower.json +30 -0
- package/client/clientListe/Sortable-master/entry/entry-complete.js +8 -0
- package/client/clientListe/Sortable-master/entry/entry-core.js +19 -0
- package/client/clientListe/Sortable-master/entry/entry-defaults.js +19 -0
- package/client/clientListe/Sortable-master/index.html +460 -0
- package/client/clientListe/Sortable-master/modular/sortable.complete.esm.js +3701 -0
- package/client/clientListe/Sortable-master/modular/sortable.core.esm.js +3698 -0
- package/client/clientListe/Sortable-master/modular/sortable.esm.js +3699 -0
- package/client/clientListe/Sortable-master/package-lock.json +5704 -0
- package/client/clientListe/Sortable-master/package.json +56 -0
- package/client/clientListe/Sortable-master/plugins/AutoScroll/AutoScroll.js +270 -0
- package/client/clientListe/Sortable-master/plugins/AutoScroll/README.md +80 -0
- package/client/clientListe/Sortable-master/plugins/AutoScroll/index.js +1 -0
- package/client/clientListe/Sortable-master/plugins/MultiDrag/MultiDrag.js +617 -0
- package/client/clientListe/Sortable-master/plugins/MultiDrag/README.md +96 -0
- package/client/clientListe/Sortable-master/plugins/MultiDrag/index.js +1 -0
- package/client/clientListe/Sortable-master/plugins/OnSpill/OnSpill.js +79 -0
- package/client/clientListe/Sortable-master/plugins/OnSpill/README.md +60 -0
- package/client/clientListe/Sortable-master/plugins/OnSpill/index.js +1 -0
- package/client/clientListe/Sortable-master/plugins/README.md +178 -0
- package/client/clientListe/Sortable-master/plugins/Swap/README.md +55 -0
- package/client/clientListe/Sortable-master/plugins/Swap/Swap.js +90 -0
- package/client/clientListe/Sortable-master/plugins/Swap/index.js +1 -0
- package/client/clientListe/Sortable-master/scripts/banner.js +8 -0
- package/client/clientListe/Sortable-master/scripts/build.js +17 -0
- package/client/clientListe/Sortable-master/scripts/esm-build.js +28 -0
- package/client/clientListe/Sortable-master/scripts/minify.js +11 -0
- package/client/clientListe/Sortable-master/scripts/test-compat.js +30 -0
- package/client/clientListe/Sortable-master/scripts/test.js +21 -0
- package/client/clientListe/Sortable-master/scripts/umd-build.js +15 -0
- package/client/clientListe/Sortable-master/src/Animation.js +175 -0
- package/client/clientListe/Sortable-master/src/BrowserInfo.js +12 -0
- package/client/clientListe/Sortable-master/src/EventDispatcher.js +57 -0
- package/client/clientListe/Sortable-master/src/PluginManager.js +87 -0
- package/client/clientListe/Sortable-master/src/Sortable.js +1971 -0
- package/client/clientListe/Sortable-master/src/utils.js +556 -0
- package/client/clientListe/Sortable-master/st/app.js +224 -0
- package/client/clientListe/Sortable-master/st/iframe/frame.html +32 -0
- package/client/clientListe/Sortable-master/st/iframe/index.html +49 -0
- package/client/clientListe/Sortable-master/st/logo.png +0 -0
- package/client/clientListe/Sortable-master/st/og-image.png +0 -0
- package/client/clientListe/Sortable-master/st/prettify/prettify.css +1 -0
- package/client/clientListe/Sortable-master/st/prettify/prettify.js +46 -0
- package/client/clientListe/Sortable-master/st/prettify/run_prettify.js +64 -0
- package/client/clientListe/Sortable-master/st/saucelabs.svg +1 -0
- package/client/clientListe/Sortable-master/st/theme.css +254 -0
- package/client/clientListe/Sortable-master/tests/Sortable.compat.test.js +39 -0
- package/client/clientListe/Sortable-master/tests/Sortable.test.js +386 -0
- package/client/clientListe/Sortable-master/tests/dual-list.html +34 -0
- package/client/clientListe/Sortable-master/tests/empty-list.html +30 -0
- package/client/clientListe/Sortable-master/tests/filter.html +27 -0
- package/client/clientListe/Sortable-master/tests/handles.html +27 -0
- package/client/clientListe/Sortable-master/tests/nested.html +67 -0
- package/client/clientListe/Sortable-master/tests/single-list.html +25 -0
- package/client/clientListe/Sortable-master/tests/style.css +18 -0
- package/client/clientListe/clientListe.html +148 -0
- package/client/clientListe/clientListe.js +1508 -0
- package/client/clientListe/clientListebundle.js +13164 -0
- package/client/clientListe/images/poubelle.png +0 -0
- package/client/clientListe/images/start.png +0 -0
- package/client/clientListe/images/stop.png +0 -0
- package/client/clientListe/images/submit.png +0 -0
- package/client/clientListe/sortable-theme-bootstrap.css +90 -0
- package/client/configurateur/configReact.js +273 -0
- package/client/configurateur/configReactbundle.js +295 -0
- package/client/configurateur/configurateur.css +95 -0
- package/client/configurateur/configurateur.html +48 -0
- package/client/configurateur/lib/jexcel.css +755 -0
- package/client/configurateur/lib/jexcel.js +14970 -0
- package/client/configurateur/lib/jsuites.css +2801 -0
- package/client/configurateur/lib/jsuites.js +11822 -0
- package/client/configurateur/lib/react-dom.production.min.js +239 -0
- package/client/configurateur/lib/react.production.min.js +32 -0
- package/client/configurateur/src/configReact.js +247 -0
- package/client/controleur/clientcontroleur.js +536 -0
- package/client/controleur/clientcontroleur.test.js +282 -0
- package/client/controleur/controleur.html +51 -0
- package/client/controleur/controleurbundle.js +565 -0
- package/client/controleur/stylecontroleur.css +236 -0
- package/client/controleurHH/controleurHH.html +71 -0
- package/client/controleurHH/controleurHH.js +252 -0
- package/client/controleurHH/styles/index.css +320 -0
- package/client/controleurHH/styles/material.css +11552 -0
- package/client/parametrage/paramReact.js +473 -0
- package/client/parametrage/paramReactbundle.js +500 -0
- package/client/parametrage/parametrage.css +111 -0
- package/client/parametrage/parametrage.html +163 -0
- package/client/parametrage/src/paramReact.js +459 -0
- package/client/score/hash.js +83 -0
- package/client/score/p5.min.js +3 -0
- package/client/score/parto1.js +1171 -0
- package/client/score/parto1bundle.js +1181 -0
- package/client/score/processing.min.js +431 -0
- package/client/score/score.html +15 -0
- package/client/score/score.js +34 -0
- package/client/simulateurListe/simulateurFork.js +750 -0
- package/client/simulateurListe/simulateurFork.mjs +681 -0
- package/client/simulateurListe/simulateurForkSansReorg.js +569 -0
- package/client/simulateurListe/simulateurListe.js +628 -0
- package/myReact/archive/Nodeemitvaluedlocal1.hh.js +52 -0
- package/myReact/archive/abort-parNode.js +79 -0
- package/myReact/archive/abroNode.js +169 -0
- package/myReact/archive/abroNode2.js +80 -0
- package/myReact/archive/atom.compile.hh.js +51 -0
- package/myReact/archive/await-countNode.js +67 -0
- package/myReact/archive/await-nowvalNode.js +44 -0
- package/myReact/archive/callHH.js +96 -0
- package/myReact/archive/emit-if2.hh.compiled.js +113 -0
- package/myReact/archive/every1Node.js +35 -0
- package/myReact/archive/if-runNode.js +74 -0
- package/myReact/archive/if1Node.js +43 -0
- package/myReact/archive/makeawait.js +0 -0
- package/myReact/archive/myReact.old.js +684 -0
- package/myReact/archive/orchestration.js +281 -0
- package/myReact/archive/orchestration1.js +132 -0
- package/myReact/archive/orchestration1.xml +465 -0
- package/myReact/archive/orchestration2.js +161 -0
- package/myReact/archive/orchestrationHH.mano.js +280 -0
- package/myReact/archive/orchestrationHHTest.js +428 -0
- package/myReact/archive/orchestrationHHTest.xml +234 -0
- package/myReact/archive/orchestrationHHTestRun.js +104 -0
- package/myReact/archive/orchestrationHHTestRun.xml +34 -0
- package/myReact/archive/orchestrationTest0.js +178 -0
- package/myReact/archive/orchestrationTest1.js +181 -0
- package/myReact/archive/orchestrationTest2.js +281 -0
- package/myReact/archive/run3pointsNode.js +59 -0
- package/myReact/archive/runNode.js +123 -0
- package/myReact/archive/runNode2.js +91 -0
- package/myReact/archive/testAwait1.js +141 -0
- package/myReact/archive/testAwait1.xml +86 -0
- package/myReact/archive/testEvery1.js +122 -0
- package/myReact/archive/testEvery1.xml +79 -0
- package/myReact/archive/testHH1.js +135 -0
- package/myReact/archive/testHH1.xml +86 -0
- package/myReact/archive/testHH1revu.js +104 -0
- package/myReact/archive/testHH2.js +122 -0
- package/myReact/archive/testHH2.xml +79 -0
- package/myReact/archive/testHH3.js +130 -0
- package/myReact/archive/testHH3.xml +86 -0
- package/myReact/archive/testHHabort.js +121 -0
- package/myReact/archive/testHHabort.xml +83 -0
- package/myReact/archive/testMakeawait.js +202 -0
- package/myReact/archive/testRun1.js +168 -0
- package/myReact/archive/testRun1.xml +142 -0
- package/myReact/archive/titi.js +28 -0
- package/myReact/archive/titi.xml +110 -0
- package/myReact/archive/toto.js +73 -0
- package/myReact/archive/toto.xml +198 -0
- package/myReact/archive/trap-await-parallelNode.js +123 -0
- package/myReact/inutiles/hiver2022.xml +804 -0
- package/myReact/inutiles/hopeNode.xml +459 -0
- package/myReact/inutiles/mars2022.xml +871 -0
- package/myReact/inutiles/mystique1.xml +318 -0
- package/myReact/inutiles/mystiqueOSC.xml +277 -0
- package/myReact/inutiles/opus5Node.xml +1271 -0
- package/myReact/inutiles/opus5NodeLinux.xml +1241 -0
- package/myReact/inutiles/orchestrationHH.xml +541 -0
- package/myReact/inutiles/orchestrationHH2.xml +547 -0
- package/myReact/inutiles/testHH.xml +95 -0
- package/myReact/inutiles/trouveLaPercuTenor.xml +349 -0
- package/myReact/myReact.js +744 -0
- package/myReact/myReact.min.js +1 -0
- package/myReact/orchestrationHH.js +311 -0
- package/myReact/orchestrationHH.mjs +436 -0
- package/myReact/orchestrationHH.mjs.map +1 -0
- package/package.json +46 -0
- package/serveur/OSCandMidi.mjs +361 -0
- package/serveur/computeScore.mjs +415 -0
- package/serveur/controleDAW.mjs +1149 -0
- package/serveur/defaultSession.csv +2 -0
- package/serveur/defaultSkiniParametres.js +119 -0
- package/serveur/gameOSC.mjs +96 -0
- package/serveur/groupeClientsSons.mjs +1014 -0
- package/serveur/ipConfig.json +24 -0
- package/serveur/ipConfig127.json +19 -0
- package/serveur/ipConfig75.json +17 -0
- package/serveur/ipConfigBH.json +19 -0
- package/serveur/ipConfigLocal.json +19 -0
- package/serveur/midiConfig.json +26 -0
- package/serveur/midiConfigBH.json +26 -0
- package/serveur/midiConfigVoid.json +3 -0
- package/serveur/midimix.mjs +570 -0
- package/serveur/saveParam.mjs +159 -0
- package/serveur/skiniParametres.good.js +132 -0
- package/serveur/skiniParametres.js +106 -0
- package/serveur/utilsHHSkini.hh.js +64 -0
- package/serveur/utilsSkini.mjs +137 -0
- package/serveur/websocketServer.mjs +2052 -0
- package/serveur/workerInterfaceZ.mjs +327 -0
- package/serveur/workerSynchro.mjs +49 -0
- package/skini.mjs +141 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileOverview
|
|
3
|
+
* Worker to manage the Interface Z
|
|
4
|
+
* @author Bertrand Petit-Hédelin <bertrand@hedelin.fr>
|
|
5
|
+
* @copyright (C) 2022-2024 Bertrand Petit-Hédelin
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
* @version 1.4
|
|
20
|
+
*/
|
|
21
|
+
'use strict'
|
|
22
|
+
import { createRequire } from 'module';
|
|
23
|
+
const require = createRequire(import.meta.url);
|
|
24
|
+
|
|
25
|
+
import { parentPort } from 'worker_threads';
|
|
26
|
+
var osc = require('osc-min');
|
|
27
|
+
import * as dgram from "dgram";
|
|
28
|
+
var sockData; // = dgram.createSocket('udp4');
|
|
29
|
+
var sockMidi; // = dgram.createSocket('udp4');
|
|
30
|
+
var sockMiniWI;
|
|
31
|
+
|
|
32
|
+
var debug = true;
|
|
33
|
+
var debug1 = true;
|
|
34
|
+
|
|
35
|
+
var dataPort = 3005;
|
|
36
|
+
var midiPort = 3006;
|
|
37
|
+
var miniWiPort = 8888;
|
|
38
|
+
|
|
39
|
+
// Specific to Interface Z hardware. IP addresses are fixed.
|
|
40
|
+
var serverAddress = "192.168.1.251";
|
|
41
|
+
var interfaceZAddress = "192.168.1.250";
|
|
42
|
+
var interfaceZMidiPort = 1000;
|
|
43
|
+
|
|
44
|
+
var debug = false;
|
|
45
|
+
var debug1 = false;
|
|
46
|
+
var tempoSensorsInit = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,];
|
|
47
|
+
var tempoSensors = tempoSensorsInit.slice();
|
|
48
|
+
var previousSensorsValues = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
49
|
+
var sensorsSensibilities = [100, 100, 100, 100, 100, 200, 200, 200, 100, 200, 200, 200];
|
|
50
|
+
var sensorsRunning = false;
|
|
51
|
+
|
|
52
|
+
console.log("INFO: workerInterfaceZ: Start Interface Z worker");
|
|
53
|
+
|
|
54
|
+
function displaySignal(sensor, value) {
|
|
55
|
+
process.stdout.write(sensor.toString() + ': ');
|
|
56
|
+
for (var i = 0; i < value/100; i++) {
|
|
57
|
+
process.stdout.write("*");
|
|
58
|
+
}
|
|
59
|
+
console.log(" ", value);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function displaySignalMiniWi(value) {
|
|
63
|
+
var val;
|
|
64
|
+
for (var j = 0; j < 4; j++) {
|
|
65
|
+
|
|
66
|
+
val = value[j] / 100;
|
|
67
|
+
if (val !== 0) {
|
|
68
|
+
process.stdout.write(j + 8 + ': ');
|
|
69
|
+
for (var i = 0; i < val; i++) {
|
|
70
|
+
process.stdout.write("*");
|
|
71
|
+
}
|
|
72
|
+
console.log(value[j]);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function closeOSCsockets() {
|
|
78
|
+
try {
|
|
79
|
+
if (sockData !== undefined) sockData.close();
|
|
80
|
+
if (sockMidi !== undefined) sockMidi.close();
|
|
81
|
+
if (sockMiniWI !== undefined) sockMiniWI.close();
|
|
82
|
+
} catch (err) {
|
|
83
|
+
console.log("ERR: workerInterfaceZ: closeOSCsockets: ", err);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Data received from the Server launching the worker
|
|
88
|
+
parentPort.onmessage = function (mess) {
|
|
89
|
+
var result = mess.data[0];
|
|
90
|
+
if (debug) console.log("workerInterfaceZ: message:", mess.data);
|
|
91
|
+
|
|
92
|
+
switch (result) {
|
|
93
|
+
|
|
94
|
+
case "startInterfaceZ":
|
|
95
|
+
serverAddress = mess.data[1];
|
|
96
|
+
interfaceZAddress = mess.data[2];
|
|
97
|
+
dataPort = mess.data[3];
|
|
98
|
+
midiPort = mess.data[4];
|
|
99
|
+
miniWiPort = mess.data[5];
|
|
100
|
+
interfaceZMidiPort = mess.data[6];
|
|
101
|
+
tempoSensorsInit = mess.data[7];
|
|
102
|
+
sensorsSensibilities = mess.data[8];
|
|
103
|
+
|
|
104
|
+
if (debug1) console.log('INFO: workerInterfaceZ: receive message: Start Worker startInterfaceZ',
|
|
105
|
+
serverAddress, interfaceZAddress, dataPort, midiPort, miniWiPort, interfaceZMidiPort,
|
|
106
|
+
tempoSensorsInit, sensorsSensibilities);
|
|
107
|
+
|
|
108
|
+
const message = 'message';
|
|
109
|
+
parentPort.postMessage(message);
|
|
110
|
+
|
|
111
|
+
sensorsRunning = true;
|
|
112
|
+
initWorker();
|
|
113
|
+
break;
|
|
114
|
+
|
|
115
|
+
case "stopInterfaceZ":
|
|
116
|
+
if (debug1) console.log('INFO: workerInterfaceZ: receive message: Stop OSC sockets');
|
|
117
|
+
sensorsRunning = false;
|
|
118
|
+
break;
|
|
119
|
+
|
|
120
|
+
default:
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function initWorker() {
|
|
126
|
+
/**
|
|
127
|
+
* Process the OSC messages of the Data port from the Interface Z cards.
|
|
128
|
+
*/
|
|
129
|
+
if (debug) console.log("initWorker Interface Z");
|
|
130
|
+
|
|
131
|
+
// Necessary if relaunched
|
|
132
|
+
closeOSCsockets();
|
|
133
|
+
|
|
134
|
+
sockData = dgram.createSocket("udp4", function (msg, rinfo) {
|
|
135
|
+
var message;
|
|
136
|
+
var messageToSend;
|
|
137
|
+
|
|
138
|
+
try {
|
|
139
|
+
message = osc.fromBuffer(msg); // Message OSC recu
|
|
140
|
+
if (debug) {
|
|
141
|
+
console.log("Z socket reçoit OSC: [", message.address + " : " +
|
|
142
|
+
message.args[0].value + " : " +
|
|
143
|
+
message.args[1].value + " : " +
|
|
144
|
+
message.args[2].value + " : " +
|
|
145
|
+
message.args[3].value + " : " +
|
|
146
|
+
message.args[4].value + " : " +
|
|
147
|
+
message.args[5].value + " : " +
|
|
148
|
+
message.args[6].value + " : " +
|
|
149
|
+
message.args[7].value + "]");
|
|
150
|
+
}
|
|
151
|
+
switch (message.address) {
|
|
152
|
+
case "/INTERFACEZ/RC":
|
|
153
|
+
for (var i = 0; i < 8; i++) {
|
|
154
|
+
if (tempoSensorsInit[i] === 0) { // Dont process this sensor
|
|
155
|
+
//continue;
|
|
156
|
+
if (debug) console.log("workerInterfaceZ: Dont process this sensor[", i, "]");
|
|
157
|
+
}
|
|
158
|
+
else if (tempoSensors[i] > 1) {
|
|
159
|
+
tempoSensors[i]--;
|
|
160
|
+
} else {
|
|
161
|
+
if (debug) console.log("workerInterfaceZ: tempoSensors[", i, "] = 1");
|
|
162
|
+
if (
|
|
163
|
+
message.args[i].value < previousSensorsValues[i] - sensorsSensibilities[i] ||
|
|
164
|
+
message.args[i].value > previousSensorsValues[i] + sensorsSensibilities[i]) {
|
|
165
|
+
if (debug1) displaySignal(i, Math.round(message.args[i].value));
|
|
166
|
+
|
|
167
|
+
messageToSend = {
|
|
168
|
+
type: "INTERFACEZ_RC" + i,
|
|
169
|
+
sensor: i,
|
|
170
|
+
value: Math.round(message.args[i].value)
|
|
171
|
+
}
|
|
172
|
+
if (sensorsRunning) parentPort.postMessage(messageToSend);
|
|
173
|
+
}
|
|
174
|
+
previousSensorsValues[i] = message.args[i].value;
|
|
175
|
+
tempoSensors[i] = tempoSensorsInit[i];
|
|
176
|
+
if (debug) console.log("workerInterfaceZ: tempoSensors :", tempoSensors, "tempoSensorsInit :", tempoSensorsInit);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
break;
|
|
180
|
+
|
|
181
|
+
default:
|
|
182
|
+
console.log("Interface Z: socket DATA reçoit OSC: [", message.address + " : " + (message.args[0].value), "]");
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
return;
|
|
186
|
+
} catch (error) {
|
|
187
|
+
console.log("Interface Z: ERR dans réception OSC :", message.args, error);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Process the OSC messages of the Midi port from the Interface Z cards.
|
|
194
|
+
*/
|
|
195
|
+
sockMidi = dgram.createSocket("udp4", function (msg, rinfo) {
|
|
196
|
+
var message;
|
|
197
|
+
var buf;
|
|
198
|
+
|
|
199
|
+
try {
|
|
200
|
+
message = osc.fromBuffer(msg); // Message OSC recu
|
|
201
|
+
// console.log(osc.fromBuffer(msg));
|
|
202
|
+
if (debug) {
|
|
203
|
+
//console.log("OSCetZ.js: socket reçoit OSC: [", message.address + " : " + message.args[0].value , "]");
|
|
204
|
+
console.log("Z socket reçoit OSC: [", message.address + " : " +
|
|
205
|
+
message.args[0].value + " : " +
|
|
206
|
+
message.args[1].value + " : " +
|
|
207
|
+
message.args[2].value + "]");
|
|
208
|
+
}
|
|
209
|
+
switch (message.address) {
|
|
210
|
+
case "/OSCSYSEXC":
|
|
211
|
+
break;
|
|
212
|
+
|
|
213
|
+
case "/OSCNOTEON":
|
|
214
|
+
console.log("Z socket reçoit OSC: [", message.address + " : " +
|
|
215
|
+
message.args[0].value + " : " +
|
|
216
|
+
message.args[1].value + " : " +
|
|
217
|
+
message.args[2].value + "]");
|
|
218
|
+
|
|
219
|
+
// Exemple de reroutage du MIDI IN converti en OSC vers MIDI OUT
|
|
220
|
+
// buf = osc.toBuffer(
|
|
221
|
+
// {
|
|
222
|
+
// address: "/OSCNOTEON",
|
|
223
|
+
// args: [
|
|
224
|
+
// { type: 'integer', value: message.args[0].value },
|
|
225
|
+
// { type: 'integer', value: message.args[1].value },
|
|
226
|
+
// { type: 'integer', value: message.args[2].value }]
|
|
227
|
+
// }
|
|
228
|
+
// );
|
|
229
|
+
// Le port 1000 est fixe.
|
|
230
|
+
//sockMidi.send(buf, 0, buf.length, 1000, "192.168.1.250");
|
|
231
|
+
break;
|
|
232
|
+
|
|
233
|
+
default:
|
|
234
|
+
console.log("OSCetZ.js: socket MIDI reçoit OSC: [", message.address + " : " + (message.args[0].value), "]");
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
return;
|
|
238
|
+
} catch (error) {
|
|
239
|
+
console.log("OSCetZ.js: ERR dans réception OSC :", message.args, error);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Process the OSC messages of the MiniWi port.
|
|
246
|
+
* We consider that the MinWi sensors start from 8 to 11.
|
|
247
|
+
* 0 to 7 is for the 8 Ana/8 Num OSC Card
|
|
248
|
+
*/
|
|
249
|
+
sockMiniWI = dgram.createSocket("udp4", function (msg, rinfo) {
|
|
250
|
+
var message;
|
|
251
|
+
var messMiniWi = [0, 0, 0, 0];
|
|
252
|
+
var messageToSend;
|
|
253
|
+
|
|
254
|
+
try {
|
|
255
|
+
message = osc.fromBuffer(msg); // Message OSC recu
|
|
256
|
+
// console.log(osc.fromBuffer(msg));
|
|
257
|
+
if (debug) {
|
|
258
|
+
//console.log("OSCetZ.js: socket reçoit OSC: [", message.address + " : " + message.args[0].value , "]");
|
|
259
|
+
console.log("Z socket reçoit OSC from MiniWi: [", message.address + " -> " +
|
|
260
|
+
message.args[0].value + " : " +
|
|
261
|
+
message.args[1].value + " : " +
|
|
262
|
+
message.args[2].value + " : " +
|
|
263
|
+
message.args[3].value + "]");
|
|
264
|
+
}
|
|
265
|
+
switch (message.address) {
|
|
266
|
+
case "/CA":
|
|
267
|
+
// Process the Sensor of the MiniWi as sensors from 8 to 11
|
|
268
|
+
for (var i = 8; i < 12; i++) {
|
|
269
|
+
if (tempoSensors[i] === 0) { // 0 means "Do not process the sensor"
|
|
270
|
+
}
|
|
271
|
+
else if (tempoSensors[i] === 1) {
|
|
272
|
+
if (
|
|
273
|
+
message.args[i - 8].value < previousSensorsValues[i] - sensorsSensibilities[i] ||
|
|
274
|
+
message.args[i - 8].value > previousSensorsValues[i] + sensorsSensibilities[i]) {
|
|
275
|
+
messMiniWi[i - 8] = message.args[i - 8].value;
|
|
276
|
+
|
|
277
|
+
messageToSend = {
|
|
278
|
+
type: "INTERFACEZ_RC" + i,
|
|
279
|
+
sensor: i,
|
|
280
|
+
value: Math.round(message.args[i - 8].value)
|
|
281
|
+
}
|
|
282
|
+
if (sensorsRunning) parentPort.postMessage(messageToSend);
|
|
283
|
+
if(debug) console.log("workerInterfaceZ.js: socket MiniWi post:", messageToSend);
|
|
284
|
+
}
|
|
285
|
+
previousSensorsValues[i] = message.args[i - 8].value;
|
|
286
|
+
tempoSensors[i] = tempoSensorsInit[i];
|
|
287
|
+
} else {
|
|
288
|
+
tempoSensors[i]--;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
displaySignalMiniWi(messMiniWi);
|
|
292
|
+
break;
|
|
293
|
+
|
|
294
|
+
default:
|
|
295
|
+
console.log("workerInterfaceZ.js: socket MiniWi reçoit OSC: [", message.address + " : " + (message.args[0].value), "]");
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
return;
|
|
299
|
+
} catch (error) {
|
|
300
|
+
console.log("workerInterfaceZ.js: ERR dans réception OSC :", message.args, error);
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
sockData.on('listening', function () {
|
|
306
|
+
var addressData = sockData.address();
|
|
307
|
+
if (debug1) console.log('INFO: OSCetZ.js: UDP Server listening on ' + addressData.address + ":" + addressData.port);
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
sockMidi.on('listening', function () {
|
|
311
|
+
var addressMidi = sockMidi.address();
|
|
312
|
+
if (debug1) console.log('INFO: OSCetZ.js: UDP Server listening on ' + addressMidi.address + ":" + addressMidi.port);
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
sockMiniWI.on('listening', function () {
|
|
316
|
+
var addressMidi = sockMiniWI.address();
|
|
317
|
+
if (debug1) console.log('INFO: OSCetZ.js: UDP Server listening on ' + addressMidi.address + ":" + addressMidi.port);
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
try {
|
|
321
|
+
sockData.bind(dataPort, serverAddress);
|
|
322
|
+
sockMidi.bind(midiPort, serverAddress);
|
|
323
|
+
sockMiniWI.bind(miniWiPort, serverAddress);
|
|
324
|
+
} catch (err) {
|
|
325
|
+
console.log("Pb on binding socket in workerInterfaceZ");
|
|
326
|
+
}
|
|
327
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileOverview
|
|
3
|
+
* Worker to send a (good) synchro when not using a midi sync coming from a DAW.
|
|
4
|
+
* @author Bertrand Petit-Hédelin <bertrand@hedelin.fr>
|
|
5
|
+
* @copyright (C) 2022-2024 Bertrand Petit-Hédelin
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
* @version 1.4
|
|
20
|
+
*/
|
|
21
|
+
'use strict'
|
|
22
|
+
import { parentPort } from 'worker_threads';
|
|
23
|
+
|
|
24
|
+
var debug = false;
|
|
25
|
+
var debug1 = true;
|
|
26
|
+
var synchroTimer;
|
|
27
|
+
|
|
28
|
+
console.log("INFO: Start Synchro worker");
|
|
29
|
+
|
|
30
|
+
parentPort.onmessage = function (mess) {
|
|
31
|
+
var result = mess.data[0];
|
|
32
|
+
var timer = mess.data[1];
|
|
33
|
+
switch (result) {
|
|
34
|
+
case "startSynchro":
|
|
35
|
+
if (debug1) console.log('INFO: Start Worker synchro with timer: ', timer);
|
|
36
|
+
if (synchroTimer !== null) {
|
|
37
|
+
clearInterval(synchroTimer);
|
|
38
|
+
synchroTimer = null;
|
|
39
|
+
}
|
|
40
|
+
synchroTimer = setInterval(function () {
|
|
41
|
+
const message = 'synchroWorker';
|
|
42
|
+
parentPort.postMessage(message);
|
|
43
|
+
if (debug) console.log("workerSynchro:", timer);
|
|
44
|
+
}, timer);
|
|
45
|
+
break;
|
|
46
|
+
default:
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
package/skini.mjs
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileOverview
|
|
3
|
+
* Entry point to Skini which allow to control interactive and generative
|
|
4
|
+
* music based on clips (patterns).
|
|
5
|
+
* @copyright (C) 2024 Bertrand Petit-Hédelin
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*
|
|
20
|
+
* @version 1.4
|
|
21
|
+
* @author Bertrand Petit-Hédelin <bertrand@hedelin.fr>
|
|
22
|
+
*/
|
|
23
|
+
import { createRequire } from 'module';
|
|
24
|
+
const require = createRequire(import.meta.url);
|
|
25
|
+
|
|
26
|
+
import path from 'path';
|
|
27
|
+
import { fileURLToPath } from 'url';
|
|
28
|
+
import * as fs from 'fs';
|
|
29
|
+
|
|
30
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
31
|
+
const __dirname = path.dirname(__filename);
|
|
32
|
+
var express = require('express');
|
|
33
|
+
var ipConfig = require("./serveur/ipConfig.json");
|
|
34
|
+
var midiConfig = require("./serveur/midiConfig.json");
|
|
35
|
+
|
|
36
|
+
// Websocket dans le Serveur
|
|
37
|
+
import * as ws from './serveur/websocketServer.mjs';
|
|
38
|
+
import * as oscReceiveDAW from "./serveur/midimix.mjs";
|
|
39
|
+
|
|
40
|
+
function startSkini() {
|
|
41
|
+
|
|
42
|
+
// Nettoyage du log précédents
|
|
43
|
+
try {
|
|
44
|
+
if (fs.existsSync("./skinilog.json")) {
|
|
45
|
+
try {
|
|
46
|
+
fs.unlinkSync("./skinilog.json")
|
|
47
|
+
} catch (err) {
|
|
48
|
+
console.error("WARN: Pas de log précédents:", err)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
} catch (err) {
|
|
52
|
+
console.error(err)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Load the necessary modules in the websocket server at launch
|
|
56
|
+
ws.setParameters(oscReceiveDAW);
|
|
57
|
+
|
|
58
|
+
// Share ws server in midimix
|
|
59
|
+
oscReceiveDAW.setWebSocketServer(ws);
|
|
60
|
+
|
|
61
|
+
// AFFICHAGE DU CONTEXTE =================================================
|
|
62
|
+
|
|
63
|
+
function displayContext(ipConfig) {
|
|
64
|
+
console.log("----------- NETWORK --------------------------------------");
|
|
65
|
+
console.log("Port OUT OSC pour MIDI:", ipConfig.OutPortOSCMIDItoDAW, "IP:", ipConfig.remoteIPAddressSound); // DAW ou Processing
|
|
66
|
+
console.log("Port IN OSC pour MIDI:", ipConfig.InPortOSCMIDIfromDAW, "IP:", ipConfig.remoteIPAddressSound); // DAW ou Processing
|
|
67
|
+
console.log("Port IN OSC pour M4L :", ipConfig.portOSCFromAbleton, "IP:", ipConfig.remoteIPAddressAbleton); // Pour M4L
|
|
68
|
+
//console.log("Port OUT OSC pour Jeu :", ipConfig.portOSCToGame, "IP:", ipConfig.remoteIPAdressGame);
|
|
69
|
+
//console.log("Port IN OSC pour Jeu :", ipConfig.portOSCFromGame, "IP:", ipConfig.remoteIPAdressGame);
|
|
70
|
+
console.log("Port IN OSC pour QLC :", ipConfig.inportLumiere, "IP:", ipConfig.remoteIPAddressLumiere);
|
|
71
|
+
console.log("Port OUT OSC pour QLC :", ipConfig.outportLumiere, "IP:", ipConfig.remoteIPAddressLumiere);
|
|
72
|
+
console.log("Port OUT pour Visu :", ipConfig.outportProcessing, "IP:", ipConfig.remoteIPAddressImage);
|
|
73
|
+
console.log("Port OUT seq. distrib.:", ipConfig.distribSequencerPort, "IP:", ipConfig.remoteIPAddressSound); // Processing
|
|
74
|
+
console.log("Serveur HTTP port:", ipConfig.webserveurPort, "IP:", ipConfig.serverIPAddress);
|
|
75
|
+
console.log("Serveur WS port:", ipConfig.websocketServeurPort, "IP:", ipConfig.serverIPAddress);
|
|
76
|
+
if (ipConfig.serverIPAddressPublic !== undefined) {
|
|
77
|
+
console.log("Serveur publique HTTP et Websocket IP:", ipConfig.serverIPAddressPublic);
|
|
78
|
+
} else {
|
|
79
|
+
console.log("Serveur pas accessible depuis Internet");
|
|
80
|
+
}
|
|
81
|
+
console.log("----------- DIRECTORIES --------------------------------------");
|
|
82
|
+
console.log("Session Path:", ipConfig.sessionPath);
|
|
83
|
+
console.log("Piece Path:", ipConfig.piecePath);
|
|
84
|
+
|
|
85
|
+
console.log("----------- MIDI --------------------------------------");
|
|
86
|
+
for (var i = 0; i < midiConfig.length; i++) {
|
|
87
|
+
console.log("Midi" + midiConfig[i].type + ", usage:" + midiConfig[i].spec + ", bus: " + midiConfig[i].name + ", " + midiConfig[i].comment);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
console.log("=========================================================");
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
var app = express();
|
|
94
|
+
app.use(express.static('./'));
|
|
95
|
+
|
|
96
|
+
app.get('/sequenceur', function (req, res) {
|
|
97
|
+
res.sendFile(path.join(__dirname + '/client/sequencer.html'));
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
app.get('/', function (req, res) {
|
|
101
|
+
res.sendFile(path.join(__dirname + '/client/clientListe/clientListe.html'));
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
app.get('/block', function (req, res) {
|
|
105
|
+
res.sendFile(path.join(__dirname + '/blocklySkini/blocklySkini.html'));
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// Avec /controleur ça plante le client ???
|
|
109
|
+
app.get('/contr', function (req, res) {
|
|
110
|
+
res.sendFile(path.join(__dirname + '/client/controleur/controleur.html'));
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
app.get('/contrHH', function (req, res) {
|
|
114
|
+
res.sendFile(path.join(__dirname + '/client/controleurHH/controleurHH.html'));
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
app.get('/skini', function (req, res) {
|
|
118
|
+
res.sendFile(path.join(__dirname + '/client/clientListe/clientListe.html'));
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
app.get('/score', function (req, res) {
|
|
122
|
+
res.sendFile(path.join(__dirname + '/client/score/score.html'));
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
app.get('/conf', function (req, res) {
|
|
126
|
+
res.sendFile(path.join(__dirname + '/client/configurateur/configurateur.html'));
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
app.get('/param', function (req, res) {
|
|
130
|
+
res.sendFile(path.join(__dirname + '/client/parametrage/parametrage.html'));
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
var port = ipConfig.webserveurPort;
|
|
134
|
+
var addressServer = ipConfig.serverIPAddress;
|
|
135
|
+
app.listen(port, () => {
|
|
136
|
+
console.log(`INFO: Skini listening at http://${addressServer}:${port}`);
|
|
137
|
+
});
|
|
138
|
+
displayContext(ipConfig);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
startSkini();
|