@dsebastien/music-notation 0.16.0 → 0.18.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 +1 -1
- package/dist/chord/fingering-words.d.ts +7 -0
- package/dist/chord/transitions.d.ts +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +113 -45
- package/dist/index.js.map +16 -15
- package/dist/music-notation.css +10 -15
- package/dist/music-notation.publish.min.js +39 -44
- package/dist/music-notation.tab.min.js +17 -22
- package/dist/playback/bar-parts.d.ts +1 -0
- package/dist/playback/live-volume.d.ts +14 -0
- package/dist/playback/player.d.ts +2 -0
- package/dist/publish/index.js +102 -30
- package/dist/publish/index.js.map +16 -15
- package/dist/tab/auto.d.ts +1 -0
- package/dist/tab/index.d.ts +5 -0
- package/dist/tab/index.js +186 -88
- package/dist/tab/index.js.map +7 -5
- package/dist/voicings/index.js +5 -3
- package/dist/voicings/index.js.map +3 -3
- package/package.json +1 -1
package/dist/tab/auto.d.ts
CHANGED
package/dist/tab/index.d.ts
CHANGED
|
@@ -46,6 +46,11 @@ export interface TabOptions {
|
|
|
46
46
|
onKeepView?: (staves: Staves) => void;
|
|
47
47
|
/** The view of a block with no `staves:` line (default: the block's language). */
|
|
48
48
|
defaultStaves?: Staves;
|
|
49
|
+
/**
|
|
50
|
+
* The app's volume, 0 to 1 (a number, or a function read at each Play and on `volumeChanged`,
|
|
51
|
+
* #85); 0.8 by default. The bar has no volume of its own (#82).
|
|
52
|
+
*/
|
|
53
|
+
volume?: number | (() => number);
|
|
49
54
|
}
|
|
50
55
|
export type Staves = 'tab' | 'score' | 'both';
|
|
51
56
|
export interface TabSource {
|
package/dist/tab/index.js
CHANGED
|
@@ -422,6 +422,8 @@ var SIGN = "(##|bb|#|b|♯|♭)?";
|
|
|
422
422
|
var syllableLetter = (syllable) => SYLLABLE_LETTER[plain2(syllable)];
|
|
423
423
|
var AFTER_ROOT = /^(?:$|[0-9/(+°øΔ^-]|m|M|a(?:dd|ug|lt)|sus|dim)/;
|
|
424
424
|
var QUALITY_WORD = /^(?:[0-9(+°øΔ^]|m|M|a(?:dd|ug|lt)|sus|dim)/;
|
|
425
|
+
var WORD_QUALITY = /^(?:major|minor)$/i;
|
|
426
|
+
var joinsAsQuality = (word) => QUALITY_WORD.test(word) && !WORD_QUALITY.test(word);
|
|
425
427
|
var reads = (letters) => midiOf(letters) !== null || /^[A-G]/.test(letters) && parseChord(letters) !== null;
|
|
426
428
|
function rootToken(token, naming, h, solfegeLine = false) {
|
|
427
429
|
const b = naming === "german" ? /^B(?![#♯b♭x])(.*)$/.exec(token) : null;
|
|
@@ -492,7 +494,7 @@ function read(text, naming, options, changes) {
|
|
|
492
494
|
let out = text.normalize("NFC").replace(new RegExp(`(^|[\\s,/|])${SYLLABLE}\\s+(dièse|diese|bémol|bemol)(?=$|[\\s,|])`, "g"), (_, before, syllable, sign) => `${before}${syllable}${/^d/.test(sign) ? "#" : "b"}`);
|
|
493
495
|
if (options.chord) {
|
|
494
496
|
const joined = new RegExp(`^\\s*${SYLLABLE}${SIGN}\\s+(\\S+)\\s*$`).exec(out);
|
|
495
|
-
if (joined &&
|
|
497
|
+
if (joined && joinsAsQuality(joined[3])) {
|
|
496
498
|
const word = `${joined[1]}${joined[2] ?? ""}${joined[3]}`;
|
|
497
499
|
const letters = rootToken(word, naming, h) ?? letterPiece(word, naming, h);
|
|
498
500
|
if (letters !== word) {
|
|
@@ -505,7 +507,7 @@ function read(text, naming, options, changes) {
|
|
|
505
507
|
for (let i = 0;i + 2 < words.length; i += 2) {
|
|
506
508
|
const head = words[i];
|
|
507
509
|
const next = words[i + 2];
|
|
508
|
-
if (!syllableOnly(head) || !
|
|
510
|
+
if (!syllableOnly(head) || !joinsAsQuality(next))
|
|
509
511
|
continue;
|
|
510
512
|
if (naming !== "solfege" && reads(head))
|
|
511
513
|
continue;
|
|
@@ -1767,6 +1769,136 @@ function textTabToAlphaTex(text) {
|
|
|
1767
1769
|
return [...header, ...ts, texOf(bars, meter)].join(`
|
|
1768
1770
|
`);
|
|
1769
1771
|
}
|
|
1772
|
+
|
|
1773
|
+
// src/playback/bar-parts.ts
|
|
1774
|
+
var ICONS = {
|
|
1775
|
+
play: "M4 2.5v11l9-5.5z",
|
|
1776
|
+
pause: "M4 3h3v10H4zM9 3h3v10H9z",
|
|
1777
|
+
stop: "M4 4h8v8H4z",
|
|
1778
|
+
all: "M1.5 2.5v11l6.5-5.5zM8 2.5v11l6.5-5.5z",
|
|
1779
|
+
loop: "M3 8a5 5 0 0 1 8.5-3.5L13 6V2.5M13 8a5 5 0 0 1-8.5 3.5L3 10v3.5",
|
|
1780
|
+
count: "M5.5 14h5L9 2.5H7zM8 11.5l4.5-7",
|
|
1781
|
+
click: "M3 5v6M8 5v6M13 5v6"
|
|
1782
|
+
};
|
|
1783
|
+
var STROKED = new Set(["loop", "count", "click"]);
|
|
1784
|
+
function icon(doc, name) {
|
|
1785
|
+
const root = svg(doc, "svg", {
|
|
1786
|
+
class: `mn-play-icon mn-play-icon-${name}${STROKED.has(name) ? " mn-play-icon-line" : ""}`,
|
|
1787
|
+
viewBox: "0 0 16 16",
|
|
1788
|
+
width: 12,
|
|
1789
|
+
height: 12,
|
|
1790
|
+
"aria-hidden": "true"
|
|
1791
|
+
});
|
|
1792
|
+
root.appendChild(svg(doc, "path", { d: ICONS[name] }));
|
|
1793
|
+
return root;
|
|
1794
|
+
}
|
|
1795
|
+
function playBar(doc, cls, label) {
|
|
1796
|
+
const bar = html(doc, "div", `mn-play mn-play-static ${cls}`);
|
|
1797
|
+
bar.addEventListener("mousedown", (event) => event.stopPropagation());
|
|
1798
|
+
bar.setAttribute("role", "group");
|
|
1799
|
+
bar.setAttribute("aria-label", label);
|
|
1800
|
+
return bar;
|
|
1801
|
+
}
|
|
1802
|
+
function iconButton(doc, cls, label, name) {
|
|
1803
|
+
const button = html(doc, "button", cls);
|
|
1804
|
+
button.type = "button";
|
|
1805
|
+
button.appendChild(icon(doc, name));
|
|
1806
|
+
button.title = label;
|
|
1807
|
+
button.setAttribute("aria-label", label);
|
|
1808
|
+
return button;
|
|
1809
|
+
}
|
|
1810
|
+
function pressedButton(doc, cls, label, name, on, set) {
|
|
1811
|
+
const button = iconButton(doc, cls, label, name);
|
|
1812
|
+
const show = () => {
|
|
1813
|
+
button.setAttribute("aria-pressed", String(on));
|
|
1814
|
+
button.classList.toggle("mn-on", on);
|
|
1815
|
+
};
|
|
1816
|
+
button.addEventListener("click", () => {
|
|
1817
|
+
on = !on;
|
|
1818
|
+
set(on);
|
|
1819
|
+
show();
|
|
1820
|
+
});
|
|
1821
|
+
show();
|
|
1822
|
+
return button;
|
|
1823
|
+
}
|
|
1824
|
+
function valueSlider(doc, label, unit, min, max, value, set, hint) {
|
|
1825
|
+
const field = html(doc, "label", "mn-play-field");
|
|
1826
|
+
const input = html(doc, "input");
|
|
1827
|
+
input.type = "range";
|
|
1828
|
+
input.min = String(min);
|
|
1829
|
+
input.max = String(max);
|
|
1830
|
+
input.setAttribute("aria-label", label);
|
|
1831
|
+
if (hint)
|
|
1832
|
+
input.setAttribute("aria-description", hint);
|
|
1833
|
+
const text = html(doc, "span", "mn-play-value");
|
|
1834
|
+
text.setAttribute("aria-hidden", "true");
|
|
1835
|
+
const show = (n) => {
|
|
1836
|
+
input.value = String(n);
|
|
1837
|
+
const written = `${n} ${unit}`;
|
|
1838
|
+
text.textContent = written;
|
|
1839
|
+
input.setAttribute("aria-valuetext", written);
|
|
1840
|
+
field.title = `${label}: ${written}${hint ? ` (${hint})` : ""}`;
|
|
1841
|
+
};
|
|
1842
|
+
input.addEventListener("input", () => {
|
|
1843
|
+
const n = Number(input.value);
|
|
1844
|
+
set(n);
|
|
1845
|
+
show(n);
|
|
1846
|
+
});
|
|
1847
|
+
show(value);
|
|
1848
|
+
field.append(input, text);
|
|
1849
|
+
return { field, input, show };
|
|
1850
|
+
}
|
|
1851
|
+
function choice(doc, cls, label, values, chosen, names, set) {
|
|
1852
|
+
const el = html(doc, "select", cls);
|
|
1853
|
+
el.setAttribute("aria-label", label);
|
|
1854
|
+
el.title = label;
|
|
1855
|
+
for (const value of values) {
|
|
1856
|
+
const option = html(doc, "option", undefined, names[value]);
|
|
1857
|
+
option.value = value;
|
|
1858
|
+
option.selected = value === chosen;
|
|
1859
|
+
el.appendChild(option);
|
|
1860
|
+
}
|
|
1861
|
+
el.addEventListener("change", () => set(el.value));
|
|
1862
|
+
return el;
|
|
1863
|
+
}
|
|
1864
|
+
var DEFAULT_VOLUME = 0.8;
|
|
1865
|
+
function volumeOf(volume) {
|
|
1866
|
+
let value = volume;
|
|
1867
|
+
if (typeof volume === "function") {
|
|
1868
|
+
try {
|
|
1869
|
+
value = volume();
|
|
1870
|
+
} catch {
|
|
1871
|
+
value = undefined;
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
return typeof value === "number" && Number.isFinite(value) ? Math.min(1, Math.max(0, value)) : DEFAULT_VOLUME;
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
// src/playback/live-volume.ts
|
|
1878
|
+
var listeners = new Set;
|
|
1879
|
+
var level = (value) => typeof value === "number" && Number.isFinite(value) ? Math.min(1, Math.max(0, value)) : null;
|
|
1880
|
+
function volumeChanged() {
|
|
1881
|
+
for (const listener of [...listeners]) {
|
|
1882
|
+
try {
|
|
1883
|
+
listener();
|
|
1884
|
+
} catch {}
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
function followVolume(read, handles, start) {
|
|
1888
|
+
let last = level(start);
|
|
1889
|
+
const listener = () => {
|
|
1890
|
+
const now = level(read());
|
|
1891
|
+
if (now === null || now === last)
|
|
1892
|
+
return;
|
|
1893
|
+
last = now;
|
|
1894
|
+
for (const h of handles())
|
|
1895
|
+
h.setVolume?.(now);
|
|
1896
|
+
};
|
|
1897
|
+
listeners.add(listener);
|
|
1898
|
+
return () => {
|
|
1899
|
+
listeners.delete(listener);
|
|
1900
|
+
};
|
|
1901
|
+
}
|
|
1770
1902
|
// src/convert/chord-sheet.ts
|
|
1771
1903
|
function chordsOf(line) {
|
|
1772
1904
|
const found = [];
|
|
@@ -1999,37 +2131,14 @@ var local = (doc) => {
|
|
|
1999
2131
|
}
|
|
2000
2132
|
};
|
|
2001
2133
|
};
|
|
2002
|
-
var ICONS = {
|
|
2003
|
-
play: "M4 2.5v11l9-5.5z",
|
|
2004
|
-
pause: "M4 3h3v10H4zM9 3h3v10H9z",
|
|
2005
|
-
stop: "M4 4h8v8H4z",
|
|
2006
|
-
loop: "M3 8a5 5 0 0 1 8.5-3.5L13 6V2.5M13 8a5 5 0 0 1-8.5 3.5L3 10v3.5",
|
|
2007
|
-
metronome: "M6 2h4l3 12H3zM8 11l3-7",
|
|
2008
|
-
countIn: "M3 13h10M5 13V9M8 13V6M11 13V3",
|
|
2009
|
-
volume: "M2 6h3l4-3v10l-4-3H2zM11 5.5a3.5 3.5 0 0 1 0 5"
|
|
2010
|
-
};
|
|
2011
|
-
function icon(doc, name) {
|
|
2012
|
-
const filled = name === "play" || name === "pause" || name === "stop";
|
|
2013
|
-
const root = svg(doc, "svg", {
|
|
2014
|
-
class: `mn-play-icon${filled ? "" : " mn-play-icon-loop"}`,
|
|
2015
|
-
viewBox: "0 0 16 16",
|
|
2016
|
-
width: 12,
|
|
2017
|
-
height: 12,
|
|
2018
|
-
"aria-hidden": "true"
|
|
2019
|
-
});
|
|
2020
|
-
root.appendChild(svg(doc, "path", { d: ICONS[name] }));
|
|
2021
|
-
return root;
|
|
2022
|
-
}
|
|
2023
2134
|
var time = (ms) => {
|
|
2024
2135
|
const s = Math.max(0, Math.round(ms / 1000));
|
|
2025
2136
|
return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`;
|
|
2026
2137
|
};
|
|
2027
|
-
function playerBar(doc, api, alphaTab, assets) {
|
|
2028
|
-
const bar =
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
bar.setAttribute("aria-label", "Playback");
|
|
2032
|
-
const state = { loop: false, metronome: false, countIn: false, speed: 1, volume: 1 };
|
|
2138
|
+
function playerBar(doc, api, alphaTab, assets, volume) {
|
|
2139
|
+
const bar = playBar(doc, "mn-tab-bar", "Playback");
|
|
2140
|
+
const state = { loop: false, metronome: false, countIn: false, speed: 1 };
|
|
2141
|
+
const level = () => volumeOf(volume);
|
|
2033
2142
|
let started = null;
|
|
2034
2143
|
let cantStart = null;
|
|
2035
2144
|
const start = () => {
|
|
@@ -2049,78 +2158,49 @@ function playerBar(doc, api, alphaTab, assets) {
|
|
|
2049
2158
|
api.metronomeVolume = state.metronome ? 1 : 0;
|
|
2050
2159
|
api.countInVolume = state.countIn ? 1 : 0;
|
|
2051
2160
|
api.playbackSpeed = state.speed;
|
|
2052
|
-
api.masterVolume =
|
|
2161
|
+
api.masterVolume = level();
|
|
2053
2162
|
}
|
|
2054
2163
|
return ok;
|
|
2055
2164
|
});
|
|
2056
2165
|
return started;
|
|
2057
2166
|
};
|
|
2058
|
-
const button = (name, label, run) => {
|
|
2059
|
-
const b = html(doc, "button");
|
|
2060
|
-
b.type = "button";
|
|
2061
|
-
b.title = label;
|
|
2062
|
-
b.setAttribute("aria-label", label);
|
|
2063
|
-
b.appendChild(icon(doc, name));
|
|
2064
|
-
b.addEventListener("click", run);
|
|
2065
|
-
bar.appendChild(b);
|
|
2066
|
-
return b;
|
|
2067
|
-
};
|
|
2068
2167
|
const live = (apply) => {
|
|
2069
2168
|
if (api.player)
|
|
2070
2169
|
apply();
|
|
2071
2170
|
};
|
|
2072
|
-
const
|
|
2073
|
-
|
|
2074
|
-
state[key] = !state[key];
|
|
2075
|
-
live(() => {
|
|
2076
|
-
api.isLooping = state.loop;
|
|
2077
|
-
api.metronomeVolume = state.metronome ? 1 : 0;
|
|
2078
|
-
api.countInVolume = state.countIn ? 1 : 0;
|
|
2079
|
-
});
|
|
2080
|
-
b.classList.toggle("mn-on", state[key]);
|
|
2081
|
-
b.setAttribute("aria-pressed", String(state[key]));
|
|
2082
|
-
});
|
|
2083
|
-
b.setAttribute("aria-pressed", "false");
|
|
2084
|
-
};
|
|
2085
|
-
const play = button("play", "Play", () => {
|
|
2171
|
+
const play = iconButton(doc, "mn-play-toggle", "Play", "play");
|
|
2172
|
+
play.addEventListener("click", () => {
|
|
2086
2173
|
start().then((ok) => {
|
|
2087
2174
|
if (ok)
|
|
2088
2175
|
api.playPause();
|
|
2089
2176
|
});
|
|
2090
2177
|
});
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
field.append(tag, input);
|
|
2112
|
-
bar.appendChild(field);
|
|
2113
|
-
};
|
|
2114
|
-
slider("Speed", "%", 25, 150, 100, (n) => {
|
|
2178
|
+
const stop = iconButton(doc, "mn-tab-stop", "Stop", "stop");
|
|
2179
|
+
stop.addEventListener("click", () => live(() => api.stop()));
|
|
2180
|
+
const toggles = () => live(() => {
|
|
2181
|
+
api.isLooping = state.loop;
|
|
2182
|
+
api.metronomeVolume = state.metronome ? 1 : 0;
|
|
2183
|
+
api.countInVolume = state.countIn ? 1 : 0;
|
|
2184
|
+
});
|
|
2185
|
+
const loop = pressedButton(doc, "mn-tab-loop", "Loop", "loop", false, (on) => {
|
|
2186
|
+
state.loop = on;
|
|
2187
|
+
toggles();
|
|
2188
|
+
});
|
|
2189
|
+
const metronome = pressedButton(doc, "mn-tab-click", "Metronome", "click", false, (on) => {
|
|
2190
|
+
state.metronome = on;
|
|
2191
|
+
toggles();
|
|
2192
|
+
});
|
|
2193
|
+
const countIn = pressedButton(doc, "mn-tab-count", "Count-in", "count", false, (on) => {
|
|
2194
|
+
state.countIn = on;
|
|
2195
|
+
toggles();
|
|
2196
|
+
});
|
|
2197
|
+
const speed = valueSlider(doc, "Speed", "%", 25, 150, 100, (n) => {
|
|
2115
2198
|
state.speed = n / 100;
|
|
2116
2199
|
live(() => api.playbackSpeed = state.speed);
|
|
2117
|
-
}, "%");
|
|
2118
|
-
slider("Volume", icon(doc, "volume"), 0, 100, 100, (n) => {
|
|
2119
|
-
state.volume = n / 100;
|
|
2120
|
-
live(() => api.masterVolume = state.volume);
|
|
2121
2200
|
});
|
|
2122
2201
|
const position = html(doc, "span", "mn-tab-time", "");
|
|
2123
|
-
bar.
|
|
2202
|
+
bar.append(play, stop, loop, metronome, countIn, speed.field, position);
|
|
2203
|
+
const unfollow = followVolume(level, () => [{ stop() {}, setVolume: (v) => live(() => api.masterVolume = v) }], level());
|
|
2124
2204
|
api.playerStateChanged.on((e) => {
|
|
2125
2205
|
const playing = Number(e.state) === Number(alphaTab.synth.PlayerState.Playing);
|
|
2126
2206
|
play.replaceChildren(icon(doc, playing ? "pause" : "play"));
|
|
@@ -2133,6 +2213,7 @@ function playerBar(doc, api, alphaTab, assets) {
|
|
|
2133
2213
|
return {
|
|
2134
2214
|
bar,
|
|
2135
2215
|
speed: () => state.speed,
|
|
2216
|
+
destroy: unfollow,
|
|
2136
2217
|
failed: (message) => {
|
|
2137
2218
|
cantStart?.();
|
|
2138
2219
|
play.disabled = true;
|
|
@@ -2196,6 +2277,7 @@ function renderTab(language, source, host, options) {
|
|
|
2196
2277
|
host.appendChild(el);
|
|
2197
2278
|
let api = null;
|
|
2198
2279
|
let speedOf = () => 1;
|
|
2280
|
+
let unbar = () => {};
|
|
2199
2281
|
let gone = false;
|
|
2200
2282
|
let settled = false;
|
|
2201
2283
|
let settle = () => {};
|
|
@@ -2244,7 +2326,11 @@ function renderTab(language, source, host, options) {
|
|
|
2244
2326
|
staveProfile: "Default",
|
|
2245
2327
|
resources: colorsOf(el)
|
|
2246
2328
|
},
|
|
2247
|
-
player: {
|
|
2329
|
+
player: {
|
|
2330
|
+
playerMode: at.PlayerMode.Disabled,
|
|
2331
|
+
enableUserInteraction: true,
|
|
2332
|
+
scrollMode: at.ScrollMode.Off
|
|
2333
|
+
}
|
|
2248
2334
|
};
|
|
2249
2335
|
const current = new at.AlphaTabApi(surface, settings);
|
|
2250
2336
|
api = current;
|
|
@@ -2266,7 +2352,8 @@ function renderTab(language, source, host, options) {
|
|
|
2266
2352
|
if (settled || gone)
|
|
2267
2353
|
return;
|
|
2268
2354
|
if (options.player !== false) {
|
|
2269
|
-
bar = playerBar(doc, current, at, assets);
|
|
2355
|
+
bar = playerBar(doc, current, at, assets, options.volume);
|
|
2356
|
+
unbar = bar.destroy;
|
|
2270
2357
|
speedOf = bar.speed;
|
|
2271
2358
|
el.appendChild(bar.bar);
|
|
2272
2359
|
if (options.views !== false && tablature)
|
|
@@ -2327,6 +2414,7 @@ function renderTab(language, source, host, options) {
|
|
|
2327
2414
|
speed: () => speedOf(),
|
|
2328
2415
|
destroy() {
|
|
2329
2416
|
gone = true;
|
|
2417
|
+
unbar();
|
|
2330
2418
|
try {
|
|
2331
2419
|
api?.destroy();
|
|
2332
2420
|
} catch {}
|
|
@@ -2378,6 +2466,11 @@ function soundfontPlayer(alphaTab, api) {
|
|
|
2378
2466
|
stopped = true;
|
|
2379
2467
|
clearTimeout(timer);
|
|
2380
2468
|
player.stop();
|
|
2469
|
+
},
|
|
2470
|
+
setVolume(next) {
|
|
2471
|
+
if (stopped || !Number.isFinite(next))
|
|
2472
|
+
return;
|
|
2473
|
+
current.masterVolume = Math.min(1, Math.max(0, next));
|
|
2381
2474
|
}
|
|
2382
2475
|
};
|
|
2383
2476
|
}
|
|
@@ -2438,18 +2531,19 @@ function createSoundfontPlayer(alphaTab, assets, doc, fallback) {
|
|
|
2438
2531
|
play(events, options) {
|
|
2439
2532
|
let handle = null;
|
|
2440
2533
|
let stopped = false;
|
|
2534
|
+
let volume = options.volume;
|
|
2441
2535
|
start().then((ok) => {
|
|
2442
2536
|
if (stopped)
|
|
2443
2537
|
return;
|
|
2444
2538
|
try {
|
|
2445
2539
|
if (ok) {
|
|
2446
|
-
handle = inner.play(events, options);
|
|
2540
|
+
handle = inner.play(events, { ...options, volume });
|
|
2447
2541
|
return;
|
|
2448
2542
|
}
|
|
2449
2543
|
} catch {}
|
|
2450
2544
|
if (!fallback)
|
|
2451
2545
|
return;
|
|
2452
|
-
handle = fallback.play(events, options);
|
|
2546
|
+
handle = fallback.play(events, { ...options, volume });
|
|
2453
2547
|
if (!fallback.reportsStart)
|
|
2454
2548
|
options.onStart?.();
|
|
2455
2549
|
});
|
|
@@ -2457,6 +2551,10 @@ function createSoundfontPlayer(alphaTab, assets, doc, fallback) {
|
|
|
2457
2551
|
stop() {
|
|
2458
2552
|
stopped = true;
|
|
2459
2553
|
handle?.stop();
|
|
2554
|
+
},
|
|
2555
|
+
setVolume(next) {
|
|
2556
|
+
volume = next;
|
|
2557
|
+
handle?.setVolume?.(next);
|
|
2460
2558
|
}
|
|
2461
2559
|
};
|
|
2462
2560
|
},
|
|
@@ -2501,5 +2599,5 @@ export {
|
|
|
2501
2599
|
textTabToAlphaTex
|
|
2502
2600
|
};
|
|
2503
2601
|
|
|
2504
|
-
//# debugId=
|
|
2602
|
+
//# debugId=10B85D48D2B2B5E264756E2164756E21
|
|
2505
2603
|
//# sourceMappingURL=index.js.map
|