@waveform-playlist/engine 14.0.0-next.7 → 14.0.0-next.9
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 +15 -15
- package/dist/index.d.mts +20 -13
- package/dist/index.d.ts +20 -13
- package/dist/index.js +17 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -44,6 +44,11 @@ function calculateSplitPoint(splitSample, samplesPerPixel) {
|
|
|
44
44
|
function splitClip(clip, splitSample) {
|
|
45
45
|
const leftDuration = splitSample - clip.startSample;
|
|
46
46
|
const rightDuration = clip.durationSamples - leftDuration;
|
|
47
|
+
const midi = {
|
|
48
|
+
midiNotes: clip.midiNotes,
|
|
49
|
+
midiChannel: clip.midiChannel,
|
|
50
|
+
midiProgram: clip.midiProgram
|
|
51
|
+
};
|
|
47
52
|
const leftName = clip.name ? `${clip.name} (1)` : void 0;
|
|
48
53
|
const rightName = clip.name ? `${clip.name} (2)` : void 0;
|
|
49
54
|
const left = {
|
|
@@ -59,7 +64,8 @@ function splitClip(clip, splitSample) {
|
|
|
59
64
|
fadeIn: clip.fadeIn,
|
|
60
65
|
audioBuffer: clip.audioBuffer,
|
|
61
66
|
waveformData: clip.waveformData,
|
|
62
|
-
src: clip.src
|
|
67
|
+
src: clip.src,
|
|
68
|
+
...midi
|
|
63
69
|
}),
|
|
64
70
|
id: clip.id
|
|
65
71
|
};
|
|
@@ -75,7 +81,8 @@ function splitClip(clip, splitSample) {
|
|
|
75
81
|
fadeOut: clip.fadeOut,
|
|
76
82
|
audioBuffer: clip.audioBuffer,
|
|
77
83
|
waveformData: clip.waveformData,
|
|
78
|
-
src: clip.src
|
|
84
|
+
src: clip.src,
|
|
85
|
+
...midi
|
|
79
86
|
});
|
|
80
87
|
return { left, right };
|
|
81
88
|
}
|
|
@@ -2170,11 +2177,11 @@ var AdapterSync = class {
|
|
|
2170
2177
|
}
|
|
2171
2178
|
};
|
|
2172
2179
|
|
|
2173
|
-
// src/
|
|
2180
|
+
// src/EditorEngine.ts
|
|
2174
2181
|
var DEFAULT_SAMPLE_RATE = 48e3;
|
|
2175
2182
|
var DEFAULT_SAMPLES_PER_PIXEL = 1024;
|
|
2176
2183
|
var DEFAULT_ZOOM_LEVELS = [256, 512, 1024, 2048, 4096, 8192];
|
|
2177
|
-
var
|
|
2184
|
+
var EditorEngine = class {
|
|
2178
2185
|
constructor(options = {}) {
|
|
2179
2186
|
this._detachDecodeContext = null;
|
|
2180
2187
|
this._currentTime = 0;
|
|
@@ -2201,13 +2208,13 @@ var PlaylistEngine = class {
|
|
|
2201
2208
|
});
|
|
2202
2209
|
});
|
|
2203
2210
|
if (this._zoomLevels.length === 0) {
|
|
2204
|
-
throw new Error("
|
|
2211
|
+
throw new Error("EditorEngine: zoomLevels must not be empty");
|
|
2205
2212
|
}
|
|
2206
2213
|
const initialSpp = options.samplesPerPixel ?? DEFAULT_SAMPLES_PER_PIXEL;
|
|
2207
2214
|
const zoomIndex = this._zoomLevels.indexOf(initialSpp);
|
|
2208
2215
|
if (zoomIndex === -1) {
|
|
2209
2216
|
throw new Error(
|
|
2210
|
-
`
|
|
2217
|
+
`EditorEngine: samplesPerPixel ${initialSpp} is not in zoomLevels [${this._zoomLevels.join(", ")}]. Either pass a samplesPerPixel value that exists in zoomLevels, or include ${initialSpp} in your zoomLevels array.`
|
|
2211
2218
|
);
|
|
2212
2219
|
}
|
|
2213
2220
|
this._zoomIndex = zoomIndex;
|
|
@@ -2223,7 +2230,7 @@ var PlaylistEngine = class {
|
|
|
2223
2230
|
this._arrangement = asArrangementImpl(options.arrangement);
|
|
2224
2231
|
if (options.undoLimit !== void 0) {
|
|
2225
2232
|
console.warn(
|
|
2226
|
-
"[waveform-playlist]
|
|
2233
|
+
"[waveform-playlist] EditorEngine: undoLimit is ignored when an arrangement is passed. Set it on createArrangement({ undoLimit })."
|
|
2227
2234
|
);
|
|
2228
2235
|
}
|
|
2229
2236
|
} else {
|
|
@@ -2772,11 +2779,11 @@ var PlaylistEngine = class {
|
|
|
2772
2779
|
function asArrangementImpl(arrangement) {
|
|
2773
2780
|
if (isArrangement(arrangement)) return arrangement;
|
|
2774
2781
|
throw new Error(
|
|
2775
|
-
"[waveform-playlist]
|
|
2782
|
+
"[waveform-playlist] EditorEngine: the `arrangement` option must be an arrangement made by createArrangement()."
|
|
2776
2783
|
);
|
|
2777
2784
|
}
|
|
2778
2785
|
export {
|
|
2779
|
-
|
|
2786
|
+
EditorEngine,
|
|
2780
2787
|
attachDecodeContext,
|
|
2781
2788
|
calculateDuration,
|
|
2782
2789
|
calculateSplitPoint,
|