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,628 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileOverview
|
|
3
|
+
* <H3>CODE CLIENT DE GENERATION DE SEQUENCES
|
|
4
|
+
* UTILISANT LE CLIENT AVEC LISTE (clientListe)</H3>
|
|
5
|
+
* <BR>
|
|
6
|
+
* Les clips sont appelés de façon aléatoire selon la liste disponible.
|
|
7
|
+
* Ceci correspond à une audience qui fait n'importe quoi sur les clips
|
|
8
|
+
* disponibles.
|
|
9
|
+
* @version 1.2
|
|
10
|
+
* @author Bertrand Petit-Hédelin <bertrand@hedelin.fr>
|
|
11
|
+
* @copyright (C) 2022-2025 Bertrand Petit-Hédelin
|
|
12
|
+
*
|
|
13
|
+
* This program is free software: you can redistribute it and/or modify
|
|
14
|
+
* it under the terms of the GNU General Public License as published by
|
|
15
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
16
|
+
* any later version.
|
|
17
|
+
*
|
|
18
|
+
* This program is distributed in the hope that it will be useful,
|
|
19
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
21
|
+
* GNU General Public License for more details.
|
|
22
|
+
*
|
|
23
|
+
* You should have received a copy of the GNU General Public License
|
|
24
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
25
|
+
*/
|
|
26
|
+
'use strict'
|
|
27
|
+
|
|
28
|
+
const par = require('../../serveur/skiniParametres');
|
|
29
|
+
const ipConfig = require('../../serveur/ipConfig');
|
|
30
|
+
const WebSocket = require('ws');
|
|
31
|
+
const debug = false;
|
|
32
|
+
const debug1 = true;
|
|
33
|
+
|
|
34
|
+
let tempoMax, tempoMin, limiteDureeAttente, dureeAttente = 10;
|
|
35
|
+
let derniersPatternsJoues = [];
|
|
36
|
+
let derniersInstrumentsJoue = [-1, -1, -1];
|
|
37
|
+
const nbeInstruments = 100; // Attention c'est en dur...
|
|
38
|
+
|
|
39
|
+
function setTableDerniersPatterns(nbeInstr) {
|
|
40
|
+
return Array(nbeInstr).fill().map(() => [-1, -1, -1]);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function initTempi() {
|
|
44
|
+
console.log("------------------------------------------------");
|
|
45
|
+
|
|
46
|
+
// Initialisation avec valeurs par défaut
|
|
47
|
+
tempoMax = par.tempoMax ?? 500;
|
|
48
|
+
tempoMin = par.tempoMin ?? 100;
|
|
49
|
+
limiteDureeAttente = par.limiteDureeAttente ?? 100;
|
|
50
|
+
|
|
51
|
+
// Logs des valeurs par défaut utilisées
|
|
52
|
+
if (par.tempoMax === undefined) console.log("tempoMax par défaut");
|
|
53
|
+
if (par.tempoMin === undefined) console.log("tempoMin par défaut");
|
|
54
|
+
if (par.limiteDureeAttente === undefined) console.log("limiteDureeAttente par défaut");
|
|
55
|
+
|
|
56
|
+
derniersPatternsJoues = setTableDerniersPatterns(nbeInstruments);
|
|
57
|
+
if (debug) console.log("derniersPatternsJoues:", derniersPatternsJoues);
|
|
58
|
+
|
|
59
|
+
console.log(`Paramètres tempo: Min=${tempoMin} Max=${tempoMax} limiteDureeAttente=${limiteDureeAttente}`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
initTempi();
|
|
63
|
+
|
|
64
|
+
if (ipConfig.websocketServeurPort !== undefined) {
|
|
65
|
+
var port = ipConfig.websocketServeurPort;
|
|
66
|
+
} else {
|
|
67
|
+
var port = 8080;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
console.log("----------------------------------------------\n");
|
|
71
|
+
console.log("serveur:", ipConfig.serverIPAddress, " port:", ipConfig.websocketServeurPort);
|
|
72
|
+
|
|
73
|
+
let ws;
|
|
74
|
+
let id = Math.floor((Math.random() * 1000000) + 1); // Pour identifier le client
|
|
75
|
+
let monGroupe = -1; // non initialisé
|
|
76
|
+
let DAWON = 0;
|
|
77
|
+
let pseudo = "sim" + id;
|
|
78
|
+
|
|
79
|
+
let listClips; // Devient une array avec toutes les infos sur les clips selectionnes
|
|
80
|
+
let nombreDePatternsPossible = 1;
|
|
81
|
+
|
|
82
|
+
let numClip;
|
|
83
|
+
let myArgs = process.argv.slice(2);
|
|
84
|
+
|
|
85
|
+
// Décodage du paramètre pour une simulation indépendante de l'audience
|
|
86
|
+
let jeSuisUneAudience = true;
|
|
87
|
+
if (myArgs.includes("-sim")) {
|
|
88
|
+
jeSuisUneAudience = false;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/*******************************************************************
|
|
92
|
+
* GESTION DES TYPES
|
|
93
|
+
* Traitement des listes reçues pour s'adapter à une séquence de types.
|
|
94
|
+
* En utilisant les types avec des tanks on n'a pas besoin de gérer
|
|
95
|
+
* la mémoires des patterns sélectionnés, ni de revoir les FIFOs.
|
|
96
|
+
*******************************************************************/
|
|
97
|
+
// Table of positions for the types in listOfPatterns
|
|
98
|
+
// The index correpond to the type.
|
|
99
|
+
let types = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
|
|
100
|
+
let processTypes = false;
|
|
101
|
+
let listOfTypes = [[]];
|
|
102
|
+
|
|
103
|
+
// Ou version plus explicite :
|
|
104
|
+
function resetListOfTypes() {
|
|
105
|
+
listOfTypes = Array(types.length + 1).fill(null).map(() => []);
|
|
106
|
+
if (debug) console.log("resetListOfTypes:", listOfTypes);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
resetListOfTypes();
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Initialize the list of patterns according to their types
|
|
113
|
+
* The index correponds to the type.
|
|
114
|
+
* @param {Array} list of patterns
|
|
115
|
+
*/
|
|
116
|
+
function setListOfTypes(list) {
|
|
117
|
+
resetListOfTypes();
|
|
118
|
+
|
|
119
|
+
if (debug) console.log("setListOfTypes", list, "\nlistOfTypes :", listOfTypes);
|
|
120
|
+
|
|
121
|
+
list.forEach(item => {
|
|
122
|
+
const typeKey = item[7];
|
|
123
|
+
const value = item[3];
|
|
124
|
+
listOfTypes[typeKey].push(value);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
if (debug) console.log("simulateur: setListOfTypes:", listOfTypes);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function getRandomInt(max) {
|
|
131
|
+
return Math.floor(Math.random() * max);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Get randomly an element in a list and remove it
|
|
136
|
+
* from the list
|
|
137
|
+
* @param {Array} list
|
|
138
|
+
* @returns {*} an element of the list
|
|
139
|
+
*/
|
|
140
|
+
function selectOnePattern(list) {
|
|
141
|
+
let randomIndex;
|
|
142
|
+
let selected;
|
|
143
|
+
randomIndex = getRandomInt(list.length);
|
|
144
|
+
selected = list[randomIndex];
|
|
145
|
+
list.splice(randomIndex, 1);
|
|
146
|
+
if (debug) console.log("Simulateur: selectOnePattern:", selected);
|
|
147
|
+
return selected;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* To remove a pattern from the list of patterns
|
|
152
|
+
* where the index is the type
|
|
153
|
+
* @param {Array} list of patterns
|
|
154
|
+
* @param patternName
|
|
155
|
+
*/
|
|
156
|
+
function removePattern(list, patternName) {
|
|
157
|
+
for (let i = list.length - 1; i >= 0; i--) {
|
|
158
|
+
if (list[i][3] === patternName) {
|
|
159
|
+
list.splice(i, 1);
|
|
160
|
+
if (debug1) console.log("Simulateur: removePattern:", patternName);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* To get the complete pattern description
|
|
167
|
+
* according to a name
|
|
168
|
+
* @param {Array} list of pattern
|
|
169
|
+
* @param patternName
|
|
170
|
+
* @returns {*} a pattern descriptor
|
|
171
|
+
*/
|
|
172
|
+
function getPattern(list, patternName) {
|
|
173
|
+
if (debug) console.log("Simulateur: getPattern :", list, patternName, listOfTypes);
|
|
174
|
+
for (let i = 0; i < list.length; i++) {
|
|
175
|
+
if (list[i][3] === patternName) {
|
|
176
|
+
return list[i];
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Create a list of "selected patterns" according to
|
|
183
|
+
* a sequence described in types.
|
|
184
|
+
* @param {Array} list of patterns indexed by present types
|
|
185
|
+
* @param {Array} list of types availaible
|
|
186
|
+
* @param {Array} listOfPatterns
|
|
187
|
+
* @returns {Array} selected list of Skini notes
|
|
188
|
+
*/
|
|
189
|
+
function getListOfPatternsSelected(list, types, listOfPatterns) {
|
|
190
|
+
let selected = [];
|
|
191
|
+
let indexTypes;
|
|
192
|
+
let patternSelected;
|
|
193
|
+
let numClips = [];
|
|
194
|
+
let gotAPattern;
|
|
195
|
+
|
|
196
|
+
if (debug) {
|
|
197
|
+
let testList = [];
|
|
198
|
+
for (let i = 0; i < list.length; i++) {
|
|
199
|
+
if (list[i] !== undefined) {
|
|
200
|
+
testList.push(list[i][0]);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
console.log("** simulateur: getListOfPatternsSelected: listOfTypes:", testList);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// For each type we select a pattern
|
|
207
|
+
for (let i = 0; i < types.length; i++) {
|
|
208
|
+
indexTypes = types[i];
|
|
209
|
+
// Process the list of pattern with a specific type which is indexTypes
|
|
210
|
+
if (list[indexTypes] !== undefined) {
|
|
211
|
+
if (list[indexTypes].length !== 0) {
|
|
212
|
+
patternSelected = selectOnePattern(list[indexTypes]);
|
|
213
|
+
|
|
214
|
+
gotAPattern = getPattern(listOfPatterns, patternSelected);
|
|
215
|
+
selected.push(gotAPattern); // Add the pattern to the selected list
|
|
216
|
+
|
|
217
|
+
removePattern(listOfPatterns, patternSelected);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (debug) {
|
|
223
|
+
let testList = [];
|
|
224
|
+
for (let i = 0; i < selected.length; i++) {
|
|
225
|
+
if (selected[i] !== undefined) {
|
|
226
|
+
testList.push([selected[i][0], selected[i][7]]);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
console.log("** simulateur: getListOfPatternsSelected: selected:", testList, "\n");
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (debug) console.log("simulateur: getListOfPatternsSelected: selected", selected);
|
|
233
|
+
|
|
234
|
+
// A ce niveau on a une liste des patterns, il nous faut juste la liste des notes
|
|
235
|
+
for (let i = 0; i < selected.length; i++) {
|
|
236
|
+
if (selected[i] !== undefined) {
|
|
237
|
+
numClips.push(selected[i][0]);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return numClips;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/************************ NON REPETITION DES CLIPS ********************
|
|
244
|
+
Table des commandes donnée par les listes de patterns
|
|
245
|
+
|
|
246
|
+
0= note, 1=note stop, 2=flag, 3=nom, 4=fichier son, 5=instrument, 6=Slot, 7=niveau2, 8=niveau3, 9=groupe, 10=durée
|
|
247
|
+
11= réservé client, 12= pseudo
|
|
248
|
+
|
|
249
|
+
**********************************************************************/
|
|
250
|
+
|
|
251
|
+
function isInList(element, list) {
|
|
252
|
+
return list.includes(element);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function sendPseudo(texte) {
|
|
256
|
+
if (debug) console.log("sendPseudo:", texte);
|
|
257
|
+
ws.send(JSON.stringify({
|
|
258
|
+
type: "clientPseudo",
|
|
259
|
+
pseudo: texte
|
|
260
|
+
}));
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/* --------------------------------------------------------------------
|
|
264
|
+
* On évite de reprendre un élément de la liste qui serait dans mémoire.
|
|
265
|
+
* Nous avons les cas particuliers où la liste est de taille équivalente
|
|
266
|
+
* ou inferieure à la mémoire.
|
|
267
|
+
* retourne un élément de la liste.
|
|
268
|
+
* --------------------------------------------------------------------*/
|
|
269
|
+
function selectRandomInList(memoire, liste) {
|
|
270
|
+
if (!memoire || !liste?.length) return undefined;
|
|
271
|
+
if (liste.length === 1) return liste[0];
|
|
272
|
+
|
|
273
|
+
const isInMemory = (item) => liste.length <= memoire.length
|
|
274
|
+
? item === memoire[memoire.length - 1] // Évite juste le dernier
|
|
275
|
+
: memoire.includes(item); // Évite tout ce qui est en mémoire
|
|
276
|
+
|
|
277
|
+
let selection, attempts = 0;
|
|
278
|
+
do {
|
|
279
|
+
selection = liste[Math.floor(Math.random() * liste.length)];
|
|
280
|
+
if(debug) console.log("Selection:", selection);
|
|
281
|
+
} while (isInMemory(selection) && ++attempts < liste.length * 10);
|
|
282
|
+
|
|
283
|
+
memoire.shift();
|
|
284
|
+
memoire.push(selection);
|
|
285
|
+
return selection;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// Retourne la note MIDI (Skini) d'un pattern choisi au hasard
|
|
289
|
+
function selectNextClip() {
|
|
290
|
+
// Check that listClips and derniersPatternsJoues are defined and valid arrays
|
|
291
|
+
if (!Array.isArray(listClips) || typeof derniersPatternsJoues !== 'object' || derniersPatternsJoues === null) {
|
|
292
|
+
console.log("ERR:selectNextClip: listClips or derniersPatternsJoues is not a valid array/object");
|
|
293
|
+
return undefined;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
let selectionClip;
|
|
297
|
+
let listeSelectionClip = [];
|
|
298
|
+
let listeInstruments = [];
|
|
299
|
+
let instrument;
|
|
300
|
+
|
|
301
|
+
// Use named constants for clip indices
|
|
302
|
+
const CLIP_ID_INDEX = 0;
|
|
303
|
+
const CLIP_INSTRUMENT_INDEX = 5;
|
|
304
|
+
|
|
305
|
+
//Mettre à jour le nombre d'instruments donnés par la liste
|
|
306
|
+
listeInstruments = Array.from(new Set(listClips.map(clip => clip[CLIP_INSTRUMENT_INDEX])));
|
|
307
|
+
if (debug) console.log("*** selectNextClip:listeInstruments:", listeInstruments);
|
|
308
|
+
|
|
309
|
+
//Choisir un instrument au hasard, et pas toujours le même
|
|
310
|
+
instrument = selectRandomInList(derniersInstrumentsJoue, listeInstruments);
|
|
311
|
+
if (debug) console.log("*** selectNextClip:instrument:", instrument, derniersInstrumentsJoue);
|
|
312
|
+
if (instrument === undefined) {
|
|
313
|
+
console.log("ERR:selectNextClip:instrument undefined");
|
|
314
|
+
return undefined;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
//Choisir les commandes MIDI des patterns pour l'instrument sélectioné
|
|
318
|
+
listeSelectionClip = listClips
|
|
319
|
+
.filter(clip => clip[CLIP_INSTRUMENT_INDEX] === instrument)
|
|
320
|
+
.map(clip => clip[CLIP_ID_INDEX]);
|
|
321
|
+
if (debug) console.log("*** selectNextClip:listeSelectionClip:", listeSelectionClip);
|
|
322
|
+
|
|
323
|
+
//Choisir un pattern pour l'instrument sélectionné
|
|
324
|
+
selectionClip = selectRandomInList(derniersPatternsJoues[instrument], listeSelectionClip);
|
|
325
|
+
if (selectionClip === undefined) {
|
|
326
|
+
console.log("ERR:selectNextClip:selectionClip undefined : ", derniersPatternsJoues[instrument], "\n listeSelectionClip :", listeSelectionClip);
|
|
327
|
+
return undefined;
|
|
328
|
+
}
|
|
329
|
+
if (debug) console.log("*** selectNextClip:selectionClip:", selectionClip);
|
|
330
|
+
|
|
331
|
+
return selectionClip;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* To get the number of pattern the simulator can send
|
|
336
|
+
* @param {Array} list of pattern posible by type
|
|
337
|
+
* @param {number} my goup
|
|
338
|
+
* @returns {number} a number of pattern
|
|
339
|
+
*/
|
|
340
|
+
function getnombreDePatternsPossible(listOfLengthPerType, myGroup) {
|
|
341
|
+
// Cherche d'abord le groupe spécifique
|
|
342
|
+
const specificGroup = listOfLengthPerType.find(item => item[1] === myGroup);
|
|
343
|
+
if (specificGroup) return specificGroup[0];
|
|
344
|
+
|
|
345
|
+
// Sinon cherche le groupe broadcast (255)
|
|
346
|
+
const broadcastGroup = listOfLengthPerType.find(item => item[1] === 255);
|
|
347
|
+
return broadcastGroup?.[0];
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/*********************************************
|
|
351
|
+
|
|
352
|
+
WEBSOCKET AVEC NODE JS
|
|
353
|
+
|
|
354
|
+
**********************************************/
|
|
355
|
+
|
|
356
|
+
function initWSSocket(port) {
|
|
357
|
+
var tempoInstantListClip = 0;
|
|
358
|
+
|
|
359
|
+
ws = new WebSocket("ws://" + ipConfig.serverIPAddress + ":" + ipConfig.websocketServeurPort); // NODE JS
|
|
360
|
+
|
|
361
|
+
// Par défaut je suis hors audience
|
|
362
|
+
let monIdentite = "simulateur";
|
|
363
|
+
if (jeSuisUneAudience) monIdentite = "sim";
|
|
364
|
+
|
|
365
|
+
ws.onopen = function (event) {
|
|
366
|
+
console.log("simulateur.js Websocket : ", "ws://" + ipConfig.serverIPAddress + ":" + port + "/hop/serv");
|
|
367
|
+
const messages = [
|
|
368
|
+
{ type: "startSpectateur", text: monIdentite, id },
|
|
369
|
+
{ type: "getNombreDePatternsPossibleEnListe" }
|
|
370
|
+
];
|
|
371
|
+
|
|
372
|
+
messages.forEach(msg => ws.send(JSON.stringify(msg)));
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
//Traitement de la Réception sur le client
|
|
376
|
+
ws.onmessage = function (event) {
|
|
377
|
+
let msgRecu = JSON.parse(event.data);
|
|
378
|
+
//console.log( "Client: received [%s]", event.data );
|
|
379
|
+
switch (msgRecu.type) {
|
|
380
|
+
|
|
381
|
+
case "DAWON":
|
|
382
|
+
DAWON = msgRecu.value;
|
|
383
|
+
actionSurDAWON();
|
|
384
|
+
break;
|
|
385
|
+
|
|
386
|
+
case "DAWStatus":
|
|
387
|
+
if (debug) console.log("Reçu DAWStatus:", event.value);
|
|
388
|
+
DAWON = msgRecu.value;
|
|
389
|
+
actionSurDAWON();
|
|
390
|
+
break;
|
|
391
|
+
|
|
392
|
+
case "demandeDeSonParPseudo":
|
|
393
|
+
if (debug) console.log("Reçu Texte Broadcast demande de son par pseudo:", msgRecu.value);
|
|
394
|
+
break;
|
|
395
|
+
|
|
396
|
+
case "dureeAttente": // Quand le son a été demandé
|
|
397
|
+
if (debug) console.log("dureeAttente:", msgRecu.text, msgRecu.son);
|
|
398
|
+
dureeAttente = parseInt(msgRecu.text);
|
|
399
|
+
break;
|
|
400
|
+
|
|
401
|
+
case "groupe":
|
|
402
|
+
//Si le simulateur doit être dissocicé de l'audience,
|
|
403
|
+
// il sera dans le dernier groupe de la table des possibles.
|
|
404
|
+
if (jeSuisUneAudience) {
|
|
405
|
+
// Le simulateur simule l'audience.
|
|
406
|
+
// Il se comporte comme tout le monde, avec le groupe que le serveur assigne
|
|
407
|
+
monGroupe = msgRecu.noDeGroupe;
|
|
408
|
+
console.log("SIMULATION DE L'AUDIENCE");
|
|
409
|
+
} else if (!par.simulatorInAseperateGroup) {
|
|
410
|
+
// Je suis ne pas un simulateur de l'audience
|
|
411
|
+
// et la config n'a pas prévu de simulateur indépendant de l'audience.
|
|
412
|
+
// On force un comportement de simulateur d'audience.
|
|
413
|
+
console.log("WARN: le simulateur demande à être indépendant, mais ce n'est pas prévu dans la configuration");
|
|
414
|
+
monGroupe = msgRecu.noDeGroupe;
|
|
415
|
+
} else {
|
|
416
|
+
// La config a prévu un simulateur indépendant de l'audience
|
|
417
|
+
// et je ne suis pas un simulateur d'audience.
|
|
418
|
+
// Je définis mon groupe en m'attribuant donc le dernier groupe de client
|
|
419
|
+
// Ceci est redondant avec le serveur dans ce cas qui fournit aussi le même groupe
|
|
420
|
+
// resérvé.
|
|
421
|
+
console.log("SIMULATION INDEPENDANTE DE L'AUDIENCE");
|
|
422
|
+
monGroupe = par.nbeDeGroupesClients - 1;
|
|
423
|
+
}
|
|
424
|
+
console.log("Je suis dans le groupe:", monGroupe, "pseudo:", pseudo);
|
|
425
|
+
actionSurDAWON();
|
|
426
|
+
break;
|
|
427
|
+
|
|
428
|
+
case "groupeClientStatus":
|
|
429
|
+
if (debug) console.log("Reçu Broadcast: groupeClientStatus:", msgRecu, msgRecu.groupeClient);
|
|
430
|
+
if (msgRecu.groupeClient == monGroupe || msgRecu.groupeClient == 255) {
|
|
431
|
+
actionSurGroupeClientStatus(msgRecu.groupeName, msgRecu.status);
|
|
432
|
+
}
|
|
433
|
+
break;
|
|
434
|
+
|
|
435
|
+
case "infoPlayDAW":
|
|
436
|
+
if (debug) console.log("Reçu Texte Broadcast infoPlayDAW:", msgRecu.value);
|
|
437
|
+
break;
|
|
438
|
+
|
|
439
|
+
case "listClips":
|
|
440
|
+
listClips = msgRecu.listClips;
|
|
441
|
+
if (listClips === -1) {
|
|
442
|
+
if (debug) console.log("WS Recu : listClips: groupe de client inexistant", listClips);
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
if (listClips === undefined) {
|
|
447
|
+
if (debug) console.log("WS Recu : listClips: undefined, pas de clip");
|
|
448
|
+
break;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
if (listClips.length === 0) {
|
|
452
|
+
if (debug) console.log("WS Recu : listClips vide");
|
|
453
|
+
if (tempoMax === tempoMin) {
|
|
454
|
+
console.log("WARN: tempoMin and tempoMax are equal");
|
|
455
|
+
tempoInstantListClip = tempoMax;
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
tempoInstantListClip = Math.floor((Math.random() * (tempoMax - tempoMin)) + tempoMin);
|
|
459
|
+
}
|
|
460
|
+
if (debug) console.log("Tempo avant prochaine demande 2:", tempoInstantListClip);
|
|
461
|
+
if (DAWON) setTimeout(function () {
|
|
462
|
+
selectListClips();
|
|
463
|
+
},
|
|
464
|
+
tempoInstantListClip);
|
|
465
|
+
break;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
// Selection de clips dans la liste
|
|
469
|
+
if (debug1) console.log("\n--- WS Recu : listClips 1ere ligne:", listClips[0][4], "Nombre clip dispo:", listClips.length);
|
|
470
|
+
var sequenceLocale = [];
|
|
471
|
+
|
|
472
|
+
if (processTypes) {
|
|
473
|
+
setListOfTypes(listClips);
|
|
474
|
+
sequenceLocale = getListOfPatternsSelected(listOfTypes, types, listClips);
|
|
475
|
+
if (debug1) console.log("Simulateur: sequence selon les types:", sequenceLocale);
|
|
476
|
+
} else {
|
|
477
|
+
for (let i = 0; i < nombreDePatternsPossible; i++) {
|
|
478
|
+
//Version qui évite trop de répétitions
|
|
479
|
+
numClip = selectNextClip();
|
|
480
|
+
sequenceLocale[i] = numClip;
|
|
481
|
+
// On a une liste
|
|
482
|
+
if (debug) console.log("--- Simulateur Recu : listClips: choisi", numClip, " : ", listClips[numClip][4], "\n");
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
// Emission de la liste
|
|
487
|
+
if (debug) console.log("-- sendPatternSequence: attente:", dureeAttente, limiteDureeAttente);
|
|
488
|
+
if (dureeAttente < limiteDureeAttente) { // On est dans des délais raisonnables
|
|
489
|
+
if (debug1) console.log("-- sendPatternSequence", sequenceLocale, pseudo);
|
|
490
|
+
ws.send(JSON.stringify({
|
|
491
|
+
type: "sendPatternSequence",
|
|
492
|
+
patternSequence: sequenceLocale,
|
|
493
|
+
pseudo: pseudo,
|
|
494
|
+
groupe: monGroupe,
|
|
495
|
+
idClient: id
|
|
496
|
+
}));
|
|
497
|
+
} else {
|
|
498
|
+
dureeAttente = 0;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
tempoInstantListClip = Math.floor((Math.random() * (tempoMax - tempoMin)) + tempoMin);
|
|
502
|
+
if (debug1) console.log("Tempo avant prochaine demande 1:", tempoInstantListClip);
|
|
503
|
+
if (DAWON) setTimeout(function () {
|
|
504
|
+
selectListClips();
|
|
505
|
+
},
|
|
506
|
+
tempoInstantListClip);
|
|
507
|
+
break;
|
|
508
|
+
|
|
509
|
+
case "listeDesTypes":
|
|
510
|
+
types = msgRecu.text.split(',').map(str => parseInt(str));
|
|
511
|
+
if (debug1) console.log("Simulator: List of Types:", types);
|
|
512
|
+
break;
|
|
513
|
+
|
|
514
|
+
case "message":
|
|
515
|
+
if (debug) console.log(msgRecu.text);
|
|
516
|
+
break;
|
|
517
|
+
|
|
518
|
+
case "nombreDePatternsPossible":
|
|
519
|
+
nombreDePatternsPossible = getnombreDePatternsPossible(msgRecu.value, monGroupe);
|
|
520
|
+
if (debug1) console.log("Simulator: nombreDePatternsPossible:", nombreDePatternsPossible);
|
|
521
|
+
break;
|
|
522
|
+
|
|
523
|
+
case "nombreDePatternsPossibleEnListe":
|
|
524
|
+
nombreDePatternsPossible = getnombreDePatternsPossible(msgRecu.nombreDePatternsPossible, monGroupe);
|
|
525
|
+
if (debug1) console.log("Simulator : nombreDePatternsPossible:nombreSonsPossibleInit ", nombreDePatternsPossible);
|
|
526
|
+
break;
|
|
527
|
+
|
|
528
|
+
case "patternSequenceAck":
|
|
529
|
+
if (debug1) console.log("Simulator : patternSequenceAck: score ", msgRecu.score);
|
|
530
|
+
break;
|
|
531
|
+
|
|
532
|
+
case "setListeDesTypes":
|
|
533
|
+
if (debug1) console.log("Simulator: Set the type list")
|
|
534
|
+
processTypes = true;
|
|
535
|
+
break;
|
|
536
|
+
|
|
537
|
+
case "unsetListeDesTypes":
|
|
538
|
+
if (debug1) console.log("Simulator: Unset the type list")
|
|
539
|
+
processTypes = false;
|
|
540
|
+
break;
|
|
541
|
+
|
|
542
|
+
case "texteServeur":
|
|
543
|
+
if (debug) console.log("Reçu Broadcast:", msgRecu.value);
|
|
544
|
+
break;
|
|
545
|
+
|
|
546
|
+
default: if (debug) console.log("Le simulateur reçoit un message inconnu", msgRecu);
|
|
547
|
+
break;
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
ws.onerror = function (event) {
|
|
552
|
+
console.log("simulateur.js : received ERROR on WS");
|
|
553
|
+
/* console.log( "reconnecting...");
|
|
554
|
+
setTimeout(function() {
|
|
555
|
+
initTempi();
|
|
556
|
+
initWSSocket(port);
|
|
557
|
+
}, 5000);*/
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
ws.onclose = function (event) {
|
|
561
|
+
//console.log( "simulateur.js : on CLOSE on WS");
|
|
562
|
+
setTimeout(function () { initWSSocket(port); }, 3000);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
//- Attention d'avoir initialisation avant de faire server.addEventListener('DAWStatus', function( event )---
|
|
567
|
+
// Cette fonction de remise à jour de l'affichage est appelée sur plusieurs évènements :
|
|
568
|
+
// onload, Modif DAW, Modif sur groupe de sons, reconnexion, rechargement de la page.
|
|
569
|
+
|
|
570
|
+
function initialisation() {
|
|
571
|
+
if (debug) console.log("simulateur.js:initialisation: PSEUDO ", pseudo);
|
|
572
|
+
sendPseudo(pseudo);
|
|
573
|
+
}
|
|
574
|
+
exports.initialisation = initialisation;
|
|
575
|
+
|
|
576
|
+
function init(port) {
|
|
577
|
+
initWSSocket(port);
|
|
578
|
+
}
|
|
579
|
+
exports.init = init;
|
|
580
|
+
|
|
581
|
+
function actionSurDAWON() {
|
|
582
|
+
if (DAWON == false) {
|
|
583
|
+
if (debug) console.log("simulateur.js:actionSurDAWON:false");
|
|
584
|
+
initialisation();
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
if (debug) console.log("simulateur.js:actionSurDAWON:true:", DAWON);
|
|
589
|
+
initialisation(); //Pour le cas où le client recharge sa page en cours d'interaction
|
|
590
|
+
selectListClips(); // Pour le déclenchement de la simulation
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
function actionSurGroupeClientStatus(sons, status) {
|
|
594
|
+
if (DAWON == false) {
|
|
595
|
+
if (debug) console.log("simulateur.js:actionSurGroupeClientStatus:DAWON:false");
|
|
596
|
+
initialisation();
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
if (debug) console.log("WS actionSurGroupeClientStatus:", monGroupe);
|
|
600
|
+
|
|
601
|
+
if (sons == "" || sons == undefined) {
|
|
602
|
+
} else {
|
|
603
|
+
if (status) {
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
//========== Controle des CLIPS =================================
|
|
609
|
+
function selectListClips() { // selecteurV2
|
|
610
|
+
if (debug) console.log("selectListClips: groupe", monGroupe);
|
|
611
|
+
ws.send(JSON.stringify({
|
|
612
|
+
type: "selectAllClips",
|
|
613
|
+
groupe: monGroupe
|
|
614
|
+
}));
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
// ========================= Lancement du simulateur =================
|
|
618
|
+
init(port);
|
|
619
|
+
|
|
620
|
+
// Le principe est de demander la liste des clips périodiquement.
|
|
621
|
+
// Le serveur renvoie la liste avec le message "listClips" et on envoie alors
|
|
622
|
+
// un clip au hasard dans la liste disponible.
|
|
623
|
+
// C'est bavard au niveau réseau cas on sollicite abusivement le serveur sur les listes de clip
|
|
624
|
+
// mais c'est une simulation.
|
|
625
|
+
|
|
626
|
+
setTimeout(() => selectListClips(), 1000);
|
|
627
|
+
|
|
628
|
+
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use hiphop"
|
|
2
|
+
"use hopscript"
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var hh = require( "hiphop" );
|
|
6
|
+
|
|
7
|
+
hiphop module prg( O ) {
|
|
8
|
+
loop {
|
|
9
|
+
signal S = 1;
|
|
10
|
+
|
|
11
|
+
emit S( S.preval + 1 );
|
|
12
|
+
emit O( S.nowval );
|
|
13
|
+
yield;
|
|
14
|
+
emit O( O.preval );
|
|
15
|
+
yield;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
exports.prg = new hh.ReactiveMachine( prg, "emitvaluedlocal1" );
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
var hh;
|
|
23
|
+
var __hh_module;
|
|
24
|
+
let prg;hh=require("hiphop");
|
|
25
|
+
__hh_module=require("hiphop");
|
|
26
|
+
|
|
27
|
+
prg=__hh_module.MODULE({"id":"prg","%location":{"filename":"emitvaluedlocal1.hh.js","pos":69},"%tag":"module"},
|
|
28
|
+
__hh_module.SIGNAL({"%location":{"filename":"emitvaluedlocal1.hh.js","pos":81},"direction":"INOUT","name":"O"}),
|
|
29
|
+
__hh_module.LOOP({"%location":{"filename":"emitvaluedlocal1.hh.js","pos":90}},
|
|
30
|
+
__hh_module.LOCAL({"%location":{"filename":"emitvaluedlocal1.hh.js","pos":103},"%tag":"signal"},
|
|
31
|
+
__hh_module.SIGNAL(
|
|
32
|
+
{"name":"S",
|
|
33
|
+
"init_func":function (){return 1;}
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
__hh_module.EMIT(
|
|
37
|
+
{"%location":{"filename":"emitvaluedlocal1.hh.js","pos":135},
|
|
38
|
+
"%tag":"emit",
|
|
39
|
+
"S":"S",
|
|
40
|
+
"apply":function (){return ((() => {const S=this["S"];return S.preval + 1;})());
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
__hh_module.SIGACCESS({"signame":"S","pre":true,"val":true,"cnt":false})),
|
|
44
|
+
__hh_module.EMIT({"%location":{"filename":"emitvaluedlocal1.hh.js","pos":165},"%tag":"emit","O":"O","apply":function (){return ((() => {const S=this["S"];return S.nowval;})());}
|
|
45
|
+
},
|
|
46
|
+
__hh_module.SIGACCESS({"signame":"S","pre":false,"val":true,"cnt":false})),
|
|
47
|
+
__hh_module.PAUSE({"%location":{"filename":"emitvaluedlocal1.hh.js","pos":186},"%tag":"yield"}),__hh_module.EMIT({"%location":{"filename":"emitvaluedlocal1.hh.js","pos":204},"%tag":"emit","O":"O","apply":function (){return ((() => {const O=this["O"];return O.preval;})());}
|
|
48
|
+
},
|
|
49
|
+
__hh_module.SIGACCESS({"signame":"O","pre":true,"val":true,"cnt":false})),
|
|
50
|
+
__hh_module.PAUSE({"%location":{"filename":"emitvaluedlocal1.hh.js","pos":225},"%tag":"yield"}))));
|
|
51
|
+
|
|
52
|
+
exports.prg=new hh.ReactiveMachine(prg,"emitvaluedlocal1")
|