web-music-score-samples 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.
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Instruments can also be added using this interface that holds instrument name and audio samples.
3
+ */
4
+ interface InstrumentSamples {
5
+ /**
6
+ * Get instrument name.
7
+ * @returns - Instrument name.
8
+ */
9
+ getName(): string;
10
+ /**
11
+ * Get samples e.g. { "E2": "base64 string mp3", "E3": "base64 string mp3", etc. }
12
+ * @returns - Record of audio samples.
13
+ */
14
+ getSamples(): Record<string, string>;
15
+ }
16
+ declare global {
17
+ interface Window {
18
+ WebMusicScore?: {
19
+ Samples?: Record<string, InstrumentSamples>;
20
+ };
21
+ }
22
+ }
23
+ declare function addToGlobalName(name: string, samples: InstrumentSamples): void;
24
+
25
+ export { type InstrumentSamples, addToGlobalName };
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/core/index.ts
21
+ var core_exports = {};
22
+ __export(core_exports, {
23
+ addToGlobalName: () => addToGlobalName
24
+ });
25
+ module.exports = __toCommonJS(core_exports);
26
+ function addToGlobalName(name, samples) {
27
+ var _a;
28
+ if (typeof window === "undefined") return;
29
+ const root = window.WebMusicScore;
30
+ if (!root) {
31
+ console.warn("WebMusicScore core not found. Load core bundle before samples.");
32
+ return;
33
+ }
34
+ const samplesNs = (_a = root.Samples) != null ? _a : root.Samples = {};
35
+ if (samplesNs[name]) {
36
+ console.warn(`WebMusicScore.Samples.${name} already exists and will be overwritten.`);
37
+ }
38
+ samplesNs[name] = samples;
39
+ }
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ addToGlobalName
43
+ });
44
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ import {
2
+ addToGlobalName
3
+ } from "../chunk-TPZ7OSHN.mjs";
4
+ export {
5
+ addToGlobalName
6
+ };
7
+ //# sourceMappingURL=index.mjs.map