nodeskini 1.0.3 → 1.0.6

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.
Files changed (182) hide show
  1. package/blocklySkini/scripts/hiphop_blocks.js +3991 -6104
  2. package/blocklySkini/scripts/main2.js +4 -4
  3. package/client/clientListe/clientListe.js +11 -0
  4. package/client/clientListe/clientListebundle.js +1755 -1909
  5. package/client/configurateur/configReact.js +1 -1
  6. package/client/configurateur/configReactbundle.js +16 -10
  7. package/client/configurateur/src/configReact.js +1 -1
  8. package/client/parametrage/paramReact.js +1 -1
  9. package/client/parametrage/paramReactbundle.js +6 -5
  10. package/client/parametrage/src/paramReact.js +2 -2
  11. package/client/score/parto1.js +4 -1
  12. package/client/score/parto1bundle.js +45 -23
  13. package/client/simulateurListe/simulateurFork.mjs +1 -1
  14. package/client/simulateurListe/simulateurListe.js +3 -3
  15. package/doc/Doc Skini Node english.pdf +0 -0
  16. package/doc/Mode d'emploi Skini Node.pdf +0 -0
  17. package/doc/Tuto Skini.pdf +0 -0
  18. package/doc/quickstart.pdf +0 -0
  19. package/myReact/orchestrationHH.hh.js +2024 -0
  20. package/myReact/orchestrationHH.mjs +262 -420
  21. package/myReact/orchestrationHH.mjs.map +1 -1
  22. package/package.json +19 -11
  23. package/pieces/tutos/demoAbleton.csv +21 -0
  24. package/pieces/tutos/demoAbleton.js +100 -0
  25. package/pieces/tutos/demoAbleton.xml +180 -0
  26. package/pieces/tutos/demoHH.js +99 -0
  27. package/pieces/tutos/demoHH.xml +184 -0
  28. package/pieces/tutos/demoHHwait.js +100 -0
  29. package/pieces/tutos/demoHHwait.xml +175 -0
  30. package/pieces/tutos/tuto.csv +10 -0
  31. package/pieces/tutos/tuto.csv.good +1 -0
  32. package/pieces/tutos/tuto1.js +105 -0
  33. package/pieces/tutos/tuto1.xml +147 -0
  34. package/pieces/tutos/tuto10.back.js +106 -0
  35. package/pieces/tutos/tuto10.js +107 -0
  36. package/pieces/tutos/tuto10.xml +199 -0
  37. package/pieces/tutos/tuto11.js +111 -0
  38. package/pieces/tutos/tuto11.xml +124 -0
  39. package/pieces/tutos/tuto12.js +91 -0
  40. package/pieces/tutos/tuto12.xml +258 -0
  41. package/pieces/tutos/tuto2.back.js +106 -0
  42. package/pieces/tutos/tuto2.js +95 -0
  43. package/pieces/tutos/tuto2.xml +94 -0
  44. package/pieces/tutos/tuto3-2.js +105 -0
  45. package/pieces/tutos/tuto3-2.xml +96 -0
  46. package/pieces/tutos/tuto3.js +97 -0
  47. package/pieces/tutos/tuto3.xml +49 -0
  48. package/pieces/tutos/tuto4.js +107 -0
  49. package/pieces/tutos/tuto4.xml +106 -0
  50. package/pieces/tutos/tuto5.js +109 -0
  51. package/pieces/tutos/tuto5.xml +42 -0
  52. package/pieces/tutos/tuto6.js +105 -0
  53. package/pieces/tutos/tuto6.xml +26 -0
  54. package/pieces/tutos/tuto7.js +107 -0
  55. package/pieces/tutos/tuto7.xml +65 -0
  56. package/pieces/tutos/tuto8.js +105 -0
  57. package/pieces/tutos/tuto8.xml +76 -0
  58. package/pieces/tutos/tuto9.js +107 -0
  59. package/pieces/tutos/tuto9.xml +90 -0
  60. package/pieces/tutos/tutoAwait.js +111 -0
  61. package/pieces/tutos/tutoAwait.xml +171 -0
  62. package/pieces/tutos/tutoDoubleEmission.js +93 -0
  63. package/pieces/tutos/tutoDoubleEmission.xml +65 -0
  64. package/pieces/tutos/tutoESP32.js +104 -0
  65. package/pieces/tutos/tutoESP32.xml +246 -0
  66. package/pieces/tutos/tutoGame.js +126 -0
  67. package/pieces/tutos/tutoGame.xml +109 -0
  68. package/pieces/tutos/tutoGroups1.js +111 -0
  69. package/pieces/tutos/tutoGroups1.xml +137 -0
  70. package/pieces/tutos/tutoGroups2.js +97 -0
  71. package/pieces/tutos/tutoGroups2.xml +103 -0
  72. package/pieces/tutos/tutoGroups3.js +111 -0
  73. package/pieces/tutos/tutoGroups3.xml +128 -0
  74. package/pieces/tutos/tutoGroups4.js +111 -0
  75. package/pieces/tutos/tutoGroups4.xml +84 -0
  76. package/pieces/tutos/tutoIZ.js +95 -0
  77. package/pieces/tutos/tutoIZ.xml +135 -0
  78. package/pieces/tutos/tutoIf.js +111 -0
  79. package/pieces/tutos/tutoIf.xml +126 -0
  80. package/pieces/tutos/tutoMidi.js +126 -0
  81. package/pieces/tutos/tutoMidi.xml +62 -0
  82. package/pieces/tutos/tutoOS.js +121 -0
  83. package/pieces/tutos/tutoOSC.js +109 -0
  84. package/pieces/tutos/tutoOSC.xml +223 -0
  85. package/pieces/tutos/tutoOSCJonathan.js +94 -0
  86. package/pieces/tutos/tutoOSCJonathan.xml +312 -0
  87. package/pieces/tutos/tutoPatternInGroup.js +109 -0
  88. package/pieces/tutos/tutoPatternInGroup.xml +116 -0
  89. package/pieces/tutos/tutoRandomBlock.js +129 -0
  90. package/pieces/tutos/tutoRandomBlock.xml +194 -0
  91. package/pieces/tutos/tutoSuspend.js +107 -0
  92. package/pieces/tutos/tutoSuspend.xml +139 -0
  93. package/pieces/tutos/tutoSustain.js +107 -0
  94. package/pieces/tutos/tutoSustain.xml +109 -0
  95. package/pieces/tutos/tutoTank.csv +9 -0
  96. package/pieces/tutos/tutoTank.js +100 -0
  97. package/pieces/tutos/tutoTank.xml +326 -0
  98. package/pieces/tutos/tutoTestAll.csv +11 -0
  99. package/pieces/tutos/tutoTestAll.js +101 -0
  100. package/pieces/tutos/tutoTestAll.xml +859 -0
  101. package/serveur/OSCandMidi.mjs +7 -5
  102. package/serveur/controleDAW.mjs +3 -2
  103. package/serveur/defaultSkiniParametres.js +20 -13
  104. package/serveur/groupeClientsSons.mjs +10 -5
  105. package/serveur/ipConfig.json +2 -2
  106. package/serveur/midimix.mjs +13 -13
  107. package/serveur/saveParam.mjs +4 -15
  108. package/serveur/skiniParametres.js +108 -26
  109. package/serveur/utilsHHSkini.hh.js +64 -64
  110. package/serveur/websocketServer.mjs +2090 -2052
  111. package/serveur/workerInterfaceZ.mjs +4 -7
  112. package/blocklySkini/archive/blocklyControleur.js +0 -87
  113. package/blocklySkini/archive/blocklySkini.js +0 -84
  114. package/blocklySkini/archive/blocklyhop.js +0 -75
  115. package/blocklySkini/archive/clientControleurBlocly.js +0 -170
  116. package/blocklySkini/archive/index.html +0 -76
  117. package/blocklySkini/archive/testHHsuspend.txt +0 -89
  118. package/blocklySkini/archive/testHHtrap.txt +0 -262
  119. package/blocklySkini/archive/testOrchestration.txt +0 -177
  120. package/blocklySkini/archive/testOrchestration.xml +0 -447
  121. package/blocklySkini/archive/testOrchestration2.xml +0 -456
  122. package/myReact/archive/Nodeemitvaluedlocal1.hh.js +0 -52
  123. package/myReact/archive/abort-parNode.js +0 -79
  124. package/myReact/archive/abroNode.js +0 -169
  125. package/myReact/archive/abroNode2.js +0 -80
  126. package/myReact/archive/atom.compile.hh.js +0 -51
  127. package/myReact/archive/await-countNode.js +0 -67
  128. package/myReact/archive/await-nowvalNode.js +0 -44
  129. package/myReact/archive/callHH.js +0 -96
  130. package/myReact/archive/emit-if2.hh.compiled.js +0 -113
  131. package/myReact/archive/every1Node.js +0 -35
  132. package/myReact/archive/if-runNode.js +0 -74
  133. package/myReact/archive/if1Node.js +0 -43
  134. package/myReact/archive/makeawait.js +0 -0
  135. package/myReact/archive/myReact.old.js +0 -684
  136. package/myReact/archive/orchestration.js +0 -281
  137. package/myReact/archive/orchestration1.js +0 -132
  138. package/myReact/archive/orchestration1.xml +0 -465
  139. package/myReact/archive/orchestration2.js +0 -161
  140. package/myReact/archive/orchestrationHH.mano.js +0 -280
  141. package/myReact/archive/orchestrationHHTest.js +0 -428
  142. package/myReact/archive/orchestrationHHTest.xml +0 -234
  143. package/myReact/archive/orchestrationHHTestRun.js +0 -104
  144. package/myReact/archive/orchestrationHHTestRun.xml +0 -34
  145. package/myReact/archive/orchestrationTest0.js +0 -178
  146. package/myReact/archive/orchestrationTest1.js +0 -181
  147. package/myReact/archive/orchestrationTest2.js +0 -281
  148. package/myReact/archive/run3pointsNode.js +0 -59
  149. package/myReact/archive/runNode.js +0 -123
  150. package/myReact/archive/runNode2.js +0 -91
  151. package/myReact/archive/testAwait1.js +0 -141
  152. package/myReact/archive/testAwait1.xml +0 -86
  153. package/myReact/archive/testEvery1.js +0 -122
  154. package/myReact/archive/testEvery1.xml +0 -79
  155. package/myReact/archive/testHH1.js +0 -135
  156. package/myReact/archive/testHH1.xml +0 -86
  157. package/myReact/archive/testHH1revu.js +0 -104
  158. package/myReact/archive/testHH2.js +0 -122
  159. package/myReact/archive/testHH2.xml +0 -79
  160. package/myReact/archive/testHH3.js +0 -130
  161. package/myReact/archive/testHH3.xml +0 -86
  162. package/myReact/archive/testHHabort.js +0 -121
  163. package/myReact/archive/testHHabort.xml +0 -83
  164. package/myReact/archive/testMakeawait.js +0 -202
  165. package/myReact/archive/testRun1.js +0 -168
  166. package/myReact/archive/testRun1.xml +0 -142
  167. package/myReact/archive/titi.js +0 -28
  168. package/myReact/archive/titi.xml +0 -110
  169. package/myReact/archive/toto.js +0 -73
  170. package/myReact/archive/toto.xml +0 -198
  171. package/myReact/archive/trap-await-parallelNode.js +0 -123
  172. package/myReact/inutiles/hiver2022.xml +0 -804
  173. package/myReact/inutiles/hopeNode.xml +0 -459
  174. package/myReact/inutiles/mars2022.xml +0 -871
  175. package/myReact/inutiles/mystique1.xml +0 -318
  176. package/myReact/inutiles/mystiqueOSC.xml +0 -277
  177. package/myReact/inutiles/opus5Node.xml +0 -1271
  178. package/myReact/inutiles/opus5NodeLinux.xml +0 -1241
  179. package/myReact/inutiles/orchestrationHH.xml +0 -541
  180. package/myReact/inutiles/orchestrationHH2.xml +0 -547
  181. package/myReact/inutiles/testHH.xml +0 -95
  182. package/myReact/inutiles/trouveLaPercuTenor.xml +0 -349
