@tsparticles/plugin-sounds 3.0.0-alpha.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.
Files changed (112) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +70 -0
  3. package/browser/Options/Classes/Sounds.js +30 -0
  4. package/browser/Options/Classes/SoundsAudio.js +22 -0
  5. package/browser/Options/Classes/SoundsEvent.js +54 -0
  6. package/browser/Options/Classes/SoundsIcon.js +23 -0
  7. package/browser/Options/Classes/SoundsIcons.js +54 -0
  8. package/browser/Options/Classes/SoundsMelody.js +30 -0
  9. package/browser/Options/Classes/SoundsNote.js +17 -0
  10. package/browser/Options/Classes/SoundsVolume.js +30 -0
  11. package/browser/Options/Interfaces/ISounds.js +1 -0
  12. package/browser/Options/Interfaces/ISoundsAudio.js +1 -0
  13. package/browser/Options/Interfaces/ISoundsEvent.js +1 -0
  14. package/browser/Options/Interfaces/ISoundsIcon.js +1 -0
  15. package/browser/Options/Interfaces/ISoundsIcons.js +1 -0
  16. package/browser/Options/Interfaces/ISoundsMelody.js +1 -0
  17. package/browser/Options/Interfaces/ISoundsNote.js +1 -0
  18. package/browser/Options/Interfaces/ISoundsVolume.js +1 -0
  19. package/browser/SoundsInstance.js +336 -0
  20. package/browser/enums.js +1 -0
  21. package/browser/index.js +29 -0
  22. package/browser/types.js +1 -0
  23. package/browser/utils.js +26 -0
  24. package/cjs/Options/Classes/Sounds.js +34 -0
  25. package/cjs/Options/Classes/SoundsAudio.js +26 -0
  26. package/cjs/Options/Classes/SoundsEvent.js +58 -0
  27. package/cjs/Options/Classes/SoundsIcon.js +27 -0
  28. package/cjs/Options/Classes/SoundsIcons.js +58 -0
  29. package/cjs/Options/Classes/SoundsMelody.js +34 -0
  30. package/cjs/Options/Classes/SoundsNote.js +21 -0
  31. package/cjs/Options/Classes/SoundsVolume.js +34 -0
  32. package/cjs/Options/Interfaces/ISounds.js +2 -0
  33. package/cjs/Options/Interfaces/ISoundsAudio.js +2 -0
  34. package/cjs/Options/Interfaces/ISoundsEvent.js +2 -0
  35. package/cjs/Options/Interfaces/ISoundsIcon.js +2 -0
  36. package/cjs/Options/Interfaces/ISoundsIcons.js +2 -0
  37. package/cjs/Options/Interfaces/ISoundsMelody.js +2 -0
  38. package/cjs/Options/Interfaces/ISoundsNote.js +2 -0
  39. package/cjs/Options/Interfaces/ISoundsVolume.js +2 -0
  40. package/cjs/SoundsInstance.js +359 -0
  41. package/cjs/enums.js +2 -0
  42. package/cjs/index.js +44 -0
  43. package/cjs/types.js +2 -0
  44. package/cjs/utils.js +30 -0
  45. package/esm/Options/Classes/Sounds.js +30 -0
  46. package/esm/Options/Classes/SoundsAudio.js +22 -0
  47. package/esm/Options/Classes/SoundsEvent.js +54 -0
  48. package/esm/Options/Classes/SoundsIcon.js +23 -0
  49. package/esm/Options/Classes/SoundsIcons.js +54 -0
  50. package/esm/Options/Classes/SoundsMelody.js +30 -0
  51. package/esm/Options/Classes/SoundsNote.js +17 -0
  52. package/esm/Options/Classes/SoundsVolume.js +30 -0
  53. package/esm/Options/Interfaces/ISounds.js +1 -0
  54. package/esm/Options/Interfaces/ISoundsAudio.js +1 -0
  55. package/esm/Options/Interfaces/ISoundsEvent.js +1 -0
  56. package/esm/Options/Interfaces/ISoundsIcon.js +1 -0
  57. package/esm/Options/Interfaces/ISoundsIcons.js +1 -0
  58. package/esm/Options/Interfaces/ISoundsMelody.js +1 -0
  59. package/esm/Options/Interfaces/ISoundsNote.js +1 -0
  60. package/esm/Options/Interfaces/ISoundsVolume.js +1 -0
  61. package/esm/SoundsInstance.js +336 -0
  62. package/esm/enums.js +1 -0
  63. package/esm/index.js +29 -0
  64. package/esm/types.js +1 -0
  65. package/esm/utils.js +26 -0
  66. package/package.json +81 -0
  67. package/report.html +39 -0
  68. package/tsparticles.plugin.sounds.js +780 -0
  69. package/tsparticles.plugin.sounds.min.js +2 -0
  70. package/tsparticles.plugin.sounds.min.js.LICENSE.txt +8 -0
  71. package/types/Options/Classes/Sounds.d.ts +13 -0
  72. package/types/Options/Classes/SoundsAudio.d.ts +8 -0
  73. package/types/Options/Classes/SoundsEvent.d.ts +20 -0
  74. package/types/Options/Classes/SoundsIcon.d.ts +10 -0
  75. package/types/Options/Classes/SoundsIcons.d.ts +11 -0
  76. package/types/Options/Classes/SoundsMelody.d.ts +10 -0
  77. package/types/Options/Classes/SoundsNote.d.ts +8 -0
  78. package/types/Options/Classes/SoundsVolume.d.ts +10 -0
  79. package/types/Options/Interfaces/ISounds.d.ts +9 -0
  80. package/types/Options/Interfaces/ISoundsAudio.d.ts +4 -0
  81. package/types/Options/Interfaces/ISoundsEvent.d.ts +12 -0
  82. package/types/Options/Interfaces/ISoundsIcon.d.ts +6 -0
  83. package/types/Options/Interfaces/ISoundsIcons.d.ts +7 -0
  84. package/types/Options/Interfaces/ISoundsMelody.d.ts +6 -0
  85. package/types/Options/Interfaces/ISoundsNote.d.ts +5 -0
  86. package/types/Options/Interfaces/ISoundsVolume.d.ts +6 -0
  87. package/types/SoundsInstance.d.ts +32 -0
  88. package/types/enums.d.ts +4 -0
  89. package/types/index.d.ts +2 -0
  90. package/types/types.d.ts +15 -0
  91. package/types/utils.d.ts +1 -0
  92. package/umd/Options/Classes/Sounds.js +44 -0
  93. package/umd/Options/Classes/SoundsAudio.js +36 -0
  94. package/umd/Options/Classes/SoundsEvent.js +68 -0
  95. package/umd/Options/Classes/SoundsIcon.js +37 -0
  96. package/umd/Options/Classes/SoundsIcons.js +68 -0
  97. package/umd/Options/Classes/SoundsMelody.js +44 -0
  98. package/umd/Options/Classes/SoundsNote.js +31 -0
  99. package/umd/Options/Classes/SoundsVolume.js +44 -0
  100. package/umd/Options/Interfaces/ISounds.js +12 -0
  101. package/umd/Options/Interfaces/ISoundsAudio.js +12 -0
  102. package/umd/Options/Interfaces/ISoundsEvent.js +12 -0
  103. package/umd/Options/Interfaces/ISoundsIcon.js +12 -0
  104. package/umd/Options/Interfaces/ISoundsIcons.js +12 -0
  105. package/umd/Options/Interfaces/ISoundsMelody.js +12 -0
  106. package/umd/Options/Interfaces/ISoundsNote.js +12 -0
  107. package/umd/Options/Interfaces/ISoundsVolume.js +12 -0
  108. package/umd/SoundsInstance.js +350 -0
  109. package/umd/enums.js +12 -0
  110. package/umd/index.js +43 -0
  111. package/umd/types.js +12 -0
  112. package/umd/utils.js +40 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Matteo Bruni
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,70 @@
1
+ [![banner](https://particles.js.org/images/banner2.png)](https://particles.js.org)
2
+
3
+ # tsParticles Sounds Plugin
4
+
5
+ [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/tsparticles-plugin-sounds/badge)](https://www.jsdelivr.com/package/npm/tsparticles-plugin-sounds)
6
+ [![npmjs](https://badge.fury.io/js/tsparticles-plugin-sounds.svg)](https://www.npmjs.com/package/tsparticles-plugin-sounds)
7
+ [![npmjs](https://img.shields.io/npm/dt/tsparticles-plugin-sounds)](https://www.npmjs.com/package/tsparticles-plugin-sounds) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni)
8
+
9
+ [tsParticles](https://github.com/matteobruni/tsparticles) plugin for particles sounds effect.
10
+
11
+ ## How to use it
12
+
13
+ ### CDN / Vanilla JS / jQuery
14
+
15
+ The CDN/Vanilla version JS has one required file in vanilla configuration:
16
+
17
+ Including the `tsparticles.plugin.sounds.min.js` file will export the function to load the plugin:
18
+
19
+ ```javascript
20
+ loadSoundsPlugin;
21
+ ```
22
+
23
+ ### Usage
24
+
25
+ Once the scripts are loaded you can set up `tsParticles` and the plugin like this:
26
+
27
+ ```javascript
28
+ (async () => {
29
+ await loadSoundsPlugin(tsParticles);
30
+
31
+ await tsParticles.load({
32
+ id: "tsparticles",
33
+ options: {
34
+ /* options */
35
+ },
36
+ });
37
+ })();
38
+ ```
39
+
40
+ ### ESM / CommonJS
41
+
42
+ This package is compatible also with ES or CommonJS modules, firstly this needs to be installed, like this:
43
+
44
+ ```shell
45
+ $ npm install tsparticles-plugin-sounds
46
+ ```
47
+
48
+ or
49
+
50
+ ```shell
51
+ $ yarn add tsparticles-plugin-sounds
52
+ ```
53
+
54
+ Then you need to import it in the app, like this:
55
+
56
+ ```javascript
57
+ const { tsParticles } = require("tsparticles-engine");
58
+ const { loadSoundsPlugin } = require("tsparticles-plugin-sounds");
59
+
60
+ loadSoundsPlugin(tsParticles); // awaitable
61
+ ```
62
+
63
+ or
64
+
65
+ ```javascript
66
+ import { tsParticles } from "tsparticles-engine";
67
+ import { loadSoundsPlugin } from "tsparticles-plugin-sounds";
68
+
69
+ loadSoundsPlugin(tsParticles); // awaitable
70
+ ```
@@ -0,0 +1,30 @@
1
+ import { SoundsEvent } from "./SoundsEvent";
2
+ import { SoundsIcons } from "./SoundsIcons";
3
+ import { SoundsVolume } from "./SoundsVolume";
4
+ export class Sounds {
5
+ constructor() {
6
+ this.enable = false;
7
+ this.events = [];
8
+ this.icons = new SoundsIcons();
9
+ this.volume = new SoundsVolume();
10
+ }
11
+ load(data) {
12
+ if (!data) {
13
+ return;
14
+ }
15
+ if (data.enable !== undefined) {
16
+ this.enable = data.enable;
17
+ }
18
+ if (data.events !== undefined) {
19
+ this.events = data.events.map((t) => {
20
+ const event = new SoundsEvent();
21
+ event.load(t);
22
+ return event;
23
+ });
24
+ }
25
+ this.icons.load(data.icons);
26
+ if (data.volume !== undefined) {
27
+ this.volume.load(data.volume);
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,22 @@
1
+ export class SoundsAudio {
2
+ constructor() {
3
+ this.loop = false;
4
+ this.source = "";
5
+ }
6
+ load(data) {
7
+ if (data === undefined) {
8
+ return;
9
+ }
10
+ if (typeof data === "object") {
11
+ if (data.loop !== undefined) {
12
+ this.loop = data.loop;
13
+ }
14
+ if (data.source !== undefined) {
15
+ this.source = data.source;
16
+ }
17
+ }
18
+ else {
19
+ this.source = data;
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,54 @@
1
+ import { SoundsAudio } from "./SoundsAudio";
2
+ import { SoundsMelody } from "./SoundsMelody";
3
+ import { SoundsNote } from "./SoundsNote";
4
+ export class SoundsEvent {
5
+ constructor() {
6
+ this.event = [];
7
+ this.notes = [];
8
+ }
9
+ load(data) {
10
+ if (!data) {
11
+ return;
12
+ }
13
+ if (data.event !== undefined) {
14
+ this.event = data.event;
15
+ }
16
+ if (data.audio !== undefined) {
17
+ if (data.audio instanceof Array) {
18
+ this.audio = data.audio.map((s) => {
19
+ const tmp = new SoundsAudio();
20
+ tmp.load(s);
21
+ return tmp;
22
+ });
23
+ }
24
+ else {
25
+ this.audio = new SoundsAudio();
26
+ this.audio.load(data.audio);
27
+ }
28
+ }
29
+ if (data.notes !== undefined) {
30
+ this.notes = data.notes.map((t) => {
31
+ const tmp = new SoundsNote();
32
+ tmp.load(t);
33
+ return tmp;
34
+ });
35
+ }
36
+ if (data.melodies !== undefined) {
37
+ this.melodies = data.melodies.map((t) => {
38
+ const tmp = new SoundsMelody();
39
+ tmp.load(t);
40
+ return tmp;
41
+ });
42
+ }
43
+ if (data.filter !== undefined) {
44
+ if (typeof data.filter === "string") {
45
+ if (typeof window[data.filter] === "function") {
46
+ this.filter = window[data.filter];
47
+ }
48
+ }
49
+ else {
50
+ this.filter = data.filter;
51
+ }
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,23 @@
1
+ export class SoundsIcon {
2
+ constructor() {
3
+ this.width = 24;
4
+ this.height = 24;
5
+ }
6
+ load(data) {
7
+ if (!data) {
8
+ return;
9
+ }
10
+ if (data.path !== undefined) {
11
+ this.path = data.path;
12
+ }
13
+ if (data.svg !== undefined) {
14
+ this.svg = data.svg;
15
+ }
16
+ if (data.width !== undefined) {
17
+ this.width = data.width;
18
+ }
19
+ if (data.height !== undefined) {
20
+ this.height = data.height;
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,54 @@
1
+ import { SoundsIcon } from "./SoundsIcon";
2
+ export class SoundsIcons {
3
+ constructor() {
4
+ this.mute = new SoundsIcon();
5
+ this.unmute = new SoundsIcon();
6
+ this.volumeDown = new SoundsIcon();
7
+ this.volumeUp = new SoundsIcon();
8
+ this.mute.svg = `<?xml version="1.0"?>
9
+ <svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"
10
+ xml:space="preserve" xmlns="http://www.w3.org/2000/svg"
11
+ xmlns:xlink="http://www.w3.org/1999/xlink">
12
+ <g id="Layer_1">
13
+ <path fill="#fff" d="M19.707,5.293c-0.391-0.391-1.023-0.391-1.414,0l-1.551,1.551c-0.345-0.688-0.987-1.02-1.604-1.02c-0.449,0-0.905,0.152-1.356,0.453l-2.672,1.781C10.357,8.561,8.904,9,8,9c-1.654,0-3,1.346-3,3v2c0,1.237,0.754,2.302,1.826,2.76l-1.533,1.533c-0.391,0.391-0.391,1.023,0,1.414C5.488,19.902,5.744,20,6,20s0.512-0.098,0.707-0.293l2.527-2.527c0.697,0.174,1.416,0.455,1.875,0.762l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C16.035,20.176,17,19.495,17,18V9.414l2.707-2.707C20.098,6.316,20.098,5.684,19.707,5.293z M14.891,7.941c0.038-0.025,0.073-0.046,0.104-0.062C14.998,7.914,15,7.954,15,8v1.293l-2,2V9.202L14.891,7.941z M7,12c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146v2.439l-2.83,2.83C8.757,15.046,8.356,15,8,15c-0.552,0-1-0.448-1-1V12z M10.301,15.406L12,13.707v2.439C11.519,15.859,10.925,15.604,10.301,15.406z M14.994,18.12c-0.03-0.016-0.065-0.036-0.104-0.062L13,16.798v-4.091l2-2V18C15,18.046,14.998,18.086,14.994,18.12z"/>
14
+ </g>
15
+ </svg>`;
16
+ this.unmute.svg = `<?xml version="1.0"?>
17
+ <svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"
18
+ xml:space="preserve" xmlns="http://www.w3.org/2000/svg"
19
+ xmlns:xlink="http://www.w3.org/1999/xlink">
20
+ <g id="Layer_1">
21
+ <path fill="#fff" d="M17.138,5.824c-0.449,0-0.905,0.152-1.356,0.453l-2.672,1.781C12.357,8.561,10.904,9,10,9c-1.654,0-3,1.346-3,3v2c0,1.654,1.346,3,3,3c0.904,0,2.357,0.439,3.109,0.941l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C18.035,20.176,19,19.495,19,18V8C19,6.505,18.035,5.824,17.138,5.824z M14,16.146C12.907,15.495,11.211,15,10,15c-0.552,0-1-0.448-1-1v-2c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146V16.146z M17,18c0,0.046-0.002,0.086-0.006,0.12c-0.03-0.016-0.065-0.036-0.104-0.062L15,16.798V9.202l1.891-1.261c0.038-0.025,0.073-0.046,0.104-0.062C16.998,7.914,17,7.954,17,8V18z"/>
22
+ </g>
23
+ </svg>`;
24
+ this.volumeDown.svg = `<?xml version="1.0"?>
25
+ <svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"
26
+ xml:space="preserve" xmlns="http://www.w3.org/2000/svg"
27
+ xmlns:xlink="http://www.w3.org/1999/xlink">
28
+ <g id="Layer_1">
29
+ <path fill="#fff" d="M15.138,5.824c-0.449,0-0.905,0.152-1.356,0.453l-2.672,1.781C10.357,8.561,8.904,9,8,9c-1.654,0-3,1.346-3,3v2c0,1.654,1.346,3,3,3c0.904,0,2.357,0.439,3.109,0.941l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C16.035,20.176,17,19.495,17,18V8C17,6.505,16.035,5.824,15.138,5.824z M8,15c-0.552,0-1-0.448-1-1v-2c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146v6.293C10.907,15.495,9.211,15,8,15z M15,18c0,0.046-0.002,0.086-0.006,0.12c-0.03-0.016-0.065-0.036-0.104-0.062L13,16.798V9.202l1.891-1.261c0.038-0.025,0.073-0.046,0.104-0.062C14.998,7.914,15,7.954,15,8V18z"/>
30
+ <path fill="#fff" d="M18.292,10.294c-0.39,0.391-0.39,1.023,0.002,1.414c0.345,0.345,0.535,0.803,0.535,1.291c0,0.489-0.19,0.948-0.536,1.294c-0.391,0.39-0.391,1.023,0,1.414C18.488,15.902,18.744,16,19,16s0.512-0.098,0.707-0.293c0.724-0.723,1.122-1.685,1.122-2.708s-0.398-1.984-1.123-2.707C19.317,9.903,18.683,9.901,18.292,10.294z"/>
31
+ </g>
32
+ </svg>`;
33
+ this.volumeUp.svg = `<?xml version="1.0"?>
34
+ <svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"
35
+ xml:space="preserve" xmlns="http://www.w3.org/2000/svg"
36
+ xmlns:xlink="http://www.w3.org/1999/xlink">
37
+ <g id="Layer_1">
38
+ <path fill="#fff" d="M16.706,10.292c-0.389-0.389-1.023-0.391-1.414,0.002c-0.39,0.391-0.39,1.023,0.002,1.414c0.345,0.345,0.535,0.803,0.535,1.291c0,0.489-0.19,0.948-0.536,1.294c-0.391,0.39-0.391,1.023,0,1.414C15.488,15.902,15.744,16,16,16s0.512-0.098,0.707-0.293c0.724-0.723,1.122-1.685,1.122-2.708S17.431,11.015,16.706,10.292z"/>
39
+ <path fill="#fff" d="M18.706,8.292c-0.391-0.389-1.023-0.39-1.414,0.002c-0.39,0.391-0.39,1.024,0.002,1.414c0.879,0.877,1.363,2.044,1.364,3.287c0.001,1.246-0.484,2.417-1.365,3.298c-0.391,0.391-0.391,1.023,0,1.414C17.488,17.902,17.744,18,18,18s0.512-0.098,0.707-0.293c1.259-1.259,1.952-2.933,1.951-4.713C20.657,11.217,19.964,9.547,18.706,8.292z"/>
40
+ <path fill="#fff" d="M20.706,6.292c-0.391-0.389-1.023-0.39-1.414,0.002c-0.39,0.391-0.39,1.024,0.002,1.414c1.412,1.409,2.191,3.285,2.192,5.284c0.002,2.002-0.777,3.885-2.193,5.301c-0.391,0.391-0.391,1.023,0,1.414C19.488,19.902,19.744,20,20,20s0.512-0.098,0.707-0.293c1.794-1.794,2.781-4.18,2.779-6.717C23.485,10.457,22.497,8.078,20.706,6.292z"/>
41
+ <path fill="#fff" d="M12.138,5.824c-0.449,0-0.905,0.152-1.356,0.453L8.109,8.059C7.357,8.561,5.904,9,5,9c-1.654,0-3,1.346-3,3v2c0,1.654,1.346,3,3,3c0.904,0,2.357,0.439,3.109,0.941l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C13.035,20.176,14,19.495,14,18V8C14,6.505,13.035,5.824,12.138,5.824z M5,15c-0.552,0-1-0.448-1-1v-2c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146v6.293C7.907,15.495,6.211,15,5,15z M12,18c0,0.046-0.002,0.086-0.006,0.12c-0.03-0.016-0.065-0.036-0.104-0.062L10,16.798V9.202l1.891-1.261c0.038-0.025,0.073-0.046,0.104-0.062C11.998,7.914,12,7.954,12,8V18z"/>
42
+ </g>
43
+ </svg>`;
44
+ }
45
+ load(data) {
46
+ if (!data) {
47
+ return;
48
+ }
49
+ this.mute.load(data.mute);
50
+ this.unmute.load(data.unmute);
51
+ this.volumeDown.load(data.volumeDown);
52
+ this.volumeUp.load(data.volumeUp);
53
+ }
54
+ }
@@ -0,0 +1,30 @@
1
+ import { SoundsNote } from "./SoundsNote";
2
+ export class SoundsMelody {
3
+ constructor() {
4
+ this.loop = false;
5
+ this.melodies = [];
6
+ this.notes = [];
7
+ }
8
+ load(data) {
9
+ if (data === undefined) {
10
+ return;
11
+ }
12
+ if (data.loop !== undefined) {
13
+ this.loop = data.loop;
14
+ }
15
+ if (data.melodies !== undefined) {
16
+ this.melodies = data.melodies.map((s) => {
17
+ const tmp = new SoundsMelody();
18
+ tmp.load(s);
19
+ return tmp;
20
+ });
21
+ }
22
+ if (data.notes !== undefined) {
23
+ this.notes = data.notes.map((s) => {
24
+ const tmp = new SoundsNote();
25
+ tmp.load(s);
26
+ return tmp;
27
+ });
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,17 @@
1
+ export class SoundsNote {
2
+ constructor() {
3
+ this.duration = 500;
4
+ this.value = [];
5
+ }
6
+ load(data) {
7
+ if (!data) {
8
+ return;
9
+ }
10
+ if (data.duration !== undefined) {
11
+ this.duration = data.duration;
12
+ }
13
+ if (data.value !== undefined) {
14
+ this.value = data.value;
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,30 @@
1
+ export class SoundsVolume {
2
+ constructor() {
3
+ this.value = 100;
4
+ this.max = 100;
5
+ this.min = 0;
6
+ this.step = 10;
7
+ }
8
+ load(data) {
9
+ if (data === undefined) {
10
+ return;
11
+ }
12
+ if (typeof data === "object") {
13
+ if (data.max !== undefined) {
14
+ this.max = data.max;
15
+ }
16
+ if (data.min !== undefined) {
17
+ this.min = data.min;
18
+ }
19
+ if (data.step !== undefined) {
20
+ this.step = data.step;
21
+ }
22
+ if (data.value !== undefined) {
23
+ this.value = data.value;
24
+ }
25
+ }
26
+ else {
27
+ this.value = data;
28
+ }
29
+ }
30
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};