@onjmin/dtm 0.1.44 → 0.1.47
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.d.mts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +33 -9
- package/dist/index.mjs +32 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1186,6 +1186,8 @@ type MMLNotePlacement = {
|
|
|
1186
1186
|
startStep: number;
|
|
1187
1187
|
pitch: number;
|
|
1188
1188
|
durationSteps: number;
|
|
1189
|
+
/** v コマンドで指定されたベロシティ(0-127、既定100) */
|
|
1190
|
+
velocity: number;
|
|
1189
1191
|
};
|
|
1190
1192
|
/** 再生ビュー用の表示トークン(mountMmlPlayer のノート列ハイライトに使う) */
|
|
1191
1193
|
type MMLDisplayToken = {
|
|
@@ -1690,6 +1692,20 @@ declare const DAW_CSS = "\n@font-face {\n font-family: 'k8x12';\n src: url('ht
|
|
|
1690
1692
|
* スタイルを document.head に一度だけ注入する。
|
|
1691
1693
|
*/
|
|
1692
1694
|
declare const injectStyles: (doc?: Document) => void;
|
|
1695
|
+
/**
|
|
1696
|
+
* container 内にローディング画面を表示する。
|
|
1697
|
+
*
|
|
1698
|
+
* - `remove()` でオーバーレイを除去する。
|
|
1699
|
+
* - `setProgress(done, total)` で進捗を反映する。total>0 のときはバーを実測値で
|
|
1700
|
+
* 塗り、`done / total (NN%)` を表示する。total<=0 なら不確定(無限ループ)演出に戻す。
|
|
1701
|
+
*/
|
|
1702
|
+
declare const showLoadingOverlay: (container: HTMLElement, options?: {
|
|
1703
|
+
onSkip?: () => void;
|
|
1704
|
+
skipLabel?: string;
|
|
1705
|
+
}) => {
|
|
1706
|
+
remove: () => void;
|
|
1707
|
+
setProgress: (done: number, total: number, remainingTimeSec?: number | null) => void;
|
|
1708
|
+
};
|
|
1693
1709
|
|
|
1694
1710
|
/**
|
|
1695
1711
|
* 内蔵の簡易square-wave synth + ノイズ系ドラム音。
|
|
@@ -1719,4 +1735,4 @@ declare const createSynth: (ctx: AudioContext, destination?: AudioNode) => Synth
|
|
|
1719
1735
|
|
|
1720
1736
|
declare const VOICE_IMAGES: Record<string, string>;
|
|
1721
1737
|
|
|
1722
|
-
export { type AddNoteOptions, type ApplyChordOptions, type ChordPatternType, type ChordPlacement, type ConsumedSyllable, type CoreEventHandlers, DAW_CSS, DEFAULT_BPM, DEFAULT_GATE, DEFAULT_PAN, DEFAULT_PLAYBACK_VELOCITY, DEFAULT_STEPS_PER_BAR, DEFAULT_VELOCITY, DEFAULT_VOCAL_VOLUME, DRUM_FONT, DRUM_KEYS, DRUM_PATTERNS, type DawInstance, type DawMode, type DawOptions, type DawViewState, type DrumPattern, type DtmStudio, type DtmStudioEngines, type DtmStudioOptions, type ExportMidiOptions, GM_INSTRUMENT_NAMES, INSTRUMENT_PRESETS, type InstrumentPreset, KOE_BASE_URL, KOE_VOICEBANKS, KOE_VOICEBANK_LABELS, KOE_VOICEBANK_TERMS, type KoeVoiceOptions, LinkedList, type LoopConfig, type LoopPoint, type LyricSyllable, type LyricSyncData, type LyricTrack, type LyricsConductor, MAX_VOCAL_VOLUME, MMLCore, type MMLDisplayToken, type MMLNotePlacement, MML_END_MARKER, type MidiExtraction, type MidiNotePlacement, type MidiTrackAnalysis, type MmlMeta, type MmlPlayback, type MmlPlayerInstance, type MmlPlayerOptions, type ModeSwitchInstance, type ModeSwitchOptions, type MountEditorOptions, type MountPlayerOptions, type Note, type NoteData, type NoteRemove, PITCH_MAP, PREWARM_NOTES, type ParseMMLOptions, type ParseMidiFn, type ParsedMML, type PianoRollInstance, type PianoRollOptions, type PitchToken, type PlayDrumEvent, type PlayMmlOptions, type PlayNoteEvent, type PlaySingingMmlOptions, type PlaybackCue, type PlaybackState, type PresetSelectInstance, type PresetSelectOptions, type PreviewSoundCallback, type RenderConfig, type Sequencer, type SequencerOptions, type SequencerTrack, type SingingVoices, type SingingVoicesOptions, type StreamPlaybackOptions, type StreamVoiceNote, type StreamVoiceTrack, type Synth, TRACKS_ADVANCED, TRACKS_SIMPLE, type ToolMode, type TrackConfig, VOICE_IMAGES, VOICE_IMAGE_KEY, type VoiceModel, type VoiceRegistry, analyzeMidiTracks, applyHarmonicFilter, applyMonophonic, buildChordPlacements, buildNameToKeyMapping, collectPitchTokens, createAudioContext, createDtmStudio, createKlattVoice, createKoeVoice, createLyricsConductor, createPianoRoll, createSequencer, createSingingVoices, createSynth, createVoiceRegistry, decodeMml, decomposeToMonophonic, drawGrid, drawHeader, drawKeyboard, drawNotes, drawSelectedNotes, drawSelectionRect, encodeMml, exportMIDI, extractMidiPlacements, extractMidiPlacementsByTrack, formatMmlMeta, freqFromPitch, generateRandomPattern, getDrawOffset, getGridCanvas, getGridContext, getGridPosition, getHeaderCanvas, getMidiBPM, getRenderConfig, getXY, icon, init, injectStyles, isChordHeavyTrack, koeUrl, mountDAW, mountMmlPlayer, normalizeLyrics, onClick, panToStereo, parseLyrics, parseMML, parseMmlMeta, playMML, playSingingMML, setDrawOffset, shiftNotes, stripLyrics, stripMmlMeta, vocalVolumeToGain };
|
|
1738
|
+
export { type AddNoteOptions, type ApplyChordOptions, type ChordPatternType, type ChordPlacement, type ConsumedSyllable, type CoreEventHandlers, DAW_CSS, DEFAULT_BPM, DEFAULT_GATE, DEFAULT_PAN, DEFAULT_PLAYBACK_VELOCITY, DEFAULT_STEPS_PER_BAR, DEFAULT_VELOCITY, DEFAULT_VOCAL_VOLUME, DRUM_FONT, DRUM_KEYS, DRUM_PATTERNS, type DawInstance, type DawMode, type DawOptions, type DawViewState, type DrumPattern, type DtmStudio, type DtmStudioEngines, type DtmStudioOptions, type ExportMidiOptions, GM_INSTRUMENT_NAMES, INSTRUMENT_PRESETS, type InstrumentPreset, KOE_BASE_URL, KOE_VOICEBANKS, KOE_VOICEBANK_LABELS, KOE_VOICEBANK_TERMS, type KoeVoiceOptions, LinkedList, type LoopConfig, type LoopPoint, type LyricSyllable, type LyricSyncData, type LyricTrack, type LyricsConductor, MAX_VOCAL_VOLUME, MMLCore, type MMLDisplayToken, type MMLNotePlacement, MML_END_MARKER, type MidiExtraction, type MidiNotePlacement, type MidiTrackAnalysis, type MmlMeta, type MmlPlayback, type MmlPlayerInstance, type MmlPlayerOptions, type ModeSwitchInstance, type ModeSwitchOptions, type MountEditorOptions, type MountPlayerOptions, type Note, type NoteData, type NoteRemove, PITCH_MAP, PREWARM_NOTES, type ParseMMLOptions, type ParseMidiFn, type ParsedMML, type PianoRollInstance, type PianoRollOptions, type PitchToken, type PlayDrumEvent, type PlayMmlOptions, type PlayNoteEvent, type PlaySingingMmlOptions, type PlaybackCue, type PlaybackState, type PresetSelectInstance, type PresetSelectOptions, type PreviewSoundCallback, type RenderConfig, type Sequencer, type SequencerOptions, type SequencerTrack, type SingingVoices, type SingingVoicesOptions, type StreamPlaybackOptions, type StreamVoiceNote, type StreamVoiceTrack, type Synth, TRACKS_ADVANCED, TRACKS_SIMPLE, type ToolMode, type TrackConfig, VOICE_IMAGES, VOICE_IMAGE_KEY, type VoiceModel, type VoiceRegistry, analyzeMidiTracks, applyHarmonicFilter, applyMonophonic, buildChordPlacements, buildNameToKeyMapping, collectPitchTokens, createAudioContext, createDtmStudio, createKlattVoice, createKoeVoice, createLyricsConductor, createPianoRoll, createSequencer, createSingingVoices, createSynth, createVoiceRegistry, decodeMml, decomposeToMonophonic, drawGrid, drawHeader, drawKeyboard, drawNotes, drawSelectedNotes, drawSelectionRect, encodeMml, exportMIDI, extractMidiPlacements, extractMidiPlacementsByTrack, formatMmlMeta, freqFromPitch, generateRandomPattern, getDrawOffset, getGridCanvas, getGridContext, getGridPosition, getHeaderCanvas, getMidiBPM, getRenderConfig, getXY, icon, init, injectStyles, isChordHeavyTrack, koeUrl, mountDAW, mountMmlPlayer, normalizeLyrics, onClick, panToStereo, parseLyrics, parseMML, parseMmlMeta, playMML, playSingingMML, setDrawOffset, shiftNotes, showLoadingOverlay, stripLyrics, stripMmlMeta, vocalVolumeToGain };
|
package/dist/index.d.ts
CHANGED
|
@@ -1186,6 +1186,8 @@ type MMLNotePlacement = {
|
|
|
1186
1186
|
startStep: number;
|
|
1187
1187
|
pitch: number;
|
|
1188
1188
|
durationSteps: number;
|
|
1189
|
+
/** v コマンドで指定されたベロシティ(0-127、既定100) */
|
|
1190
|
+
velocity: number;
|
|
1189
1191
|
};
|
|
1190
1192
|
/** 再生ビュー用の表示トークン(mountMmlPlayer のノート列ハイライトに使う) */
|
|
1191
1193
|
type MMLDisplayToken = {
|
|
@@ -1690,6 +1692,20 @@ declare const DAW_CSS = "\n@font-face {\n font-family: 'k8x12';\n src: url('ht
|
|
|
1690
1692
|
* スタイルを document.head に一度だけ注入する。
|
|
1691
1693
|
*/
|
|
1692
1694
|
declare const injectStyles: (doc?: Document) => void;
|
|
1695
|
+
/**
|
|
1696
|
+
* container 内にローディング画面を表示する。
|
|
1697
|
+
*
|
|
1698
|
+
* - `remove()` でオーバーレイを除去する。
|
|
1699
|
+
* - `setProgress(done, total)` で進捗を反映する。total>0 のときはバーを実測値で
|
|
1700
|
+
* 塗り、`done / total (NN%)` を表示する。total<=0 なら不確定(無限ループ)演出に戻す。
|
|
1701
|
+
*/
|
|
1702
|
+
declare const showLoadingOverlay: (container: HTMLElement, options?: {
|
|
1703
|
+
onSkip?: () => void;
|
|
1704
|
+
skipLabel?: string;
|
|
1705
|
+
}) => {
|
|
1706
|
+
remove: () => void;
|
|
1707
|
+
setProgress: (done: number, total: number, remainingTimeSec?: number | null) => void;
|
|
1708
|
+
};
|
|
1693
1709
|
|
|
1694
1710
|
/**
|
|
1695
1711
|
* 内蔵の簡易square-wave synth + ノイズ系ドラム音。
|
|
@@ -1719,4 +1735,4 @@ declare const createSynth: (ctx: AudioContext, destination?: AudioNode) => Synth
|
|
|
1719
1735
|
|
|
1720
1736
|
declare const VOICE_IMAGES: Record<string, string>;
|
|
1721
1737
|
|
|
1722
|
-
export { type AddNoteOptions, type ApplyChordOptions, type ChordPatternType, type ChordPlacement, type ConsumedSyllable, type CoreEventHandlers, DAW_CSS, DEFAULT_BPM, DEFAULT_GATE, DEFAULT_PAN, DEFAULT_PLAYBACK_VELOCITY, DEFAULT_STEPS_PER_BAR, DEFAULT_VELOCITY, DEFAULT_VOCAL_VOLUME, DRUM_FONT, DRUM_KEYS, DRUM_PATTERNS, type DawInstance, type DawMode, type DawOptions, type DawViewState, type DrumPattern, type DtmStudio, type DtmStudioEngines, type DtmStudioOptions, type ExportMidiOptions, GM_INSTRUMENT_NAMES, INSTRUMENT_PRESETS, type InstrumentPreset, KOE_BASE_URL, KOE_VOICEBANKS, KOE_VOICEBANK_LABELS, KOE_VOICEBANK_TERMS, type KoeVoiceOptions, LinkedList, type LoopConfig, type LoopPoint, type LyricSyllable, type LyricSyncData, type LyricTrack, type LyricsConductor, MAX_VOCAL_VOLUME, MMLCore, type MMLDisplayToken, type MMLNotePlacement, MML_END_MARKER, type MidiExtraction, type MidiNotePlacement, type MidiTrackAnalysis, type MmlMeta, type MmlPlayback, type MmlPlayerInstance, type MmlPlayerOptions, type ModeSwitchInstance, type ModeSwitchOptions, type MountEditorOptions, type MountPlayerOptions, type Note, type NoteData, type NoteRemove, PITCH_MAP, PREWARM_NOTES, type ParseMMLOptions, type ParseMidiFn, type ParsedMML, type PianoRollInstance, type PianoRollOptions, type PitchToken, type PlayDrumEvent, type PlayMmlOptions, type PlayNoteEvent, type PlaySingingMmlOptions, type PlaybackCue, type PlaybackState, type PresetSelectInstance, type PresetSelectOptions, type PreviewSoundCallback, type RenderConfig, type Sequencer, type SequencerOptions, type SequencerTrack, type SingingVoices, type SingingVoicesOptions, type StreamPlaybackOptions, type StreamVoiceNote, type StreamVoiceTrack, type Synth, TRACKS_ADVANCED, TRACKS_SIMPLE, type ToolMode, type TrackConfig, VOICE_IMAGES, VOICE_IMAGE_KEY, type VoiceModel, type VoiceRegistry, analyzeMidiTracks, applyHarmonicFilter, applyMonophonic, buildChordPlacements, buildNameToKeyMapping, collectPitchTokens, createAudioContext, createDtmStudio, createKlattVoice, createKoeVoice, createLyricsConductor, createPianoRoll, createSequencer, createSingingVoices, createSynth, createVoiceRegistry, decodeMml, decomposeToMonophonic, drawGrid, drawHeader, drawKeyboard, drawNotes, drawSelectedNotes, drawSelectionRect, encodeMml, exportMIDI, extractMidiPlacements, extractMidiPlacementsByTrack, formatMmlMeta, freqFromPitch, generateRandomPattern, getDrawOffset, getGridCanvas, getGridContext, getGridPosition, getHeaderCanvas, getMidiBPM, getRenderConfig, getXY, icon, init, injectStyles, isChordHeavyTrack, koeUrl, mountDAW, mountMmlPlayer, normalizeLyrics, onClick, panToStereo, parseLyrics, parseMML, parseMmlMeta, playMML, playSingingMML, setDrawOffset, shiftNotes, stripLyrics, stripMmlMeta, vocalVolumeToGain };
|
|
1738
|
+
export { type AddNoteOptions, type ApplyChordOptions, type ChordPatternType, type ChordPlacement, type ConsumedSyllable, type CoreEventHandlers, DAW_CSS, DEFAULT_BPM, DEFAULT_GATE, DEFAULT_PAN, DEFAULT_PLAYBACK_VELOCITY, DEFAULT_STEPS_PER_BAR, DEFAULT_VELOCITY, DEFAULT_VOCAL_VOLUME, DRUM_FONT, DRUM_KEYS, DRUM_PATTERNS, type DawInstance, type DawMode, type DawOptions, type DawViewState, type DrumPattern, type DtmStudio, type DtmStudioEngines, type DtmStudioOptions, type ExportMidiOptions, GM_INSTRUMENT_NAMES, INSTRUMENT_PRESETS, type InstrumentPreset, KOE_BASE_URL, KOE_VOICEBANKS, KOE_VOICEBANK_LABELS, KOE_VOICEBANK_TERMS, type KoeVoiceOptions, LinkedList, type LoopConfig, type LoopPoint, type LyricSyllable, type LyricSyncData, type LyricTrack, type LyricsConductor, MAX_VOCAL_VOLUME, MMLCore, type MMLDisplayToken, type MMLNotePlacement, MML_END_MARKER, type MidiExtraction, type MidiNotePlacement, type MidiTrackAnalysis, type MmlMeta, type MmlPlayback, type MmlPlayerInstance, type MmlPlayerOptions, type ModeSwitchInstance, type ModeSwitchOptions, type MountEditorOptions, type MountPlayerOptions, type Note, type NoteData, type NoteRemove, PITCH_MAP, PREWARM_NOTES, type ParseMMLOptions, type ParseMidiFn, type ParsedMML, type PianoRollInstance, type PianoRollOptions, type PitchToken, type PlayDrumEvent, type PlayMmlOptions, type PlayNoteEvent, type PlaySingingMmlOptions, type PlaybackCue, type PlaybackState, type PresetSelectInstance, type PresetSelectOptions, type PreviewSoundCallback, type RenderConfig, type Sequencer, type SequencerOptions, type SequencerTrack, type SingingVoices, type SingingVoicesOptions, type StreamPlaybackOptions, type StreamVoiceNote, type StreamVoiceTrack, type Synth, TRACKS_ADVANCED, TRACKS_SIMPLE, type ToolMode, type TrackConfig, VOICE_IMAGES, VOICE_IMAGE_KEY, type VoiceModel, type VoiceRegistry, analyzeMidiTracks, applyHarmonicFilter, applyMonophonic, buildChordPlacements, buildNameToKeyMapping, collectPitchTokens, createAudioContext, createDtmStudio, createKlattVoice, createKoeVoice, createLyricsConductor, createPianoRoll, createSequencer, createSingingVoices, createSynth, createVoiceRegistry, decodeMml, decomposeToMonophonic, drawGrid, drawHeader, drawKeyboard, drawNotes, drawSelectedNotes, drawSelectionRect, encodeMml, exportMIDI, extractMidiPlacements, extractMidiPlacementsByTrack, formatMmlMeta, freqFromPitch, generateRandomPattern, getDrawOffset, getGridCanvas, getGridContext, getGridPosition, getHeaderCanvas, getMidiBPM, getRenderConfig, getXY, icon, init, injectStyles, isChordHeavyTrack, koeUrl, mountDAW, mountMmlPlayer, normalizeLyrics, onClick, panToStereo, parseLyrics, parseMML, parseMmlMeta, playMML, playSingingMML, setDrawOffset, shiftNotes, showLoadingOverlay, stripLyrics, stripMmlMeta, vocalVolumeToGain };
|
package/dist/index.js
CHANGED
|
@@ -103,6 +103,7 @@ __export(index_exports, {
|
|
|
103
103
|
playSingingMML: () => playSingingMML,
|
|
104
104
|
setDrawOffset: () => setDrawOffset,
|
|
105
105
|
shiftNotes: () => shiftNotes,
|
|
106
|
+
showLoadingOverlay: () => showLoadingOverlay,
|
|
106
107
|
stripLyrics: () => stripLyrics,
|
|
107
108
|
stripMmlMeta: () => stripMmlMeta,
|
|
108
109
|
vocalVolumeToGain: () => vocalVolumeToGain
|
|
@@ -4481,6 +4482,7 @@ var parseMML = (mml, options = {}) => {
|
|
|
4481
4482
|
let octave = 4;
|
|
4482
4483
|
let currentStep = 0;
|
|
4483
4484
|
let baseLength = 16;
|
|
4485
|
+
let velocity = 100;
|
|
4484
4486
|
const contributors = /* @__PURE__ */ new Map();
|
|
4485
4487
|
const recordContributor = () => {
|
|
4486
4488
|
let set = contributors.get(trackIndex);
|
|
@@ -4501,6 +4503,7 @@ var parseMML = (mml, options = {}) => {
|
|
|
4501
4503
|
octave = 4;
|
|
4502
4504
|
currentStep = 0;
|
|
4503
4505
|
baseLength = 16;
|
|
4506
|
+
velocity = 100;
|
|
4504
4507
|
continue;
|
|
4505
4508
|
}
|
|
4506
4509
|
const body = part.replace(/\s+/g, "").toLowerCase();
|
|
@@ -4579,6 +4582,8 @@ var parseMML = (mml, options = {}) => {
|
|
|
4579
4582
|
if (bpm === null) {
|
|
4580
4583
|
bpm = clamp2(Number.parseInt(numStr, 10), 1, 255);
|
|
4581
4584
|
}
|
|
4585
|
+
} else if (ch === "v" && numStr) {
|
|
4586
|
+
velocity = clamp2(Number.parseInt(numStr, 10), 0, 127);
|
|
4582
4587
|
}
|
|
4583
4588
|
pushTok("ctrl", currentStep, 0, tokStart);
|
|
4584
4589
|
} else if (ch === "[") {
|
|
@@ -4624,7 +4629,8 @@ var parseMML = (mml, options = {}) => {
|
|
|
4624
4629
|
trackIndex,
|
|
4625
4630
|
startStep: currentStep,
|
|
4626
4631
|
pitch: p,
|
|
4627
|
-
durationSteps: Math.max(1, steps)
|
|
4632
|
+
durationSteps: Math.max(1, steps),
|
|
4633
|
+
velocity
|
|
4628
4634
|
});
|
|
4629
4635
|
}
|
|
4630
4636
|
pushTok("chord", currentStep, Math.max(1, steps), tokStart);
|
|
@@ -4647,7 +4653,8 @@ var parseMML = (mml, options = {}) => {
|
|
|
4647
4653
|
trackIndex,
|
|
4648
4654
|
startStep: currentStep,
|
|
4649
4655
|
pitch: midiPitch,
|
|
4650
|
-
durationSteps: Math.max(1, steps)
|
|
4656
|
+
durationSteps: Math.max(1, steps),
|
|
4657
|
+
velocity
|
|
4651
4658
|
});
|
|
4652
4659
|
pushTok("note", currentStep, Math.max(1, steps), tokStart);
|
|
4653
4660
|
currentStep += steps;
|
|
@@ -6569,7 +6576,7 @@ var mountMmlPlayer = (target, mml, options = {}) => {
|
|
|
6569
6576
|
startStep: p.startStep,
|
|
6570
6577
|
durationSteps: p.durationSteps,
|
|
6571
6578
|
pitch: p.pitch,
|
|
6572
|
-
velocity:
|
|
6579
|
+
velocity: p.velocity
|
|
6573
6580
|
}));
|
|
6574
6581
|
return { id: String(index), volume: trackVolume, notes };
|
|
6575
6582
|
});
|
|
@@ -7954,8 +7961,25 @@ var mountDAW = (target, options = {}) => {
|
|
|
7954
7961
|
const initScrollbarDrag = () => {
|
|
7955
7962
|
let draggingH = false;
|
|
7956
7963
|
let draggingV = false;
|
|
7964
|
+
let hScrollWasPlaying = false;
|
|
7965
|
+
const finishHScroll = () => {
|
|
7966
|
+
if (!draggingH) return;
|
|
7967
|
+
draggingH = false;
|
|
7968
|
+
if (hScrollWasPlaying) {
|
|
7969
|
+
hScrollWasPlaying = false;
|
|
7970
|
+
const snappedStep = Math.max(
|
|
7971
|
+
0,
|
|
7972
|
+
Math.floor(currentOffsetX / renderConfig.stepWidth / snapGridSteps) * snapGridSteps
|
|
7973
|
+
);
|
|
7974
|
+
pausedPlayStep = snappedStep;
|
|
7975
|
+
currentPlayStep = snappedStep;
|
|
7976
|
+
void play();
|
|
7977
|
+
}
|
|
7978
|
+
};
|
|
7957
7979
|
refs.hScroll.addEventListener("pointerdown", (e) => {
|
|
7958
7980
|
draggingH = true;
|
|
7981
|
+
hScrollWasPlaying = playbackState === "playing";
|
|
7982
|
+
if (hScrollWasPlaying) pause();
|
|
7959
7983
|
e.preventDefault();
|
|
7960
7984
|
refs.hScroll.setPointerCapture(e.pointerId);
|
|
7961
7985
|
moveH(e.clientX);
|
|
@@ -7972,9 +7996,7 @@ var mountDAW = (target, options = {}) => {
|
|
|
7972
7996
|
refs.vScroll.addEventListener("pointermove", (e) => {
|
|
7973
7997
|
if (draggingV) moveV(e.clientY);
|
|
7974
7998
|
});
|
|
7975
|
-
refs.hScroll.addEventListener("pointerup",
|
|
7976
|
-
draggingH = false;
|
|
7977
|
-
});
|
|
7999
|
+
refs.hScroll.addEventListener("pointerup", finishHScroll);
|
|
7978
8000
|
refs.vScroll.addEventListener("pointerup", () => {
|
|
7979
8001
|
draggingV = false;
|
|
7980
8002
|
});
|
|
@@ -7983,7 +8005,7 @@ var mountDAW = (target, options = {}) => {
|
|
|
7983
8005
|
if (draggingV) moveV(e.clientY);
|
|
7984
8006
|
});
|
|
7985
8007
|
document.addEventListener("pointerup", () => {
|
|
7986
|
-
|
|
8008
|
+
finishHScroll();
|
|
7987
8009
|
draggingV = false;
|
|
7988
8010
|
});
|
|
7989
8011
|
const moveH = (clientX) => {
|
|
@@ -9043,7 +9065,8 @@ var mountDAW = (target, options = {}) => {
|
|
|
9043
9065
|
const t = trackStates[p.trackIndex];
|
|
9044
9066
|
if (!t) continue;
|
|
9045
9067
|
t.core.addNote(p.startStep, p.pitch, {
|
|
9046
|
-
noteLengthSteps: p.durationSteps
|
|
9068
|
+
noteLengthSteps: p.durationSteps,
|
|
9069
|
+
velocity: p.velocity
|
|
9047
9070
|
});
|
|
9048
9071
|
}
|
|
9049
9072
|
if (parsedBpm) setBpm(parsedBpm);
|
|
@@ -9779,7 +9802,7 @@ var playMML = (mml, options = {}) => {
|
|
|
9779
9802
|
startStep: p.startStep,
|
|
9780
9803
|
durationSteps: p.durationSteps,
|
|
9781
9804
|
pitch: p.pitch,
|
|
9782
|
-
velocity:
|
|
9805
|
+
velocity: p.velocity
|
|
9783
9806
|
}));
|
|
9784
9807
|
return { id: String(index), volume: masterVolume, notes };
|
|
9785
9808
|
});
|
|
@@ -11320,6 +11343,7 @@ var createDtmStudio = async (options = {}) => {
|
|
|
11320
11343
|
playSingingMML,
|
|
11321
11344
|
setDrawOffset,
|
|
11322
11345
|
shiftNotes,
|
|
11346
|
+
showLoadingOverlay,
|
|
11323
11347
|
stripLyrics,
|
|
11324
11348
|
stripMmlMeta,
|
|
11325
11349
|
vocalVolumeToGain
|
package/dist/index.mjs
CHANGED
|
@@ -4370,6 +4370,7 @@ var parseMML = (mml, options = {}) => {
|
|
|
4370
4370
|
let octave = 4;
|
|
4371
4371
|
let currentStep = 0;
|
|
4372
4372
|
let baseLength = 16;
|
|
4373
|
+
let velocity = 100;
|
|
4373
4374
|
const contributors = /* @__PURE__ */ new Map();
|
|
4374
4375
|
const recordContributor = () => {
|
|
4375
4376
|
let set = contributors.get(trackIndex);
|
|
@@ -4390,6 +4391,7 @@ var parseMML = (mml, options = {}) => {
|
|
|
4390
4391
|
octave = 4;
|
|
4391
4392
|
currentStep = 0;
|
|
4392
4393
|
baseLength = 16;
|
|
4394
|
+
velocity = 100;
|
|
4393
4395
|
continue;
|
|
4394
4396
|
}
|
|
4395
4397
|
const body = part.replace(/\s+/g, "").toLowerCase();
|
|
@@ -4468,6 +4470,8 @@ var parseMML = (mml, options = {}) => {
|
|
|
4468
4470
|
if (bpm === null) {
|
|
4469
4471
|
bpm = clamp2(Number.parseInt(numStr, 10), 1, 255);
|
|
4470
4472
|
}
|
|
4473
|
+
} else if (ch === "v" && numStr) {
|
|
4474
|
+
velocity = clamp2(Number.parseInt(numStr, 10), 0, 127);
|
|
4471
4475
|
}
|
|
4472
4476
|
pushTok("ctrl", currentStep, 0, tokStart);
|
|
4473
4477
|
} else if (ch === "[") {
|
|
@@ -4513,7 +4517,8 @@ var parseMML = (mml, options = {}) => {
|
|
|
4513
4517
|
trackIndex,
|
|
4514
4518
|
startStep: currentStep,
|
|
4515
4519
|
pitch: p,
|
|
4516
|
-
durationSteps: Math.max(1, steps)
|
|
4520
|
+
durationSteps: Math.max(1, steps),
|
|
4521
|
+
velocity
|
|
4517
4522
|
});
|
|
4518
4523
|
}
|
|
4519
4524
|
pushTok("chord", currentStep, Math.max(1, steps), tokStart);
|
|
@@ -4536,7 +4541,8 @@ var parseMML = (mml, options = {}) => {
|
|
|
4536
4541
|
trackIndex,
|
|
4537
4542
|
startStep: currentStep,
|
|
4538
4543
|
pitch: midiPitch,
|
|
4539
|
-
durationSteps: Math.max(1, steps)
|
|
4544
|
+
durationSteps: Math.max(1, steps),
|
|
4545
|
+
velocity
|
|
4540
4546
|
});
|
|
4541
4547
|
pushTok("note", currentStep, Math.max(1, steps), tokStart);
|
|
4542
4548
|
currentStep += steps;
|
|
@@ -6458,7 +6464,7 @@ var mountMmlPlayer = (target, mml, options = {}) => {
|
|
|
6458
6464
|
startStep: p.startStep,
|
|
6459
6465
|
durationSteps: p.durationSteps,
|
|
6460
6466
|
pitch: p.pitch,
|
|
6461
|
-
velocity:
|
|
6467
|
+
velocity: p.velocity
|
|
6462
6468
|
}));
|
|
6463
6469
|
return { id: String(index), volume: trackVolume, notes };
|
|
6464
6470
|
});
|
|
@@ -7843,8 +7849,25 @@ var mountDAW = (target, options = {}) => {
|
|
|
7843
7849
|
const initScrollbarDrag = () => {
|
|
7844
7850
|
let draggingH = false;
|
|
7845
7851
|
let draggingV = false;
|
|
7852
|
+
let hScrollWasPlaying = false;
|
|
7853
|
+
const finishHScroll = () => {
|
|
7854
|
+
if (!draggingH) return;
|
|
7855
|
+
draggingH = false;
|
|
7856
|
+
if (hScrollWasPlaying) {
|
|
7857
|
+
hScrollWasPlaying = false;
|
|
7858
|
+
const snappedStep = Math.max(
|
|
7859
|
+
0,
|
|
7860
|
+
Math.floor(currentOffsetX / renderConfig.stepWidth / snapGridSteps) * snapGridSteps
|
|
7861
|
+
);
|
|
7862
|
+
pausedPlayStep = snappedStep;
|
|
7863
|
+
currentPlayStep = snappedStep;
|
|
7864
|
+
void play();
|
|
7865
|
+
}
|
|
7866
|
+
};
|
|
7846
7867
|
refs.hScroll.addEventListener("pointerdown", (e) => {
|
|
7847
7868
|
draggingH = true;
|
|
7869
|
+
hScrollWasPlaying = playbackState === "playing";
|
|
7870
|
+
if (hScrollWasPlaying) pause();
|
|
7848
7871
|
e.preventDefault();
|
|
7849
7872
|
refs.hScroll.setPointerCapture(e.pointerId);
|
|
7850
7873
|
moveH(e.clientX);
|
|
@@ -7861,9 +7884,7 @@ var mountDAW = (target, options = {}) => {
|
|
|
7861
7884
|
refs.vScroll.addEventListener("pointermove", (e) => {
|
|
7862
7885
|
if (draggingV) moveV(e.clientY);
|
|
7863
7886
|
});
|
|
7864
|
-
refs.hScroll.addEventListener("pointerup",
|
|
7865
|
-
draggingH = false;
|
|
7866
|
-
});
|
|
7887
|
+
refs.hScroll.addEventListener("pointerup", finishHScroll);
|
|
7867
7888
|
refs.vScroll.addEventListener("pointerup", () => {
|
|
7868
7889
|
draggingV = false;
|
|
7869
7890
|
});
|
|
@@ -7872,7 +7893,7 @@ var mountDAW = (target, options = {}) => {
|
|
|
7872
7893
|
if (draggingV) moveV(e.clientY);
|
|
7873
7894
|
});
|
|
7874
7895
|
document.addEventListener("pointerup", () => {
|
|
7875
|
-
|
|
7896
|
+
finishHScroll();
|
|
7876
7897
|
draggingV = false;
|
|
7877
7898
|
});
|
|
7878
7899
|
const moveH = (clientX) => {
|
|
@@ -8932,7 +8953,8 @@ var mountDAW = (target, options = {}) => {
|
|
|
8932
8953
|
const t = trackStates[p.trackIndex];
|
|
8933
8954
|
if (!t) continue;
|
|
8934
8955
|
t.core.addNote(p.startStep, p.pitch, {
|
|
8935
|
-
noteLengthSteps: p.durationSteps
|
|
8956
|
+
noteLengthSteps: p.durationSteps,
|
|
8957
|
+
velocity: p.velocity
|
|
8936
8958
|
});
|
|
8937
8959
|
}
|
|
8938
8960
|
if (parsedBpm) setBpm(parsedBpm);
|
|
@@ -9668,7 +9690,7 @@ var playMML = (mml, options = {}) => {
|
|
|
9668
9690
|
startStep: p.startStep,
|
|
9669
9691
|
durationSteps: p.durationSteps,
|
|
9670
9692
|
pitch: p.pitch,
|
|
9671
|
-
velocity:
|
|
9693
|
+
velocity: p.velocity
|
|
9672
9694
|
}));
|
|
9673
9695
|
return { id: String(index), volume: masterVolume, notes };
|
|
9674
9696
|
});
|
|
@@ -11207,6 +11229,7 @@ export {
|
|
|
11207
11229
|
playSingingMML,
|
|
11208
11230
|
setDrawOffset,
|
|
11209
11231
|
shiftNotes,
|
|
11232
|
+
showLoadingOverlay,
|
|
11210
11233
|
stripLyrics,
|
|
11211
11234
|
stripMmlMeta,
|
|
11212
11235
|
vocalVolumeToGain
|
package/package.json
CHANGED