mercury-engine 1.0.4 → 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.
- package/README.md +5 -4
- package/dist/mercury.js +16 -10
- package/dist/mercury.min.es5.js +1 -1
- package/dist/mercury.min.js +1 -1
- package/examples/basic/index.html +5 -2
- package/examples/errors/index.html +78 -0
- package/examples/midi/index.html +1 -1
- package/index.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,15 +13,16 @@ Mercury currently has 2 versions:
|
|
|
13
13
|
|
|
14
14
|
[**🚀 Start Sketching Online!** (recommended for beginners)](https://mercury.timohoogland.com/)
|
|
15
15
|
|
|
16
|
-
**👾 Or code with the latest full version in Max8:**
|
|
17
|
-
|
|
16
|
+
<!-- **👾 Or code with the latest full version in Max8:** -->
|
|
18
17
|
<!-- [](https://github.com/tmhglnd/mercury/releases)
|
|
19
18
|
|
|
20
19
|
[**📟 Build a local app from the browser version with Electron**](https://github.com/tmhglnd/mercury-app) -->
|
|
21
20
|
|
|
22
|
-
[
|
|
21
|
+
<!-- [**💬 Join the Mercury Community on Discord**](https://discord.gg/vt59NYU) -->
|
|
23
22
|
|
|
24
|
-
[
|
|
23
|
+
[](https://discord.gg/vt59NYU)
|
|
24
|
+
[](https://ko-fi.com/I2I3SV7FX)
|
|
25
|
+
[](https://www.patreon.com/bePatron?u=9649817)
|
|
25
26
|
|
|
26
27
|
<!--  -->
|
|
27
28
|
|
package/dist/mercury.js
CHANGED
|
@@ -16064,11 +16064,10 @@ class MonoSample extends Instrument {
|
|
|
16064
16064
|
// get the start position
|
|
16065
16065
|
let o = dur * Util.getParam(this._pos, c);
|
|
16066
16066
|
|
|
16067
|
-
// when sample is loaded
|
|
16068
|
-
|
|
16069
|
-
|
|
16070
|
-
|
|
16071
|
-
// }
|
|
16067
|
+
// when sample is loaded allow playback to start
|
|
16068
|
+
if (this.sample.loaded){
|
|
16069
|
+
this.sample.start(time, o);
|
|
16070
|
+
}
|
|
16072
16071
|
}
|
|
16073
16072
|
|
|
16074
16073
|
sound(s){
|
|
@@ -17245,7 +17244,8 @@ class MercuryInterpreter {
|
|
|
17245
17244
|
// return if the code contains any syntax errors
|
|
17246
17245
|
Util.log(`Could not run because of syntax error`);
|
|
17247
17246
|
Util.log(`Please see Help for more information`);
|
|
17248
|
-
return
|
|
17247
|
+
// return the parsetree also if there are errors
|
|
17248
|
+
return this.parse;
|
|
17249
17249
|
}
|
|
17250
17250
|
// if no errors the last evaluated code is stored
|
|
17251
17251
|
this._code = c;
|
|
@@ -17280,7 +17280,9 @@ class MercuryInterpreter {
|
|
|
17280
17280
|
'silence' : (mute) => {
|
|
17281
17281
|
if (mute){
|
|
17282
17282
|
// engine.silence();
|
|
17283
|
-
this.silence()
|
|
17283
|
+
if (this.silence()){
|
|
17284
|
+
return;
|
|
17285
|
+
}
|
|
17284
17286
|
}
|
|
17285
17287
|
},
|
|
17286
17288
|
'scale' : (args) => {
|
|
@@ -17427,6 +17429,8 @@ class MercuryInterpreter {
|
|
|
17427
17429
|
this.p5canvas.display();
|
|
17428
17430
|
});
|
|
17429
17431
|
}
|
|
17432
|
+
// return the parsetree to see from outside
|
|
17433
|
+
return this.parse;
|
|
17430
17434
|
}
|
|
17431
17435
|
}
|
|
17432
17436
|
module.exports = { MercuryInterpreter }
|
|
@@ -17552,7 +17556,7 @@ class Mercury extends MercuryInterpreter {
|
|
|
17552
17556
|
Tone.Transport.timeSignature = [4, 4];
|
|
17553
17557
|
// a bit latency on start for safety
|
|
17554
17558
|
Tone.Transport.start('+0.1');
|
|
17555
|
-
console.log('Resumed Transport');
|
|
17559
|
+
// console.log('Resumed Transport');
|
|
17556
17560
|
}
|
|
17557
17561
|
} catch {
|
|
17558
17562
|
console.error('Error starting Transport');
|
|
@@ -17565,10 +17569,12 @@ class Mercury extends MercuryInterpreter {
|
|
|
17565
17569
|
// fade out and remove code after 100ms
|
|
17566
17570
|
this.removeSounds(this.sounds, 0.1);
|
|
17567
17571
|
// Stops instead of pause so restarts at 0
|
|
17568
|
-
Tone.Transport.stop();
|
|
17569
|
-
console.log('Stopped Transport');
|
|
17572
|
+
Tone.Transport.stop(Tone.now()+0.1);
|
|
17573
|
+
// console.log('Stopped Transport');
|
|
17574
|
+
return true;
|
|
17570
17575
|
} catch {
|
|
17571
17576
|
console.error('Error stopping Transport');
|
|
17577
|
+
return false;
|
|
17572
17578
|
}
|
|
17573
17579
|
}
|
|
17574
17580
|
|