@@ -29,9 +29,6 @@ var sockData; // = dgram.createSocket('udp4');
29
29
  var sockMidi; // = dgram.createSocket('udp4');
30
30
  var sockMiniWI;
31
31
 
32
- var debug = true;
33
- var debug1 = true;
34
-
35
32
  var dataPort = 3005;
36
33
  var midiPort = 3006;
37
34
  var miniWiPort = 8888;
@@ -42,7 +39,7 @@ var interfaceZAddress = "192.168.1.250";
42
39
  var interfaceZMidiPort = 1000;
43
40
 
44
41
  var debug = false;
45
- var debug1 = false;
42
+ var debug1 = true;
46
43
  var tempoSensorsInit = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,];
47
44
  var tempoSensors = tempoSensorsInit.slice();
48
45
  var previousSensorsValues = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
@@ -52,6 +49,7 @@ var sensorsRunning = false;
52
49
  console.log("INFO: workerInterfaceZ: Start Interface Z worker");
53
50
 
54
51
  function displaySignal(sensor, value) {
52
+ if(debug) console.log("worker IZ : ");
55
53
  process.stdout.write(sensor.toString() + ': ');
56
54
  for (var i = 0; i < value/100; i++) {
57
55
  process.stdout.write("*");
@@ -62,7 +60,6 @@ function displaySignal(sensor, value) {
62
60
  function displaySignalMiniWi(value) {
63
61
  var val;
64
62
  for (var j = 0; j < 4; j++) {
65
-
66
63
  val = value[j] / 100;
67
64
  if (val !== 0) {
68
65
  process.stdout.write(j + 8 + ': ');
@@ -162,7 +159,7 @@ function initWorker() {
162
159
  if (
163
160
  message.args[i].value < previousSensorsValues[i] - sensorsSensibilities[i] ||
164
161
  message.args[i].value > previousSensorsValues[i] + sensorsSensibilities[i]) {
165
- if (debug1) displaySignal(i, Math.round(message.args[i].value));
162
+ if (debug) displaySignal(i, Math.round(message.args[i].value));
166
163
 
167
164
  messageToSend = {
168
165
  type: "INTERFACEZ_RC" + i,
@@ -288,7 +285,7 @@ function initWorker() {
288
285
  tempoSensors[i]--;
289
286
  }
290
287
  }
291
- displaySignalMiniWi(messMiniWi);
288
+ if(debug1) displaySignalMiniWi(messMiniWi);
292
289
  break;
293
290
 
294
291
  default:
@@ -1,87 +0,0 @@
1
- "use hiphop"
2
- "use hopscript"
3
-
4
- require.lang = "hopscript";
5
- require("./scripts/surLeServeurSkini.js", "hiphop");
6
- var par = require('../serveur/logosParametres');
7
-
8
- // Services dans d'autres fichiers, il faut aussi les déclarer ici
9
- service printServeurFromBlockly();
10
- service getFileBlockly();
11
- service saveBlocksServer();
12
- service generateHHcode();
13
-
14
- //console.log( "For Blockly, gGo to \"http://localhost:%d/hop/block\"", hop.port );
15
-
16
- service block() {
17
- return <html>
18
- <head>
19
- <link rel="stylesheet" href=${require.resolve("./styles/index.css")}>
20
- <script src="hiphop" lang="hopscript"/>
21
- // Déclarations nécessaires pour faire les requires sur le client.
22
- <script src="./scripts/hiphop_blocks.js" lang="hiphop"/>
23
- <script src="./scripts/main2.js" lang="hiphop"/>
24
- <script src='./clientControleurBlocly.js' lang='hopscript'/>
25
- <script src='../serveur/logosParametres' lang='hopscript'/>
26
- <meta charset="UTF-8" name="viewport" />
27
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
28
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
29
-
30
- <title>Blockly and Hop.js</title>
31
- </head>
32
- ~{
33
- var mainProg, clientControleur, printServeur;
34
- window.onload = function() {
35
- // Require correspondant aux déclarations ci-dessus
36
- require('./scripts/hiphop_blocks.js', "hiphop");
37
- mainProg = require('./scripts/main2.js');
38
- clientControleur = require('./clientControleurBlocly.js');
39
- printServeur = ${printServeurFromBlockly};
40
- console.log("mainprog");
41
- printServeur("-- Blockly for Skini started --").post();
42
- mainProg.init();
43
- clientControleur.init(${hop.port}, ${par});
44
- }
45
- }
46
- <body>
47
- <table>
48
- <thead>
49
- <tr>
50
- <td>
51
- <header class="mdl-color--cyan-500">
52
- <h1 class="mode-maker">Orchestration Skini</h1>
53
- <div id="menubar">
54
- <label for="loadFile" class="small button">Select Blockly File</label>
55
- <input type="file" id="loadFile" onchange=~{mainProg.loadBlocks();} />
56
-
57
- <button class="small button" id="buttonSave" onclick=~{mainProg.saveBlocksAndGenerateHH();} >Save Blocks</button>
58
- <input class="inputText" type="text" id="saveFile" />
59
- <input class="inputText" type="text" id="consoleArea" />
60
-
61
- <button class="small button" id="buttonLoadAbleton1" onclick=~{clientControleur.loadAbleton(1);} >ORCH1</button>
62
- <button class="small button" id="buttonLoadAbleton2" onclick=~{clientControleur.loadAbleton(2);} >ORCH2</button>
63
- <button class="small button" id="buttonLoadAbleton3" onclick=~{clientControleur.loadAbleton(3);} >ORCH3</button>
64
-
65
- <button id="buttonStopAutomate" class="small button" style="display:none" onclick=~{clientControleur.stopAutomate();} >AUT OFF</button>
66
- <button id="buttonStartAutomate" class="small button" onclick=~{clientControleur.startAutomate();} >AUT ON</button>
67
-
68
- </div>
69
- </header>
70
- </td>
71
- </tr>
72
- </thead>
73
- <tbody>
74
- <tr>
75
- <td id="blocklyArea"></td>
76
- </tr>
77
- </tbody>
78
- </table>
79
-
80
- <div id="blocklyDiv" style="position: absolute"></div>
81
- <script src=${block.resource("./blockly/blockly.min.js")}></script>
82
- <script src=${block.resource("./blockly/javascript_compressed.js")}></script>
83
- </body>
84
- </html>
85
- };
86
- exports.block = block;
87
-
@@ -1,84 +0,0 @@
1
- /**************************************************
2
-
3
- Editeur Skini en ligne avec Blockly
4
-
5
- © Copyright 2017-2021, Bertrand Petit-Hédelin
6
-
7
- ****************************************************/
8
-
9
- "use hiphop"
10
- "use hopscript"
11
-
12
- require.lang = "hopscript";
13
- require("./scripts/surLeServeurSkini.js", "hiphop");
14
-
15
- // Services dans d'autres fichiers, il faut aussi les déclarer ici
16
- service printServeurFromBlockly();
17
- service getFileBlockly();
18
- service saveBlocksServer();
19
- service generateHHcode();
20
-
21
- //console.log( "For Blockly, gGo to \"http://localhost:%d/hop/block\"", hop.port );
22
-
23
- service block() {
24
- return <html>
25
- <head>
26
- <link rel="stylesheet" href=${require.resolve("./styles/index.css")}>
27
- <script src="hiphop" lang="hopscript"/>
28
- // Déclarations nécessaires pour faire les requires sur le client.
29
- <script src="./scripts/hiphop_blocks.js" lang="hiphop"/>
30
- <script src="./scripts/main2.js" lang="hiphop"/>
31
- <meta charset="UTF-8" name="viewport" />
32
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
33
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
34
- <title>Blockly and Hop.js</title>
35
- </head>
36
- ~{
37
- var mainProg;
38
- window.onload = function() {
39
- // Require correspondant aux déclarations ci-dessus
40
- require('./scripts/hiphop_blocks.js', "hiphop");
41
- mainProg = require('./scripts/main2.js');
42
- var printServeur = ${printServeurFromBlockly};
43
- console.log("mainprog");
44
- printServeur("-- Blockly for Skini started --").post();
45
- mainProg.init();
46
- }
47
- }
48
- <body>
49
- <table>
50
- <thead>
51
- <tr>
52
- <td>
53
- <header class="mdl-color--cyan-500">
54
- <h1 class="mode-maker">Orchestration Skini</h1>
55
- <div id="menubar">
56
- <!--
57
- <button class="small button" id="buttonGenerate" onclick=~{mainProg.save();} >Generate HipHop</button>
58
- -->
59
- <label for="loadFile" class="small button">Select Blockly File</label>
60
- <input type="file" id="loadFile" onchange=~{mainProg.loadBlocks();} />
61
-
62
- <button class="small button" id="buttonSave" onclick=~{mainProg.saveBlocksAndGenerateHH();} >Save Blocks</button>
63
- <input class="inputText" type="text" id="saveFile" />
64
- <input class="inputText" type="text" id="consoleArea" />
65
- </div>
66
- </header>
67
- </td>
68
- </tr>
69
- </thead>
70
- <tbody>
71
- <tr>
72
- <td id="blocklyArea"></td>
73
- </tr>
74
- </tbody>
75
- </table>
76
-
77
- <div id="blocklyDiv" style="position: absolute"></div>
78
- <script src=${block.resource("./blockly/blockly.min.js")}></script>
79
- <script src=${block.resource("./blockly/javascript_compressed.js")}></script>
80
- </body>
81
- </html>
82
- };
83
- exports.block = block;
84
-
@@ -1,75 +0,0 @@
1
- "use hiphop"
2
- "use hopscript"
3
-
4
- require.lang = "hopscript";
5
- require("./scripts/surLeServeur.js", "hiphop");
6
-
7
-
8
- // Services dans d'autres fichiers, il faut aussi les déclarer ici
9
- service printServeur();
10
- //service executeHHServeur();
11
-
12
- console.log( "Go to \"http://localhost:%d/hop/block\"", hop.port );
13
-
14
- service block() {
15
- return <html>
16
- <head>
17
- <link rel="stylesheet" href=${require.resolve("./styles/index.css")}>
18
- <script src="hiphop" lang="hopscript"/>
19
- // Déclarations nécessaires pour faire les requires sur le client.
20
- <script src="./scripts/hiphop_blocks.js" lang="hiphop"/>
21
- <script src="./scripts/main2.js" lang="hiphop"/>
22
- <meta charset="UTF-8" name="viewport" />
23
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
24
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
25
- <title>Blockly and Hop.js</title>
26
- </head>
27
- ~{
28
- var mainProg;
29
- window.onload = function() {
30
- // Require correspondant aux déclarations ci-dessus
31
- require('./scripts/hiphop_blocks.js', "hiphop");
32
- mainProg = require('./scripts/main2.js');
33
- var printServeur = ${printServeur};
34
- console.log("mainprog");
35
- printServeur("declaration").post();
36
- mainProg.init();
37
- }
38
- }
39
- <body>
40
- <table>
41
- <tbody>
42
- <tr>
43
- <td>
44
- <header class="mdl-color--cyan-500">
45
- <h1 class="mode-maker">HipHop Orchestration</h1>
46
- <div id="menubar">
47
- <button class="small button" id="buttonGenerate" onclick=~{mainProg.save();} >Generate HipHop</button>
48
-
49
- <button class="small button" id="runButton" onclick=~{mainProg.runHH();} >Run HipHop</button>
50
- <input class="inputText" type="text" id="signalsHH" style="max-width:400px" />
51
-
52
- <label for="loadFile" class="small button">Select File</label>
53
- <input type="file" id="loadFile" onchange=~{mainProg.loadBlocks();} />
54
-
55
- <button class="small button" id="buttonSave" onclick=~{mainProg.saveBlocks();} >Save Blocks</button>
56
- <input class="inputText" type="text" id="saveFile" style="max-width:400px" />
57
- </div>
58
- </header>
59
- </td>
60
- </tr>
61
- <tr>
62
- <td id="blocklyArea">
63
- </td>
64
- </tr>
65
- </tbody>
66
- </table>
67
-
68
- <div id="blocklyDiv" style="position: absolute"></div>
69
- <script src=${block.resource("./blockly/blockly.min.js")}></script>
70
- <script src=${block.resource("./blockly/javascript_compressed.js")}></script>
71
- </body>
72
- </html>
73
- };
74
- exports.block = block;
75
-
@@ -1,170 +0,0 @@
1
-
2
- /**************************************************
3
-
4
- Pour compiler et lancer l'orchestration depuis
5
- le client Blockly.
6
- Permet de se passer du contrôleur pendant le
7
- développement.
8
-
9
- © Copyright 2017-2021, Bertrand Petit-Hédelin
10
-
11
- ****************************************************/
12
- "use strict"
13
- "use hopscript"
14
-
15
- var port;
16
- var par;
17
- var ws;
18
- var id = Math.floor((Math.random() * 1000000) + 1 ); // Pour identifier le client;
19
-
20
- var debug = false;
21
- var debug1 = true;
22
-
23
- var abletonTableEnCours = 0;
24
- var automateEncours = false;
25
-
26
- // Autres déclarations
27
-
28
- var msg = { // On met des valeurs pas defaut, mais ce n'est pas nécessaire.
29
- type: "configuration",
30
- };
31
-
32
- service controleur();
33
- service controleurPing();
34
-
35
- function cleanQueues() {
36
- var msg = {
37
- type: "cleanQueues",
38
- };
39
- ws.send(JSON.stringify(msg));
40
- }
41
- exports.cleanQueues = cleanQueues;
42
-
43
- //****** Lancement des opérations et fermeture *********
44
-
45
- function init(port, p) {
46
- par = p;
47
- initWSSocket( port );
48
- }
49
- exports.init = init;
50
-
51
- // Gestion de la fermeture du browser
52
- window.onbeforeunload = function () {
53
- msg.type = "closeSpectateur";
54
- msg.text = "DISCONNECT_SPECTATEUR";
55
- ws.send(JSON.stringify(msg));
56
- ws.close();
57
- }
58
-
59
- function loadAbleton(val) {
60
- if ( !automateEncours) {
61
- console.log("clientControleur:loadAbleton:", val);
62
- msg.type = "loadAbletonTable";
63
- msg.value = val -1; // Pour envoyer un index
64
- abletonTableEnCours = val;
65
- ws.send(JSON.stringify(msg));
66
- } else {
67
- alert("WARNING: Orchestration running, stop before selecting another one.")
68
- }
69
- }
70
- exports.loadAbleton = loadAbleton;
71
-
72
- function startAutomate() {
73
- msg.type = "setAbletonON";
74
- if (abletonTableEnCours !== 0 && !automateEncours) {
75
- msg.value = abletonTableEnCours;
76
- ws.send(JSON.stringify(msg));
77
- document.getElementById( "buttonStartAutomate").style.display = "none";
78
- document.getElementById( "buttonStopAutomate").style.display = "inline";
79
- msg.type = "startAutomate";
80
- ws.send(JSON.stringify(msg));
81
- automateEncours = true;
82
- } else {
83
- alert("WARNING: No orchestration selected or one is running ");
84
- }
85
- }
86
- exports.startAutomate = startAutomate;
87
-
88
- function stopAutomate() {
89
- document.getElementById( "buttonStartAutomate").style.display = "inline";
90
- document.getElementById( "buttonStopAutomate").style.display = "none";
91
- msg.type = "stopAutomate";
92
- ws.send(JSON.stringify(msg));
93
- automateEncours = false;
94
- cleanQueues();
95
- }
96
- exports.stopAutomate = stopAutomate;
97
-
98
- //************ WEBSOCKET HOP et listener BROADCAST ******************************
99
- function initWSSocket(port) {
100
-
101
- ws = new WebSocket( "ws://" + par.serverIPAddress + ":" + port + "/hop/serv", [ "bar", "foo" ] );
102
-
103
- if (debug) console.log("clientcontroleur.js WS: ", "ws://" + par.serverIPAddress + ":" + port + "/hop/serv" );
104
- ws.onopen = function( event ) {
105
- msg.type = "startSpectateur";
106
- msg.text = "controleur";
107
- msg.id = id;
108
- console.log("ID sent to server:", msg.id);
109
- ws.send(JSON.stringify(msg));
110
- };
111
-
112
- //Traitement de la Réception sur le client
113
- ws.onmessage = function( event ) {
114
- //console.log( "Client: received [%s]", event.data );
115
-
116
- var msgRecu = JSON.parse(event.data);
117
-
118
- switch(msgRecu.type) {
119
- case "abletonTableNotReady": // Si la table n'est pas chargée on garde le bouton start
120
- alert("Orchestration not ready");
121
- document.getElementById( "buttonStartAutomate").style.display = "inline";
122
- document.getElementById( "buttonStopAutomate").style.display = "none";
123
- automateEncours = false;
124
- break;
125
-
126
- case "groupesClientLength":
127
- break;
128
-
129
- case "noAutomaton":
130
- //document.getElementById("consoleArea").innerHTML = "No automaton at this position";
131
- console.log("No automaton at this position");
132
- automateEncours = false;
133
- break;
134
-
135
- case "sessionLoaded":
136
- document.getElementById("consoleArea").innerHTML = "Orchestration loaded :" + msgRecu.fileName;
137
- break;
138
-
139
- case "message":
140
- if (debug) console.log(msgRecu.text);
141
- break;
142
-
143
- default: if (debug) console.log("Le Client reçoit un message inconnu", msgRecu );
144
- }
145
- };
146
-
147
- ws.onerror = function (event) {
148
- if (debug) console.log( "clientcontroleur.js : received error on WS", ws.socket, " ", event );
149
- }
150
-
151
- // Mécanisme de reconnexion automatique si le serveur est tombé.
152
- // Le service Ping permet de vérifier le présence du serveur
153
- ws.onclose = function( event ) {
154
- if (debug1) console.log( "clientcontroleur.js : ON CLOSE");
155
-
156
- /* (function loop() {
157
- if (!debug) {
158
- controleurPing()
159
- .post()
160
- .then(function(){ // Si serveur présent
161
- document.location=controleur();
162
- },
163
- function(){ // Si serveur absent
164
- if (debug) console.log( "reconnecting..." );
165
- setTimeout( loop, 2000 );
166
- } );
167
- }
168
- })();*/
169
- }
170
- }
@@ -1,76 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
-
8
- <title>Blockly for the Web Codelab modified for test</title>
9
- <link rel="stylesheet" href="styles/material.css">
10
- <link rel="stylesheet" href="styles/index.css">
11
- </head>
12
-
13
- <body mode="maker">
14
- <header class="mdl-color--cyan-500">
15
- <h1 class="mode-maker">Music Maker</h1>
16
- <h1 class="mode-edit mode-blockly">Music Maker Configuration</h1>
17
- </header>
18
-
19
- <main>
20
- <button class="mode-maker mdl-button" id="edit">Edit</button>
21
- <button class="mode-edit mdl-button mdl-js-button" id="done">Done</button>
22
- <button class="mode-blockly mdl-button mdl-js-button" id="save">Save</button>
23
- <p class="hint mode-edit">Tap any button to edit its code. <br/>When complete, press Done.</p>
24
-
25
- <div class="maker">
26
- <div>
27
- <div class="button mdl-color--amber-500">1</div>
28
- <div class="button mdl-color--yellow-500">2</div>
29
- <div class="button mdl-color--lime-500">3</div>
30
- </div>
31
- <div>
32
- <div class="button mdl-color--pink-500">4</div>
33
- <div class="button mdl-color--red-500">5</div>
34
- <div class="button mdl-color--light-green-500">6</div>
35
- </div>
36
- <div>
37
- <div class="button mdl-color--cyan-500">7</div>
38
- <div class="button mdl-color--teal-500">8</div>
39
- <div class="button mdl-color--green-500">9</div>
40
- </div>
41
- </div>
42
-
43
- <div id="textarea" style="height: 480px; width: 600px;">TATU</div>
44
-
45
- <div class="blockly-editor">
46
- <div id="blocklyDiv" style="height: 480px; width: 400px;"></div>
47
- <xml id="toolbox" style="display: none">
48
- <block type="controls_repeat_ext">
49
- <value name="TIMES">
50
- <shadow type="math_number">
51
- <field name="NUM">5</field>
52
- </shadow>
53
- </value>
54
- </block>
55
-
56
- <block type="play_sound"></block>
57
- <block type="controls_if"></block>
58
- <block type="controls_whileUntil"></block>
59
- <block type="logic_compare"></block>
60
- <block type="math_number"></block>
61
- <block type="math_arithmetic"></block>
62
- <block type="text"></block>
63
- <block type="text_print"></block>
64
- <block type="testblock"></block>
65
- </xml>
66
- </div>
67
- </main>
68
-
69
- <script src="../../node_modules/blockly/blockly.min.js"></script>
70
- <script src="../../node_modules/blockly/javascript_compressed.js"></script>
71
- <script src="scripts/music_maker.js"></script>
72
- <script src="scripts/sound_blocks.js"></script>
73
- <script src="scripts/main.js"></script>
74
-
75
- </body>
76
- </html>
@@ -1,89 +0,0 @@
1
- <xml xmlns="https://developers.google.com/blockly/xml">
2
- <block type="moduleHH" id="v2t[RRH#q_s+cS#zYW[w" x="-269" y="-428">
3
- <statement name="SIGNAL">
4
- <block type="declare_signal" id="r5#cGH7)be]}33gDk#LQ">
5
- <value name="signal">
6
- <block type="text" id="=*1X^P*hecyI3Pm{LVX@">
7
- <field name="TEXT">toto</field>
8
- </block>
9
- </value>
10
- <next>
11
- <block type="declare_signal" id="6}HV-=4(!wb[DgY2ei:g">
12
- <value name="signal">
13
- <block type="text" id="6kyaz#cw:tfXW[{FX,z|">
14
- <field name="TEXT">tata</field>
15
- </block>
16
- </value>
17
- <next>
18
- <block type="declare_signal" id="2GEjT/j80ScG,bZwM5Zn">
19
- <value name="signal">
20
- <block type="text" id="k=3eY*di35K{~G;d/_Kn">
21
- <field name="TEXT">titi</field>
22
- </block>
23
- </value>
24
- </block>
25
- </next>
26
- </block>
27
- </next>
28
- </block>
29
- </statement>
30
- <statement name="NAME">
31
- <block type="suspend" id="_hiP[PvG)Qsyov@);K^D">
32
- <value name="SUSPEND0">
33
- <block type="count_signal" id="aY6z%g(BnS6:7*@)%~Bo">
34
- <field name="count">1</field>
35
- <value name="signal">
36
- <block type="now" id="|V0^AVl/^u.yc$ln~e7H">
37
- <value name="signal">
38
- <block type="text" id="(s*O/+jD@kNR~!?9Z#0W">
39
- <field name="TEXT">titi</field>
40
- </block>
41
- </value>
42
- </block>
43
- </value>
44
- </block>
45
- </value>
46
- <statement name="DO0">
47
- <block type="every" id="Y4cv--DzCMqxEGKV+EJw">
48
- <value name="EVERY0">
49
- <block type="logic_operation" id="Ds;ROw(=gBCxli2=F]Wq">
50
- <field name="OP">AND</field>
51
- <value name="A">
52
- <block type="now" id="mk=y@N@WWSbwGorKdefk">
53
- <value name="signal">
54
- <block type="text" id="fy|bnElL?ZdNN-:9.0w%">
55
- <field name="TEXT">toto</field>
56
- </block>
57
- </value>
58
- </block>
59
- </value>
60
- <value name="B">
61
- <block type="now" id="v1sPM(9dU64_KGhT6s;6">
62
- <value name="signal">
63
- <block type="text" id="*nJ,4h#W:24A=iIP;I|a">
64
- <field name="TEXT">tata</field>
65
- </block>
66
- </value>
67
- </block>
68
- </value>
69
- </block>
70
- </value>
71
- <statement name="DO0">
72
- <block type="JS_statement" id="I|hNEBc+bF~pq5wT[#Xm">
73
- <statement name="NAME">
74
- <block type="print_serveur" id="mXXfJ;^sU#5$gCCTz?(K">
75
- <value name="signal">
76
- <block type="text" id="SrtV1(=LU2R/zpS2hEgd">
77
- <field name="TEXT">toto</field>
78
- </block>
79
- </value>
80
- </block>
81
- </statement>
82
- </block>
83
- </statement>
84
- </block>
85
- </statement>
86
- </block>
87
- </statement>
88
- </block>
89
- </xml>