@onjmin/dtm 1.0.3 → 1.0.5
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/dist/index.js +46 -7
- package/dist/index.mjs +46 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8850,8 +8850,8 @@ var mountMmlPlayer = (target, mml, options = {}) => {
|
|
|
8850
8850
|
...normalizeDrumPatterns(options.drumPatterns ?? {})
|
|
8851
8851
|
};
|
|
8852
8852
|
const drumPatternName = meta.drum ?? "none";
|
|
8853
|
-
const trackVolume =
|
|
8854
|
-
let masterVolume = options.masterVolume ?? 50;
|
|
8853
|
+
const trackVolume = options.volume ?? 100;
|
|
8854
|
+
let masterVolume = meta.volume ?? options.masterVolume ?? 50;
|
|
8855
8855
|
const drumVolume = meta.drumVolume ?? 80;
|
|
8856
8856
|
const colors = options.trackColors ?? DEFAULT_TRACK_COLORS;
|
|
8857
8857
|
const useSynth = options.synth ?? !options.onPlayNote;
|
|
@@ -8891,14 +8891,20 @@ var mountMmlPlayer = (target, mml, options = {}) => {
|
|
|
8891
8891
|
}
|
|
8892
8892
|
const seqTracks = trackIndices.map((index) => {
|
|
8893
8893
|
let id = 0;
|
|
8894
|
-
const
|
|
8894
|
+
const trackPlacements = placements.filter((p) => p.trackIndex === index);
|
|
8895
|
+
const headerVelocity = trackPlacements[0]?.velocity ?? DEFAULT_VELOCITY;
|
|
8896
|
+
const notes = trackPlacements.map((p) => ({
|
|
8895
8897
|
id: id++,
|
|
8896
8898
|
startStep: p.startStep,
|
|
8897
8899
|
durationSteps: p.durationSteps,
|
|
8898
8900
|
pitch: p.pitch,
|
|
8899
|
-
velocity:
|
|
8901
|
+
velocity: DEFAULT_VELOCITY
|
|
8900
8902
|
}));
|
|
8901
|
-
return {
|
|
8903
|
+
return {
|
|
8904
|
+
id: String(index),
|
|
8905
|
+
volume: trackVolume * headerVelocity / DEFAULT_VELOCITY,
|
|
8906
|
+
notes
|
|
8907
|
+
};
|
|
8902
8908
|
});
|
|
8903
8909
|
const colorOf = (index) => colors[index % colors.length] ?? DEFAULT_TRACK_COLORS[0];
|
|
8904
8910
|
let audioCtx = null;
|
|
@@ -9157,6 +9163,9 @@ var mountMmlPlayer = (target, mml, options = {}) => {
|
|
|
9157
9163
|
singingVoices: options.singingVoices,
|
|
9158
9164
|
drumPatterns: options.drumPatterns,
|
|
9159
9165
|
volume: trackVolume,
|
|
9166
|
+
// 解説モーダル内の試聴サンプルも親と同じマスタ音量で鳴らす
|
|
9167
|
+
// (サンプル側のMMLに `#volume=` があればそちらが優先される)。
|
|
9168
|
+
masterVolume,
|
|
9160
9169
|
// 解説モーダル内の試聴サンプルは規約同意を要求しない。
|
|
9161
9170
|
skipConsent: true,
|
|
9162
9171
|
// 再帰的なモーダル生成を防ぐ。
|
|
@@ -19355,6 +19364,30 @@ var createDtmStudio = async (options = {}) => {
|
|
|
19355
19364
|
}
|
|
19356
19365
|
return strip;
|
|
19357
19366
|
};
|
|
19367
|
+
const createTrackStripApplier = (meta) => {
|
|
19368
|
+
const applied = /* @__PURE__ */ new Set();
|
|
19369
|
+
return (stripId, trackIdx) => {
|
|
19370
|
+
if (applied.has(stripId)) return;
|
|
19371
|
+
applied.add(stripId);
|
|
19372
|
+
const strip = getChannelStrip(stripId);
|
|
19373
|
+
const comp = meta.trackCompression?.[trackIdx];
|
|
19374
|
+
if (comp !== void 0) strip.setCompression(comp);
|
|
19375
|
+
const width = meta.trackWidth?.[trackIdx];
|
|
19376
|
+
if (width !== void 0) strip.setWidth(width);
|
|
19377
|
+
const eqLow = meta.trackEqLow?.[trackIdx];
|
|
19378
|
+
if (eqLow !== void 0) strip.setEqLow(eqLow);
|
|
19379
|
+
const eqMid = meta.trackEqMid?.[trackIdx];
|
|
19380
|
+
if (eqMid !== void 0) strip.setEqMid(eqMid);
|
|
19381
|
+
const eqHigh = meta.trackEqHigh?.[trackIdx];
|
|
19382
|
+
if (eqHigh !== void 0) strip.setEqHigh(eqHigh);
|
|
19383
|
+
const reverbSend = meta.trackReverbSend?.[trackIdx];
|
|
19384
|
+
if (reverbSend !== void 0) strip.setReverbSend(reverbSend);
|
|
19385
|
+
const delaySend = meta.trackDelaySend?.[trackIdx];
|
|
19386
|
+
if (delaySend !== void 0) strip.setDelaySend(delaySend);
|
|
19387
|
+
const pan = meta.trackPan?.[trackIdx];
|
|
19388
|
+
if (pan !== void 0) strip.setPan(panToStereo(pan));
|
|
19389
|
+
};
|
|
19390
|
+
};
|
|
19358
19391
|
const resumeAudio = () => {
|
|
19359
19392
|
if (audioCtx.state === "closed") return Promise.resolve();
|
|
19360
19393
|
return audioCtx.resume();
|
|
@@ -19922,8 +19955,10 @@ var createDtmStudio = async (options = {}) => {
|
|
|
19922
19955
|
),
|
|
19923
19956
|
loadPlayerTrackInstruments()
|
|
19924
19957
|
]);
|
|
19958
|
+
const applyTrackStrip = createTrackStripApplier(meta);
|
|
19925
19959
|
const playPlayerNote = (e) => {
|
|
19926
19960
|
const idx = Number(e.trackId);
|
|
19961
|
+
applyTrackStrip(e.trackId, idx);
|
|
19927
19962
|
const overrideKey = playerTrackInstKeys.get(idx);
|
|
19928
19963
|
let sfInst;
|
|
19929
19964
|
if (overrideKey) {
|
|
@@ -20009,8 +20044,10 @@ var createDtmStudio = async (options = {}) => {
|
|
|
20009
20044
|
),
|
|
20010
20045
|
loadPlayerTrackInstruments()
|
|
20011
20046
|
]);
|
|
20047
|
+
const applyTrackStrip = createTrackStripApplier(meta);
|
|
20012
20048
|
const playPlayerNote = (e) => {
|
|
20013
|
-
const { trackIdx
|
|
20049
|
+
const { trackIdx } = resolveTrackIdxAndRole(e.trackId);
|
|
20050
|
+
applyTrackStrip(e.trackId, trackIdx);
|
|
20014
20051
|
const overrideKey = playerTrackInstKeys.get(trackIdx);
|
|
20015
20052
|
let sfInst;
|
|
20016
20053
|
if (overrideKey) {
|
|
@@ -20089,8 +20126,10 @@ var createDtmStudio = async (options = {}) => {
|
|
|
20089
20126
|
),
|
|
20090
20127
|
loadPlayerTrackInstruments()
|
|
20091
20128
|
]);
|
|
20129
|
+
const applyTrackStrip = createTrackStripApplier(meta);
|
|
20092
20130
|
const playPlayerNote = (e) => {
|
|
20093
|
-
const { trackIdx
|
|
20131
|
+
const { trackIdx } = resolveTrackIdxAndRole(e.trackId);
|
|
20132
|
+
applyTrackStrip(e.trackId, trackIdx);
|
|
20094
20133
|
const overrideKey = playerTrackInstKeys.get(trackIdx);
|
|
20095
20134
|
let sfInst;
|
|
20096
20135
|
if (overrideKey) {
|
package/dist/index.mjs
CHANGED
|
@@ -8717,8 +8717,8 @@ var mountMmlPlayer = (target, mml, options = {}) => {
|
|
|
8717
8717
|
...normalizeDrumPatterns(options.drumPatterns ?? {})
|
|
8718
8718
|
};
|
|
8719
8719
|
const drumPatternName = meta.drum ?? "none";
|
|
8720
|
-
const trackVolume =
|
|
8721
|
-
let masterVolume = options.masterVolume ?? 50;
|
|
8720
|
+
const trackVolume = options.volume ?? 100;
|
|
8721
|
+
let masterVolume = meta.volume ?? options.masterVolume ?? 50;
|
|
8722
8722
|
const drumVolume = meta.drumVolume ?? 80;
|
|
8723
8723
|
const colors = options.trackColors ?? DEFAULT_TRACK_COLORS;
|
|
8724
8724
|
const useSynth = options.synth ?? !options.onPlayNote;
|
|
@@ -8758,14 +8758,20 @@ var mountMmlPlayer = (target, mml, options = {}) => {
|
|
|
8758
8758
|
}
|
|
8759
8759
|
const seqTracks = trackIndices.map((index) => {
|
|
8760
8760
|
let id = 0;
|
|
8761
|
-
const
|
|
8761
|
+
const trackPlacements = placements.filter((p) => p.trackIndex === index);
|
|
8762
|
+
const headerVelocity = trackPlacements[0]?.velocity ?? DEFAULT_VELOCITY;
|
|
8763
|
+
const notes = trackPlacements.map((p) => ({
|
|
8762
8764
|
id: id++,
|
|
8763
8765
|
startStep: p.startStep,
|
|
8764
8766
|
durationSteps: p.durationSteps,
|
|
8765
8767
|
pitch: p.pitch,
|
|
8766
|
-
velocity:
|
|
8768
|
+
velocity: DEFAULT_VELOCITY
|
|
8767
8769
|
}));
|
|
8768
|
-
return {
|
|
8770
|
+
return {
|
|
8771
|
+
id: String(index),
|
|
8772
|
+
volume: trackVolume * headerVelocity / DEFAULT_VELOCITY,
|
|
8773
|
+
notes
|
|
8774
|
+
};
|
|
8769
8775
|
});
|
|
8770
8776
|
const colorOf = (index) => colors[index % colors.length] ?? DEFAULT_TRACK_COLORS[0];
|
|
8771
8777
|
let audioCtx = null;
|
|
@@ -9024,6 +9030,9 @@ var mountMmlPlayer = (target, mml, options = {}) => {
|
|
|
9024
9030
|
singingVoices: options.singingVoices,
|
|
9025
9031
|
drumPatterns: options.drumPatterns,
|
|
9026
9032
|
volume: trackVolume,
|
|
9033
|
+
// 解説モーダル内の試聴サンプルも親と同じマスタ音量で鳴らす
|
|
9034
|
+
// (サンプル側のMMLに `#volume=` があればそちらが優先される)。
|
|
9035
|
+
masterVolume,
|
|
9027
9036
|
// 解説モーダル内の試聴サンプルは規約同意を要求しない。
|
|
9028
9037
|
skipConsent: true,
|
|
9029
9038
|
// 再帰的なモーダル生成を防ぐ。
|
|
@@ -19221,6 +19230,30 @@ var createDtmStudio = async (options = {}) => {
|
|
|
19221
19230
|
}
|
|
19222
19231
|
return strip;
|
|
19223
19232
|
};
|
|
19233
|
+
const createTrackStripApplier = (meta) => {
|
|
19234
|
+
const applied = /* @__PURE__ */ new Set();
|
|
19235
|
+
return (stripId, trackIdx) => {
|
|
19236
|
+
if (applied.has(stripId)) return;
|
|
19237
|
+
applied.add(stripId);
|
|
19238
|
+
const strip = getChannelStrip(stripId);
|
|
19239
|
+
const comp = meta.trackCompression?.[trackIdx];
|
|
19240
|
+
if (comp !== void 0) strip.setCompression(comp);
|
|
19241
|
+
const width = meta.trackWidth?.[trackIdx];
|
|
19242
|
+
if (width !== void 0) strip.setWidth(width);
|
|
19243
|
+
const eqLow = meta.trackEqLow?.[trackIdx];
|
|
19244
|
+
if (eqLow !== void 0) strip.setEqLow(eqLow);
|
|
19245
|
+
const eqMid = meta.trackEqMid?.[trackIdx];
|
|
19246
|
+
if (eqMid !== void 0) strip.setEqMid(eqMid);
|
|
19247
|
+
const eqHigh = meta.trackEqHigh?.[trackIdx];
|
|
19248
|
+
if (eqHigh !== void 0) strip.setEqHigh(eqHigh);
|
|
19249
|
+
const reverbSend = meta.trackReverbSend?.[trackIdx];
|
|
19250
|
+
if (reverbSend !== void 0) strip.setReverbSend(reverbSend);
|
|
19251
|
+
const delaySend = meta.trackDelaySend?.[trackIdx];
|
|
19252
|
+
if (delaySend !== void 0) strip.setDelaySend(delaySend);
|
|
19253
|
+
const pan = meta.trackPan?.[trackIdx];
|
|
19254
|
+
if (pan !== void 0) strip.setPan(panToStereo(pan));
|
|
19255
|
+
};
|
|
19256
|
+
};
|
|
19224
19257
|
const resumeAudio = () => {
|
|
19225
19258
|
if (audioCtx.state === "closed") return Promise.resolve();
|
|
19226
19259
|
return audioCtx.resume();
|
|
@@ -19788,8 +19821,10 @@ var createDtmStudio = async (options = {}) => {
|
|
|
19788
19821
|
),
|
|
19789
19822
|
loadPlayerTrackInstruments()
|
|
19790
19823
|
]);
|
|
19824
|
+
const applyTrackStrip = createTrackStripApplier(meta);
|
|
19791
19825
|
const playPlayerNote = (e) => {
|
|
19792
19826
|
const idx = Number(e.trackId);
|
|
19827
|
+
applyTrackStrip(e.trackId, idx);
|
|
19793
19828
|
const overrideKey = playerTrackInstKeys.get(idx);
|
|
19794
19829
|
let sfInst;
|
|
19795
19830
|
if (overrideKey) {
|
|
@@ -19875,8 +19910,10 @@ var createDtmStudio = async (options = {}) => {
|
|
|
19875
19910
|
),
|
|
19876
19911
|
loadPlayerTrackInstruments()
|
|
19877
19912
|
]);
|
|
19913
|
+
const applyTrackStrip = createTrackStripApplier(meta);
|
|
19878
19914
|
const playPlayerNote = (e) => {
|
|
19879
|
-
const { trackIdx
|
|
19915
|
+
const { trackIdx } = resolveTrackIdxAndRole(e.trackId);
|
|
19916
|
+
applyTrackStrip(e.trackId, trackIdx);
|
|
19880
19917
|
const overrideKey = playerTrackInstKeys.get(trackIdx);
|
|
19881
19918
|
let sfInst;
|
|
19882
19919
|
if (overrideKey) {
|
|
@@ -19955,8 +19992,10 @@ var createDtmStudio = async (options = {}) => {
|
|
|
19955
19992
|
),
|
|
19956
19993
|
loadPlayerTrackInstruments()
|
|
19957
19994
|
]);
|
|
19995
|
+
const applyTrackStrip = createTrackStripApplier(meta);
|
|
19958
19996
|
const playPlayerNote = (e) => {
|
|
19959
|
-
const { trackIdx
|
|
19997
|
+
const { trackIdx } = resolveTrackIdxAndRole(e.trackId);
|
|
19998
|
+
applyTrackStrip(e.trackId, trackIdx);
|
|
19960
19999
|
const overrideKey = playerTrackInstKeys.get(trackIdx);
|
|
19961
20000
|
let sfInst;
|
|
19962
20001
|
if (overrideKey) {
|
package/package.json
CHANGED