@dawcore/components 0.0.39-next.14 → 0.0.39-next.16
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/index.d.mts +38 -5
- package/dist/index.d.ts +38 -5
- package/dist/index.js +197 -126
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +116 -44
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -82,7 +82,7 @@ __export(index_exports, {
|
|
|
82
82
|
module.exports = __toCommonJS(index_exports);
|
|
83
83
|
|
|
84
84
|
// <define:__INSTALL_SPECS__>
|
|
85
|
-
var define_INSTALL_SPECS_default = { "@dawcore/faust": "@dawcore/faust@^0.0.2-next.1", "@dawcore/midi": "@dawcore/midi@^0.0.6-next.
|
|
85
|
+
var define_INSTALL_SPECS_default = { "@dawcore/faust": "@dawcore/faust@^0.0.2-next.1", "@dawcore/midi": "@dawcore/midi@^0.0.6-next.10", "@dawcore/transport": "@dawcore/transport@^0.0.16-next.9", "@dawcore/wam": "@dawcore/wam@^0.0.5-next.0", "@waveform-playlist/core": "@waveform-playlist/core@^13.0.0-next.9", "@waveform-playlist/engine": "@waveform-playlist/engine@^14.0.0-next.7", "@waveform-playlist/worklets": "@waveform-playlist/worklets@^13.0.1-next.0", "@waveform-playlist/playout": "@waveform-playlist/playout@^13.0.0-next.9" };
|
|
86
86
|
|
|
87
87
|
// src/elements/daw-annotation.ts
|
|
88
88
|
var import_lit = require("lit");
|
|
@@ -607,8 +607,11 @@ function computePlayingAnnotationId(annotations, time) {
|
|
|
607
607
|
|
|
608
608
|
// src/elements/daw-annotation-list.ts
|
|
609
609
|
function formatAnnotationTime(seconds) {
|
|
610
|
-
const
|
|
611
|
-
const
|
|
610
|
+
const safe = Number.isFinite(seconds) && seconds > 0 ? seconds : 0;
|
|
611
|
+
const floor = Math.floor(safe);
|
|
612
|
+
const rounded = Math.round((safe - floor) * 1e3);
|
|
613
|
+
const whole = rounded === 1e3 ? floor + 1 : floor;
|
|
614
|
+
const ms = rounded === 1e3 ? 0 : rounded;
|
|
612
615
|
const s = whole % 60;
|
|
613
616
|
const m = (whole - s) / 60;
|
|
614
617
|
return m + ":" + String(s).padStart(2, "0") + "." + String(ms).padStart(3, "0");
|
|
@@ -1185,10 +1188,54 @@ function isDomClip(desc) {
|
|
|
1185
1188
|
return desc.kind === "dom";
|
|
1186
1189
|
}
|
|
1187
1190
|
|
|
1191
|
+
// src/utils/track-mix.ts
|
|
1192
|
+
var import_core3 = require("@waveform-playlist/core");
|
|
1193
|
+
var DEFAULT_TRACK_MIX = Object.freeze({
|
|
1194
|
+
volume: 1,
|
|
1195
|
+
pan: 0,
|
|
1196
|
+
muted: false,
|
|
1197
|
+
soloed: false,
|
|
1198
|
+
panLaw: "auto"
|
|
1199
|
+
});
|
|
1200
|
+
function toPanLaw(value) {
|
|
1201
|
+
return (0, import_core3.isDecidedPanLaw)(value) ? value : "auto";
|
|
1202
|
+
}
|
|
1203
|
+
function declaredPanLaw(value) {
|
|
1204
|
+
if (value == null || value === "" || value === "auto" || (0, import_core3.isDecidedPanLaw)(value)) {
|
|
1205
|
+
return toPanLaw(value);
|
|
1206
|
+
}
|
|
1207
|
+
console.warn(
|
|
1208
|
+
'[dawcore] <daw-track pan-law> must be "mono", "stereo" or "auto", got ' + JSON.stringify(value)
|
|
1209
|
+
);
|
|
1210
|
+
return "auto";
|
|
1211
|
+
}
|
|
1212
|
+
function mixOfTrack(track) {
|
|
1213
|
+
return {
|
|
1214
|
+
volume: track.volume,
|
|
1215
|
+
pan: track.pan,
|
|
1216
|
+
muted: track.muted,
|
|
1217
|
+
soloed: track.soloed,
|
|
1218
|
+
panLaw: toPanLaw(track.panLaw)
|
|
1219
|
+
};
|
|
1220
|
+
}
|
|
1221
|
+
function mixOfElement(el) {
|
|
1222
|
+
return {
|
|
1223
|
+
volume: el.volume,
|
|
1224
|
+
pan: el.pan,
|
|
1225
|
+
muted: el.muted,
|
|
1226
|
+
soloed: el.soloed,
|
|
1227
|
+
panLaw: toPanLaw(el.panLaw)
|
|
1228
|
+
};
|
|
1229
|
+
}
|
|
1230
|
+
function clampNumber(value, min, max) {
|
|
1231
|
+
return Math.max(min, Math.min(max, Number(value)));
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1188
1234
|
// src/elements/daw-track.ts
|
|
1189
1235
|
var TRACK_PROPS = [
|
|
1190
1236
|
"volume",
|
|
1191
1237
|
"pan",
|
|
1238
|
+
"panLaw",
|
|
1192
1239
|
"muted",
|
|
1193
1240
|
"soloed",
|
|
1194
1241
|
"src",
|
|
@@ -1202,7 +1249,14 @@ var DawTrackElement = class extends import_lit5.LitElement {
|
|
|
1202
1249
|
super(...arguments);
|
|
1203
1250
|
this.src = "";
|
|
1204
1251
|
/** What the page declared: the attributes, and a property set before the track entered. */
|
|
1205
|
-
this._declared = {
|
|
1252
|
+
this._declared = {
|
|
1253
|
+
name: "",
|
|
1254
|
+
volume: 1,
|
|
1255
|
+
pan: 0,
|
|
1256
|
+
panLaw: "auto",
|
|
1257
|
+
muted: false,
|
|
1258
|
+
soloed: false
|
|
1259
|
+
};
|
|
1206
1260
|
this._fromAttribute = false;
|
|
1207
1261
|
this._internals = this.attachInternals?.() ?? null;
|
|
1208
1262
|
this._kind = "audio";
|
|
@@ -1232,6 +1286,12 @@ var DawTrackElement = class extends import_lit5.LitElement {
|
|
|
1232
1286
|
set pan(value) {
|
|
1233
1287
|
this._request("pan", value);
|
|
1234
1288
|
}
|
|
1289
|
+
get panLaw() {
|
|
1290
|
+
return this._linked("panLaw");
|
|
1291
|
+
}
|
|
1292
|
+
set panLaw(value) {
|
|
1293
|
+
this._request("panLaw", declaredPanLaw(value));
|
|
1294
|
+
}
|
|
1235
1295
|
get muted() {
|
|
1236
1296
|
return this._linked("muted");
|
|
1237
1297
|
}
|
|
@@ -1443,6 +1503,9 @@ __decorateClass([
|
|
|
1443
1503
|
__decorateClass([
|
|
1444
1504
|
(0, import_decorators5.property)({ type: Number, noAccessor: true })
|
|
1445
1505
|
], DawTrackElement.prototype, "pan", 1);
|
|
1506
|
+
__decorateClass([
|
|
1507
|
+
(0, import_decorators5.property)({ attribute: "pan-law", noAccessor: true })
|
|
1508
|
+
], DawTrackElement.prototype, "panLaw", 1);
|
|
1446
1509
|
__decorateClass([
|
|
1447
1510
|
(0, import_decorators5.property)({ type: Boolean, noAccessor: true })
|
|
1448
1511
|
], DawTrackElement.prototype, "muted", 1);
|
|
@@ -2505,7 +2568,7 @@ DawStopButtonElement = __decorateClass([
|
|
|
2505
2568
|
var import_lit19 = require("lit");
|
|
2506
2569
|
var import_decorators16 = require("lit/decorators.js");
|
|
2507
2570
|
var import_repeat = require("lit/directives/repeat.js");
|
|
2508
|
-
var
|
|
2571
|
+
var import_core22 = require("@waveform-playlist/core");
|
|
2509
2572
|
|
|
2510
2573
|
// src/workers/peaksWorker.ts
|
|
2511
2574
|
var import_waveform_data = __toESM(require("waveform-data"));
|
|
@@ -3043,7 +3106,7 @@ function computeTemporalTicks(samplesPerPixel, sampleRate, duration, rulerHeight
|
|
|
3043
3106
|
}
|
|
3044
3107
|
|
|
3045
3108
|
// src/utils/musical-tick-cache.ts
|
|
3046
|
-
var
|
|
3109
|
+
var import_core4 = require("@waveform-playlist/core");
|
|
3047
3110
|
var cachedParams = null;
|
|
3048
3111
|
var cachedResult = null;
|
|
3049
3112
|
function meterEntriesMatch(a, b) {
|
|
@@ -3061,7 +3124,7 @@ function getCachedMusicalTicks(params) {
|
|
|
3061
3124
|
if (cachedParams && cachedResult && paramsMatch(cachedParams, params)) {
|
|
3062
3125
|
return cachedResult;
|
|
3063
3126
|
}
|
|
3064
|
-
cachedResult = (0,
|
|
3127
|
+
cachedResult = (0, import_core4.computeMusicalTicks)(params);
|
|
3065
3128
|
cachedParams = {
|
|
3066
3129
|
...params,
|
|
3067
3130
|
meterEntries: params.meterEntries.map((e) => ({ ...e }))
|
|
@@ -3251,27 +3314,10 @@ DawRulerElement = __decorateClass([
|
|
|
3251
3314
|
// src/elements/daw-editor.ts
|
|
3252
3315
|
var import_engine3 = require("@waveform-playlist/engine");
|
|
3253
3316
|
|
|
3254
|
-
// src/utils/track-mix.ts
|
|
3255
|
-
var DEFAULT_TRACK_MIX = Object.freeze({
|
|
3256
|
-
volume: 1,
|
|
3257
|
-
pan: 0,
|
|
3258
|
-
muted: false,
|
|
3259
|
-
soloed: false
|
|
3260
|
-
});
|
|
3261
|
-
function mixOfTrack(track) {
|
|
3262
|
-
return { volume: track.volume, pan: track.pan, muted: track.muted, soloed: track.soloed };
|
|
3263
|
-
}
|
|
3264
|
-
function mixOfElement(el) {
|
|
3265
|
-
return { volume: el.volume, pan: el.pan, muted: el.muted, soloed: el.soloed };
|
|
3266
|
-
}
|
|
3267
|
-
function clampNumber(value, min, max) {
|
|
3268
|
-
return Math.max(min, Math.min(max, Number(value)));
|
|
3269
|
-
}
|
|
3270
|
-
|
|
3271
3317
|
// src/elements/daw-track-controls.ts
|
|
3272
3318
|
var import_lit15 = require("lit");
|
|
3273
3319
|
var import_decorators14 = require("lit/decorators.js");
|
|
3274
|
-
var
|
|
3320
|
+
var import_core5 = require("@waveform-playlist/core");
|
|
3275
3321
|
var DawTrackControlsElement = class extends import_lit15.LitElement {
|
|
3276
3322
|
constructor() {
|
|
3277
3323
|
super(...arguments);
|
|
@@ -3291,8 +3337,8 @@ var DawTrackControlsElement = class extends import_lit15.LitElement {
|
|
|
3291
3337
|
* `gesture` id, and the editor makes them one undo step. Each gesture is
|
|
3292
3338
|
* attached to its range input while the element is connected.
|
|
3293
3339
|
*/
|
|
3294
|
-
this._volumeGesture = (0,
|
|
3295
|
-
this._panGesture = (0,
|
|
3340
|
+
this._volumeGesture = (0, import_core5.createMixerGesture)();
|
|
3341
|
+
this._panGesture = (0, import_core5.createMixerGesture)();
|
|
3296
3342
|
this._detachGestures = [];
|
|
3297
3343
|
this._onVolumeInput = (e) => {
|
|
3298
3344
|
const value = Number(e.target.value);
|
|
@@ -3683,7 +3729,7 @@ DawTrackControlsElement = __decorateClass([
|
|
|
3683
3729
|
// src/elements/daw-grid.ts
|
|
3684
3730
|
var import_lit16 = require("lit");
|
|
3685
3731
|
var import_decorators15 = require("lit/decorators.js");
|
|
3686
|
-
var
|
|
3732
|
+
var import_core6 = require("@waveform-playlist/core");
|
|
3687
3733
|
var MAX_CANVAS_WIDTH4 = 1e3;
|
|
3688
3734
|
var DawGridElement = class extends import_lit16.LitElement {
|
|
3689
3735
|
constructor() {
|
|
@@ -3760,7 +3806,7 @@ var DawGridElement = class extends import_lit16.LitElement {
|
|
|
3760
3806
|
ctx.resetTransform();
|
|
3761
3807
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
3762
3808
|
ctx.scale(dpr, dpr);
|
|
3763
|
-
if (pixelsPerQuarterNote * 4 >=
|
|
3809
|
+
if (pixelsPerQuarterNote * 4 >= import_core6.MIN_PIXELS_PER_UNIT) {
|
|
3764
3810
|
ctx.fillStyle = barHighlight;
|
|
3765
3811
|
const majorTicks = ticks.filter((t) => t.type === "major");
|
|
3766
3812
|
for (let i = 0; i < majorTicks.length; i++) {
|
|
@@ -4113,7 +4159,7 @@ function installCommand(...names) {
|
|
|
4113
4159
|
}
|
|
4114
4160
|
|
|
4115
4161
|
// src/controllers/recording-controller.ts
|
|
4116
|
-
var
|
|
4162
|
+
var import_core7 = require("@waveform-playlist/core");
|
|
4117
4163
|
var RecordingController = class {
|
|
4118
4164
|
constructor(host) {
|
|
4119
4165
|
this._sessions = /* @__PURE__ */ new Map();
|
|
@@ -4208,7 +4254,7 @@ var RecordingController = class {
|
|
|
4208
4254
|
}
|
|
4209
4255
|
const channelCount = detectedChannelCount ?? options.channelCount ?? 1;
|
|
4210
4256
|
const startSample = options.startSample ?? Math.floor(this._host.currentTime * this._host.effectiveSampleRate);
|
|
4211
|
-
const latencySamples = (0,
|
|
4257
|
+
const latencySamples = (0, import_core7.resolveRecordingOffsetSamples)({
|
|
4212
4258
|
overrideSeconds: options.latencyOffset,
|
|
4213
4259
|
outputLatency: rawCtx.outputLatency ?? 0,
|
|
4214
4260
|
lookAhead: 0,
|
|
@@ -4377,8 +4423,8 @@ var RecordingController = class {
|
|
|
4377
4423
|
return;
|
|
4378
4424
|
}
|
|
4379
4425
|
const stopCtx = this._host.audioContext;
|
|
4380
|
-
const channelData = session.chunks.map((chunkArr) => (0,
|
|
4381
|
-
const audioBuffer = (0,
|
|
4426
|
+
const channelData = session.chunks.map((chunkArr) => (0, import_core7.concatenateAudioData)(chunkArr));
|
|
4427
|
+
const audioBuffer = (0, import_core7.createAudioBuffer)(
|
|
4382
4428
|
stopCtx,
|
|
4383
4429
|
channelData,
|
|
4384
4430
|
session.captureSampleRate,
|
|
@@ -4472,7 +4518,7 @@ var RecordingController = class {
|
|
|
4472
4518
|
for (let ch = 0; ch < session.channelCount; ch++) {
|
|
4473
4519
|
if (!channels[ch]) continue;
|
|
4474
4520
|
const oldPeakCount = Math.floor(session.peaks[ch].length / 2);
|
|
4475
|
-
session.peaks[ch] = (0,
|
|
4521
|
+
session.peaks[ch] = (0, import_core7.appendPeaks)(
|
|
4476
4522
|
session.peaks[ch],
|
|
4477
4523
|
channels[ch],
|
|
4478
4524
|
// Render-space scale — in beats mode this differs from
|
|
@@ -4769,7 +4815,7 @@ var AnnotationController = class {
|
|
|
4769
4815
|
|
|
4770
4816
|
// src/controllers/spectrogram-controller.ts
|
|
4771
4817
|
var import_spectrogram = require("@dawcore/spectrogram");
|
|
4772
|
-
var
|
|
4818
|
+
var import_core8 = require("@waveform-playlist/core");
|
|
4773
4819
|
var SpectrogramController = class {
|
|
4774
4820
|
constructor(host, workerFactory) {
|
|
4775
4821
|
this.orchestrator = null;
|
|
@@ -4878,18 +4924,18 @@ var SpectrogramController = class {
|
|
|
4878
4924
|
track = c;
|
|
4879
4925
|
break;
|
|
4880
4926
|
}
|
|
4881
|
-
return { ...
|
|
4927
|
+
return { ...import_core8.SPECTROGRAM_DEFAULTS, ...this.editorConfig ?? {}, ...track ?? {} };
|
|
4882
4928
|
}
|
|
4883
4929
|
mergedColorMap() {
|
|
4884
4930
|
for (const c of this.trackColorMaps.values()) {
|
|
4885
|
-
return c ??
|
|
4931
|
+
return c ?? import_core8.DEFAULT_SPECTROGRAM_COLOR_MAP;
|
|
4886
4932
|
}
|
|
4887
|
-
return this.editorColorMap ??
|
|
4933
|
+
return this.editorColorMap ?? import_core8.DEFAULT_SPECTROGRAM_COLOR_MAP;
|
|
4888
4934
|
}
|
|
4889
4935
|
};
|
|
4890
4936
|
|
|
4891
4937
|
// src/interactions/pointer-handler.ts
|
|
4892
|
-
var
|
|
4938
|
+
var import_core9 = require("@waveform-playlist/core");
|
|
4893
4939
|
|
|
4894
4940
|
// src/interactions/constants.ts
|
|
4895
4941
|
var DRAG_THRESHOLD = 3;
|
|
@@ -5060,10 +5106,10 @@ var PointerHandler = class {
|
|
|
5060
5106
|
const h = this._host;
|
|
5061
5107
|
if (h.scaleMode === "beats") {
|
|
5062
5108
|
let tick = px * h.ticksPerPixel;
|
|
5063
|
-
tick = (0,
|
|
5109
|
+
tick = (0, import_core9.snapTickToGrid)(tick, h.snapTo, h._meterEntries, h.ppqn);
|
|
5064
5110
|
return h._ticksToSeconds(tick);
|
|
5065
5111
|
}
|
|
5066
|
-
return (0,
|
|
5112
|
+
return (0, import_core9.pixelsToSeconds)(px, h.samplesPerPixel, h.effectiveSampleRate);
|
|
5067
5113
|
}
|
|
5068
5114
|
_timeToPx(time) {
|
|
5069
5115
|
const h = this._host;
|
|
@@ -5192,7 +5238,7 @@ var PointerHandler = class {
|
|
|
5192
5238
|
};
|
|
5193
5239
|
|
|
5194
5240
|
// src/interactions/clip-pointer-handler.ts
|
|
5195
|
-
var
|
|
5241
|
+
var import_core10 = require("@waveform-playlist/core");
|
|
5196
5242
|
var import_engine = require("@waveform-playlist/engine");
|
|
5197
5243
|
var ClipPointerHandler = class {
|
|
5198
5244
|
constructor(host) {
|
|
@@ -5231,7 +5277,7 @@ var ClipPointerHandler = class {
|
|
|
5231
5277
|
const anchorTick = h._secondsToTicks(anchorSeconds);
|
|
5232
5278
|
const deltaTicks = totalDeltaPx * h.ticksPerPixel;
|
|
5233
5279
|
const targetTick = anchorTick + deltaTicks;
|
|
5234
|
-
const snappedTick = h.snapTo !== "off" ? (0,
|
|
5280
|
+
const snappedTick = h.snapTo !== "off" ? (0, import_core10.snapTickToGrid)(targetTick, h.snapTo, h._meterEntries, h.ppqn) : targetTick;
|
|
5235
5281
|
const snappedSeconds = h._ticksToSeconds(snappedTick);
|
|
5236
5282
|
const snappedSample = Math.round(snappedSeconds * h.effectiveSampleRate);
|
|
5237
5283
|
return snappedSample - anchorSample;
|
|
@@ -5555,8 +5601,8 @@ var ClipPointerHandler = class {
|
|
|
5555
5601
|
};
|
|
5556
5602
|
|
|
5557
5603
|
// src/interactions/annotation-drag.ts
|
|
5558
|
-
var import_core10 = require("@waveform-playlist/core");
|
|
5559
5604
|
var import_core11 = require("@waveform-playlist/core");
|
|
5605
|
+
var import_core12 = require("@waveform-playlist/core");
|
|
5560
5606
|
var AnnotationDragHandler = class {
|
|
5561
5607
|
constructor(host) {
|
|
5562
5608
|
this._drag = null;
|
|
@@ -5622,7 +5668,7 @@ var AnnotationDragHandler = class {
|
|
|
5622
5668
|
) - drag.edgeTime;
|
|
5623
5669
|
let newTick = drag.edgeTime + deltaTicks;
|
|
5624
5670
|
if (this._host.scaleMode === "beats" && this._host.snapTo !== "off") {
|
|
5625
|
-
newTick = (0,
|
|
5671
|
+
newTick = (0, import_core11.snapTickToGrid)(
|
|
5626
5672
|
newTick,
|
|
5627
5673
|
this._host.snapTo,
|
|
5628
5674
|
this._host._meterEntries,
|
|
@@ -5630,7 +5676,7 @@ var AnnotationDragHandler = class {
|
|
|
5630
5676
|
);
|
|
5631
5677
|
}
|
|
5632
5678
|
const clamp = this._host._annotationClampDuration;
|
|
5633
|
-
const updated2 = (0,
|
|
5679
|
+
const updated2 = (0, import_core11.updateAnnotationBoundaries)(
|
|
5634
5680
|
{
|
|
5635
5681
|
annotationIndex: index,
|
|
5636
5682
|
newTime: newTick,
|
|
@@ -5640,15 +5686,15 @@ var AnnotationDragHandler = class {
|
|
|
5640
5686
|
linkEndpoints: drag.track.linkEndpoints
|
|
5641
5687
|
},
|
|
5642
5688
|
{
|
|
5643
|
-
linkThreshold:
|
|
5644
|
-
minDuration: (0,
|
|
5689
|
+
linkThreshold: import_core12.ANNOTATION_LINK_THRESHOLD_TICKS,
|
|
5690
|
+
minDuration: (0, import_core12.annotationMinDurationTicks)(this._host.ppqn)
|
|
5645
5691
|
}
|
|
5646
5692
|
);
|
|
5647
5693
|
applyTickBoundaryResults(elements, updated2, (t) => this._host._ticksToSeconds(t));
|
|
5648
5694
|
return;
|
|
5649
5695
|
}
|
|
5650
5696
|
const deltaSeconds = deltaPx * this._host._renderSpp / this._host.effectiveSampleRate;
|
|
5651
|
-
const updated = (0,
|
|
5697
|
+
const updated = (0, import_core11.updateAnnotationBoundaries)({
|
|
5652
5698
|
annotationIndex: index,
|
|
5653
5699
|
newTime: drag.edgeTime + deltaSeconds,
|
|
5654
5700
|
isDraggingStart: drag.edge === "start",
|
|
@@ -5934,20 +5980,30 @@ function formatDisplayTime(seconds, format) {
|
|
|
5934
5980
|
return clockFormat(safe, 3);
|
|
5935
5981
|
}
|
|
5936
5982
|
}
|
|
5983
|
+
var DECIMAL = /^(\d+(\.\d*)?|\.\d+)$/;
|
|
5984
|
+
var WHOLE = /^\d+$/;
|
|
5985
|
+
var SECONDS_PER_UNIT = [3600, 60, 1];
|
|
5986
|
+
function parseClock(text) {
|
|
5987
|
+
const parts = text.split(":");
|
|
5988
|
+
if (parts.length > 3) return null;
|
|
5989
|
+
const units = SECONDS_PER_UNIT.slice(3 - parts.length);
|
|
5990
|
+
let total = 0;
|
|
5991
|
+
for (let i = 0; i < parts.length; i++) {
|
|
5992
|
+
const isLast = i === parts.length - 1;
|
|
5993
|
+
if (!(isLast ? DECIMAL : WHOLE).test(parts[i])) return null;
|
|
5994
|
+
const value = Number(parts[i]);
|
|
5995
|
+
if (i > 0 && value >= 60) return null;
|
|
5996
|
+
total += value * units[i];
|
|
5997
|
+
}
|
|
5998
|
+
return Number.isFinite(total) ? total : null;
|
|
5999
|
+
}
|
|
5937
6000
|
function parseDisplayTime(value, format) {
|
|
5938
|
-
if (
|
|
5939
|
-
|
|
5940
|
-
if (format
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
if (parts.length !== 3) return 0;
|
|
5945
|
-
const h = parseInt(parts[0], 10) || 0;
|
|
5946
|
-
const m = parseInt(parts[1], 10) || 0;
|
|
5947
|
-
const s = parseFloat(parts[2]) || 0;
|
|
5948
|
-
seconds = h * 3600 + m * 60 + s;
|
|
5949
|
-
}
|
|
5950
|
-
return Math.max(0, seconds);
|
|
6001
|
+
if (typeof value !== "string") return null;
|
|
6002
|
+
const text = value.trim();
|
|
6003
|
+
if (format !== "seconds") return parseClock(text);
|
|
6004
|
+
if (!DECIMAL.test(text)) return null;
|
|
6005
|
+
const seconds = Number(text);
|
|
6006
|
+
return Number.isFinite(seconds) ? seconds : null;
|
|
5951
6007
|
}
|
|
5952
6008
|
|
|
5953
6009
|
// src/interactions/abort.ts
|
|
@@ -6173,7 +6229,7 @@ function stringifyReason(reason) {
|
|
|
6173
6229
|
}
|
|
6174
6230
|
|
|
6175
6231
|
// src/interactions/recording-clip.ts
|
|
6176
|
-
var
|
|
6232
|
+
var import_core13 = require("@waveform-playlist/core");
|
|
6177
6233
|
function addRecordedClip(host, trackId, buf, startSample, durSamples, offsetSamples = 0, clipName) {
|
|
6178
6234
|
let trimmedBuf = buf;
|
|
6179
6235
|
if (offsetSamples > 0 && offsetSamples < buf.length) {
|
|
@@ -6188,7 +6244,7 @@ function addRecordedClip(host, trackId, buf, startSample, durSamples, offsetSamp
|
|
|
6188
6244
|
}
|
|
6189
6245
|
trimmedBuf = trimmed;
|
|
6190
6246
|
}
|
|
6191
|
-
const clip = (0,
|
|
6247
|
+
const clip = (0, import_core13.createClip)({
|
|
6192
6248
|
audioBuffer: trimmedBuf,
|
|
6193
6249
|
startSample,
|
|
6194
6250
|
durationSamples: durSamples,
|
|
@@ -6213,7 +6269,7 @@ function addRecordedClip(host, trackId, buf, startSample, durSamples, offsetSamp
|
|
|
6213
6269
|
...current,
|
|
6214
6270
|
clips: [
|
|
6215
6271
|
...current.clips.flatMap(
|
|
6216
|
-
(c) => (0,
|
|
6272
|
+
(c) => (0, import_core13.isLoadingClip)(c) ? [c] : (0, import_core13.carveClipRange)([c], startSample, startSample + durSamples)
|
|
6217
6273
|
),
|
|
6218
6274
|
clip
|
|
6219
6275
|
]
|
|
@@ -6413,7 +6469,7 @@ function findAudioBufferForClip(host, clip, track) {
|
|
|
6413
6469
|
}
|
|
6414
6470
|
|
|
6415
6471
|
// src/interactions/track-entry.ts
|
|
6416
|
-
var
|
|
6472
|
+
var import_core14 = require("@waveform-playlist/core");
|
|
6417
6473
|
function validMidiNotes(notes) {
|
|
6418
6474
|
return notes.filter((n) => {
|
|
6419
6475
|
const ok = Number.isFinite(n.time) && n.time >= 0 && Number.isFinite(n.duration) && n.duration > 0 && Number.isInteger(n.midi) && n.midi >= 0 && n.midi <= 127 && Number.isFinite(n.velocity) && n.velocity >= 0 && n.velocity <= 1;
|
|
@@ -6450,7 +6506,7 @@ function buildMidiClip(clipDesc, sampleRate) {
|
|
|
6450
6506
|
Math.max(noteSpanSeconds, clipDesc.duration, 1) * sampleRate
|
|
6451
6507
|
);
|
|
6452
6508
|
const requestedDurationSamples = clipDesc.duration > 0 ? Math.round(clipDesc.duration * sampleRate) : sourceDurationSamples;
|
|
6453
|
-
const clip = (0,
|
|
6509
|
+
const clip = (0, import_core14.createClip)({
|
|
6454
6510
|
startSample: Math.round(clipDesc.start * sampleRate),
|
|
6455
6511
|
durationSamples: requestedDurationSamples,
|
|
6456
6512
|
offsetSamples: Math.round(clipDesc.offset * sampleRate),
|
|
@@ -6496,7 +6552,12 @@ function buildArrangementTrack(trackId, descriptor, mix, sampleRate) {
|
|
|
6496
6552
|
else clips.push(isMidi ? buildMidiClip(identified, sampleRate) : buildLoadingClip(identified));
|
|
6497
6553
|
return identified;
|
|
6498
6554
|
});
|
|
6499
|
-
const
|
|
6555
|
+
const { panLaw, ...fields } = mix;
|
|
6556
|
+
const base = {
|
|
6557
|
+
...(0, import_core14.createTrack)({ name: descriptor.name, kind: descriptor.kind, clips: [], ...fields }),
|
|
6558
|
+
// The law the track enters with (#684); 'auto' is the arrangement's default.
|
|
6559
|
+
...(0, import_core14.isDecidedPanLaw)(panLaw) && { panLaw }
|
|
6560
|
+
};
|
|
6500
6561
|
const track = { ...base, id: trackId, clips };
|
|
6501
6562
|
return { track, descriptor: changed ? { ...descriptor, clips: descClips } : descriptor, refused };
|
|
6502
6563
|
}
|
|
@@ -6510,7 +6571,7 @@ function entryIndex(trackEls, trackId, arrangementIds) {
|
|
|
6510
6571
|
}
|
|
6511
6572
|
|
|
6512
6573
|
// src/interactions/load-announcer.ts
|
|
6513
|
-
var
|
|
6574
|
+
var import_core15 = require("@waveform-playlist/core");
|
|
6514
6575
|
var LoadAnnouncer = class {
|
|
6515
6576
|
constructor(_dispatch) {
|
|
6516
6577
|
this._dispatch = _dispatch;
|
|
@@ -6564,7 +6625,7 @@ var LoadAnnouncer = class {
|
|
|
6564
6625
|
let loaded = 0;
|
|
6565
6626
|
let firstError = null;
|
|
6566
6627
|
for (const clip of track.clips) {
|
|
6567
|
-
if (!(0,
|
|
6628
|
+
if (!(0, import_core15.isLoadingClip)(clip)) {
|
|
6568
6629
|
loaded++;
|
|
6569
6630
|
if (this._loadingClips.delete(clip.id)) {
|
|
6570
6631
|
this._clipErrors.delete(clip.id);
|
|
@@ -6612,21 +6673,23 @@ var LoadAnnouncer = class {
|
|
|
6612
6673
|
};
|
|
6613
6674
|
|
|
6614
6675
|
// src/interactions/arrangement-view.ts
|
|
6615
|
-
var
|
|
6676
|
+
var import_core16 = require("@waveform-playlist/core");
|
|
6616
6677
|
var views = /* @__PURE__ */ new WeakMap();
|
|
6617
6678
|
function sameMix(a, b) {
|
|
6618
|
-
return a.volume === b.volume && a.pan === b.pan && a.muted === b.muted && a.soloed === b.soloed;
|
|
6679
|
+
return a.volume === b.volume && a.pan === b.pan && a.muted === b.muted && a.soloed === b.soloed && a.panLaw === b.panLaw;
|
|
6619
6680
|
}
|
|
6620
6681
|
function loadedTrack(track, mix, recording) {
|
|
6621
6682
|
const cached = views.get(track);
|
|
6622
6683
|
if (cached && cached.recording === recording && sameMix(cached.mix, mix)) return cached.view;
|
|
6623
6684
|
const view = {
|
|
6624
6685
|
...track,
|
|
6625
|
-
clips: track.clips.filter((c) => !(0,
|
|
6686
|
+
clips: track.clips.filter((c) => !(0, import_core16.isLoadingClip)(c)),
|
|
6626
6687
|
volume: mix.volume,
|
|
6627
6688
|
pan: mix.pan,
|
|
6628
6689
|
muted: mix.muted || recording,
|
|
6629
|
-
soloed: mix.soloed
|
|
6690
|
+
soloed: mix.soloed,
|
|
6691
|
+
// What both exports pan the track with (core's trackPanLaw, #684).
|
|
6692
|
+
panLaw: mix.panLaw
|
|
6630
6693
|
};
|
|
6631
6694
|
views.set(track, { mix: { ...mix }, recording, view });
|
|
6632
6695
|
return view;
|
|
@@ -6637,7 +6700,7 @@ function mixOf(arrangement, trackId) {
|
|
|
6637
6700
|
return arrangement.recordingTrackIds.has(trackId) ? { ...mix, muted: true } : mix;
|
|
6638
6701
|
}
|
|
6639
6702
|
function clipSeconds(clip, fallbackSampleRate) {
|
|
6640
|
-
if ((0,
|
|
6703
|
+
if ((0, import_core16.isLoadingClip)(clip)) {
|
|
6641
6704
|
return { start: clip.start ?? 0, duration: clip.duration ?? 0, offset: clip.offset ?? 0 };
|
|
6642
6705
|
}
|
|
6643
6706
|
const sr = clip.sampleRate ?? fallbackSampleRate;
|
|
@@ -6678,10 +6741,10 @@ function swapArrangement(host, next) {
|
|
|
6678
6741
|
}
|
|
6679
6742
|
|
|
6680
6743
|
// src/interactions/drag-watch.ts
|
|
6681
|
-
var
|
|
6744
|
+
var import_core17 = require("@waveform-playlist/core");
|
|
6682
6745
|
function clipDragChanged(arrangement, drag) {
|
|
6683
6746
|
const clip = arrangement.getTracks().find((t) => t.id === drag.trackId)?.clips.find((c) => c.id === drag.clipId);
|
|
6684
|
-
if (!clip || (0,
|
|
6747
|
+
if (!clip || (0, import_core17.isLoadingClip)(clip)) return true;
|
|
6685
6748
|
return clip.startSample !== drag.startSample || clip.durationSamples !== drag.durationSamples || clip.offsetSamples !== drag.offsetSamples;
|
|
6686
6749
|
}
|
|
6687
6750
|
function trackDragChanged(arrangement, drag) {
|
|
@@ -6931,10 +6994,10 @@ function loadFaustModule(feature) {
|
|
|
6931
6994
|
}
|
|
6932
6995
|
|
|
6933
6996
|
// src/effects/effects-manager.ts
|
|
6934
|
-
var
|
|
6997
|
+
var import_core19 = require("@waveform-playlist/core");
|
|
6935
6998
|
|
|
6936
6999
|
// src/effects/effect-registry.ts
|
|
6937
|
-
var
|
|
7000
|
+
var import_core18 = require("@waveform-playlist/core");
|
|
6938
7001
|
var MAX_DELAY_SECONDS = 10;
|
|
6939
7002
|
function singleNode(node, applyParams) {
|
|
6940
7003
|
return { input: node, output: node, applyParams };
|
|
@@ -7010,8 +7073,8 @@ function biquadDefinition(spec) {
|
|
|
7010
7073
|
};
|
|
7011
7074
|
}
|
|
7012
7075
|
function registerBuiltIn(type, definition) {
|
|
7013
|
-
if (!(0,
|
|
7014
|
-
(0,
|
|
7076
|
+
if (!(0, import_core18.getEffectDefinitions)().has(type)) {
|
|
7077
|
+
(0, import_core18.registerEffect)(type, { ...definition, builtIn: true });
|
|
7015
7078
|
}
|
|
7016
7079
|
}
|
|
7017
7080
|
function registerBuiltIns() {
|
|
@@ -7166,7 +7229,7 @@ var EffectsManager = class {
|
|
|
7166
7229
|
/** Run a registered effect's async `prepare` hook on the adapter's
|
|
7167
7230
|
* context, so the synchronous addEffect() can create it. */
|
|
7168
7231
|
async prepareEffect(type) {
|
|
7169
|
-
await (0,
|
|
7232
|
+
await (0, import_core19.prepareEffect)(type, this._requireWiring().audioContext);
|
|
7170
7233
|
}
|
|
7171
7234
|
// --- Track chains ---
|
|
7172
7235
|
addTrackEffect(trackId, target, type, params) {
|
|
@@ -7371,7 +7434,7 @@ var EffectsManager = class {
|
|
|
7371
7434
|
this._runOp(chain, target, "setParams", effectId, { [paramId]: value });
|
|
7372
7435
|
};
|
|
7373
7436
|
if (entry.kind === "native") {
|
|
7374
|
-
const definition = (0,
|
|
7437
|
+
const definition = (0, import_core19.getEffectDefinitions)().get(entry.type);
|
|
7375
7438
|
if (!definition) {
|
|
7376
7439
|
throw new Error(
|
|
7377
7440
|
PREFIX2 + 'openEffectGui: no registry definition for effect type "' + entry.type + '"'
|
|
@@ -7430,7 +7493,7 @@ var EffectsManager = class {
|
|
|
7430
7493
|
}
|
|
7431
7494
|
_addToChain(chain, target, type, params) {
|
|
7432
7495
|
const audioContext = this._requireWiring().audioContext;
|
|
7433
|
-
const created = (0,
|
|
7496
|
+
const created = (0, import_core19.createEffectInstance)(type, audioContext, params);
|
|
7434
7497
|
const effectId = chain.add({
|
|
7435
7498
|
kind: "native",
|
|
7436
7499
|
type,
|
|
@@ -7602,8 +7665,8 @@ var EffectsManager = class {
|
|
|
7602
7665
|
if (entry.kind === "native") {
|
|
7603
7666
|
try {
|
|
7604
7667
|
const liveContext = this._requireWiring().audioContext;
|
|
7605
|
-
if ((0,
|
|
7606
|
-
await (0,
|
|
7668
|
+
if ((0, import_core19.needsPrepare)(entry.type, liveContext)) {
|
|
7669
|
+
await (0, import_core19.ensureEffectPrepared)(entry.type, liveContext);
|
|
7607
7670
|
if (superseded() || chain.disposed) return;
|
|
7608
7671
|
}
|
|
7609
7672
|
const id = this._addToChain(chain, target, entry.type, entry.params);
|
|
@@ -7778,8 +7841,8 @@ function toWamParameterMap(params) {
|
|
|
7778
7841
|
}
|
|
7779
7842
|
|
|
7780
7843
|
// src/interactions/export-audio.ts
|
|
7781
|
-
var import_core19 = require("@waveform-playlist/core");
|
|
7782
7844
|
var import_core20 = require("@waveform-playlist/core");
|
|
7845
|
+
var import_core21 = require("@waveform-playlist/core");
|
|
7783
7846
|
var PREFIX3 = "[waveform-playlist] ";
|
|
7784
7847
|
async function exportAudioImpl(host, options = {}) {
|
|
7785
7848
|
const sampleRate = options.sampleRate ?? host.effectiveSampleRate;
|
|
@@ -7814,7 +7877,7 @@ async function exportAudioImpl(host, options = {}) {
|
|
|
7814
7877
|
cleanups.push(chain.dispose);
|
|
7815
7878
|
const volume = ctx.createGain();
|
|
7816
7879
|
volume.gain.value = track.volume;
|
|
7817
|
-
const panStage = (0,
|
|
7880
|
+
const panStage = (0, import_core20.createPanStage)(ctx, track.pan, (0, import_core20.trackPanLaw)(track));
|
|
7818
7881
|
cleanups.push(panStage.dispose);
|
|
7819
7882
|
chain.output.connect(volume);
|
|
7820
7883
|
volume.connect(panStage.input);
|
|
@@ -7896,12 +7959,12 @@ async function buildOfflineChain(ctx, entries) {
|
|
|
7896
7959
|
continue;
|
|
7897
7960
|
}
|
|
7898
7961
|
if (entry.kind === "native") {
|
|
7899
|
-
const definition = (0,
|
|
7962
|
+
const definition = (0, import_core21.getEffectDefinitions)().get(entry.type);
|
|
7900
7963
|
if (entry.bypassed && definition && !definition.wetParam) {
|
|
7901
7964
|
continue;
|
|
7902
7965
|
}
|
|
7903
|
-
await (0,
|
|
7904
|
-
const created = (0,
|
|
7966
|
+
await (0, import_core21.ensureEffectPrepared)(entry.type, ctx);
|
|
7967
|
+
const created = (0, import_core21.createEffectInstance)(entry.type, ctx, entry.params);
|
|
7905
7968
|
if (entry.bypassed && created.wetParam) {
|
|
7906
7969
|
created.instance.applyParams({ [created.wetParam]: 0 });
|
|
7907
7970
|
}
|
|
@@ -9103,7 +9166,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
9103
9166
|
_loadedClip(trackId, clipId) {
|
|
9104
9167
|
const track = this._arrangement.getTracks().find((t) => t.id === trackId);
|
|
9105
9168
|
const clip = track?.clips.find((c) => c.id === clipId);
|
|
9106
|
-
return clip && !(0,
|
|
9169
|
+
return clip && !(0, import_core22.isLoadingClip)(clip) ? clip : void 0;
|
|
9107
9170
|
}
|
|
9108
9171
|
get effectiveSampleRate() {
|
|
9109
9172
|
return this.sampleRate;
|
|
@@ -9204,7 +9267,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
9204
9267
|
const clips = track.clips.map((clip) => {
|
|
9205
9268
|
const el = clipEls.get(clip.id);
|
|
9206
9269
|
const times = clipSeconds(clip, sr);
|
|
9207
|
-
const midi = (0,
|
|
9270
|
+
const midi = (0, import_core22.isLoadingClip)(clip) ? null : clip;
|
|
9208
9271
|
const base = {
|
|
9209
9272
|
src: typeof clip.src === "string" ? clip.src : "",
|
|
9210
9273
|
peaksSrc: extras?.peaksSrc.get(clip.id) ?? this._takenPeaksSrc(clip.id) ?? "",
|
|
@@ -9224,7 +9287,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
9224
9287
|
trackId: track.id,
|
|
9225
9288
|
name: track.name ?? "",
|
|
9226
9289
|
src: extras?.src ?? "",
|
|
9227
|
-
kind: (0,
|
|
9290
|
+
kind: (0, import_core22.trackKind)(track),
|
|
9228
9291
|
renderMode: this._renderModeOf(track.id),
|
|
9229
9292
|
spectrogramConfig: extras?.spectrogramConfig ?? null,
|
|
9230
9293
|
clips,
|
|
@@ -9243,7 +9306,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
9243
9306
|
_defaultExtras(trackId) {
|
|
9244
9307
|
const track = this._arrangementOf(trackId).getTracks().find((t) => t.id === trackId);
|
|
9245
9308
|
if (!track) return null;
|
|
9246
|
-
const kind = (0,
|
|
9309
|
+
const kind = (0, import_core22.trackKind)(track);
|
|
9247
9310
|
return {
|
|
9248
9311
|
kind,
|
|
9249
9312
|
renderMode: trackDescriptorRenderMode(kind, "waveform"),
|
|
@@ -9256,7 +9319,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
9256
9319
|
const extras = this._extras.get(trackId);
|
|
9257
9320
|
if (extras) return extras.renderMode;
|
|
9258
9321
|
const track = this._arrangement.getTracks().find((t) => t.id === trackId);
|
|
9259
|
-
return trackDescriptorRenderMode(track ? (0,
|
|
9322
|
+
return trackDescriptorRenderMode(track ? (0, import_core22.trackKind)(track) : "audio", "waveform");
|
|
9260
9323
|
}
|
|
9261
9324
|
/**
|
|
9262
9325
|
* A track's mix, from its one owner, the arrangement (#843), as the engine
|
|
@@ -9298,7 +9361,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
9298
9361
|
_clipValues(trackId, clipId) {
|
|
9299
9362
|
const clip = this._arrangement.getTracks().find((t) => t.id === this._clipHolderId(trackId, clipId))?.clips.find((c) => c.id === clipId);
|
|
9300
9363
|
if (!clip) return null;
|
|
9301
|
-
const midi = (0,
|
|
9364
|
+
const midi = (0, import_core22.isLoadingClip)(clip) ? null : clip;
|
|
9302
9365
|
return {
|
|
9303
9366
|
...clipSeconds(clip, this.effectiveSampleRate),
|
|
9304
9367
|
gain: clip.gain ?? 1,
|
|
@@ -9317,7 +9380,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
9317
9380
|
_taskGesture(trackId) {
|
|
9318
9381
|
let id = this._taskGestures.get(trackId);
|
|
9319
9382
|
if (!id) {
|
|
9320
|
-
id = (0,
|
|
9383
|
+
id = (0, import_core22.createMixerGesture)().id;
|
|
9321
9384
|
this._taskGestures.set(trackId, id);
|
|
9322
9385
|
if (this._taskGestures.size === 1) queueMicrotask(() => this._taskGestures.clear());
|
|
9323
9386
|
}
|
|
@@ -9343,7 +9406,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
9343
9406
|
const movedIds = /* @__PURE__ */ new Set();
|
|
9344
9407
|
const refused = [];
|
|
9345
9408
|
const others = this._arrangement.getTracks().filter((t) => t.id !== trackId);
|
|
9346
|
-
const kind = (0,
|
|
9409
|
+
const kind = (0, import_core22.trackKind)(track);
|
|
9347
9410
|
const clips = [];
|
|
9348
9411
|
for (const clip of track.clips) {
|
|
9349
9412
|
const holder = others.find((t) => t.clips.some((c) => c.id === clip.id));
|
|
@@ -9407,7 +9470,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
9407
9470
|
/** @internal */
|
|
9408
9471
|
_trackKind(trackId) {
|
|
9409
9472
|
const track = this._arrangement.getTracks().find((t) => t.id === trackId);
|
|
9410
|
-
return track ? (0,
|
|
9473
|
+
return track ? (0, import_core22.trackKind)(track) : null;
|
|
9411
9474
|
}
|
|
9412
9475
|
/** @internal */
|
|
9413
9476
|
_trackIndex(trackId) {
|
|
@@ -9431,18 +9494,22 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
9431
9494
|
if (field === "volume") arrangement.setTrackVolume(trackId, value, options);
|
|
9432
9495
|
else if (field === "pan") arrangement.setTrackPan(trackId, value, options);
|
|
9433
9496
|
else if (field === "muted") arrangement.setTrackMute(trackId, value, options);
|
|
9434
|
-
else arrangement.setTrackSolo(trackId, value, options);
|
|
9497
|
+
else if (field === "soloed") arrangement.setTrackSolo(trackId, value, options);
|
|
9498
|
+
else if (field === "panLaw" && (0, import_core22.isDecidedPanLaw)(value)) {
|
|
9499
|
+
arrangement.setTrackPanLaw(trackId, value, options);
|
|
9500
|
+
}
|
|
9435
9501
|
}
|
|
9436
9502
|
/**
|
|
9437
9503
|
* Change the given mixer fields of a track as ONE undo step (#843): all
|
|
9438
9504
|
* of them carry one fresh gesture id. A field left out is not sent.
|
|
9439
9505
|
*/
|
|
9440
|
-
_writeMixFields(trackId, mix, gesture = (0,
|
|
9506
|
+
_writeMixFields(trackId, mix, gesture = (0, import_core22.createMixerGesture)().id) {
|
|
9441
9507
|
const options = { gesture };
|
|
9442
9508
|
if (mix.volume !== void 0) this._writeMix(trackId, "volume", mix.volume, options);
|
|
9443
9509
|
if (mix.pan !== void 0) this._writeMix(trackId, "pan", mix.pan, options);
|
|
9444
9510
|
if (mix.muted !== void 0) this._writeMix(trackId, "muted", mix.muted, options);
|
|
9445
9511
|
if (mix.soloed !== void 0) this._writeMix(trackId, "soloed", mix.soloed, options);
|
|
9512
|
+
if (mix.panLaw !== void 0) this._writeMix(trackId, "panLaw", mix.panLaw, options);
|
|
9446
9513
|
}
|
|
9447
9514
|
get selectedTrackId() {
|
|
9448
9515
|
return this._selectedTrackId;
|
|
@@ -9944,7 +10011,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
9944
10011
|
const loadedClip = this._loadedClip(trackId, clipId);
|
|
9945
10012
|
if (!loadedClip) {
|
|
9946
10013
|
const loading = t.clips.find((c) => c.id === clipId);
|
|
9947
|
-
if (loading && (0,
|
|
10014
|
+
if (loading && (0, import_core22.isLoadingClip)(loading)) {
|
|
9948
10015
|
this._updateLoadingClip(trackId, loading, clipEl);
|
|
9949
10016
|
return;
|
|
9950
10017
|
}
|
|
@@ -9957,7 +10024,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
9957
10024
|
const sr = oldClip.sampleRate ?? this.effectiveSampleRate;
|
|
9958
10025
|
const isMidiNow = clipEl.midiNotes != null && !clipEl.src;
|
|
9959
10026
|
const wasMidi = oldClip.midiNotes != null;
|
|
9960
|
-
if (isMidiNow && (0,
|
|
10027
|
+
if (isMidiNow && (0, import_core22.trackKind)(t) !== "midi") {
|
|
9961
10028
|
const kindError = clipKindError(t.name ?? "", "audio", true, clipEl.name || clipId);
|
|
9962
10029
|
console.warn("[dawcore] _applyClipUpdate: " + kindError?.message);
|
|
9963
10030
|
this.dispatchEvent(
|
|
@@ -10088,7 +10155,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
10088
10155
|
this._previewPeaks = nextPreview;
|
|
10089
10156
|
}
|
|
10090
10157
|
this._forgetClip(trackId, clipId);
|
|
10091
|
-
const wasLoading = track.clips.some((c) => c.id === clipId && (0,
|
|
10158
|
+
const wasLoading = track.clips.some((c) => c.id === clipId && (0, import_core22.isLoadingClip)(c));
|
|
10092
10159
|
if (options.undoable === false) arrangement.removeClip(trackId, clipId, { undoable: false });
|
|
10093
10160
|
else
|
|
10094
10161
|
arrangement.updateTrack(trackId, (current) => ({
|
|
@@ -10263,7 +10330,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
10263
10330
|
}
|
|
10264
10331
|
this._announcer.expect(trackId, built.refused.length + moved.refused.length);
|
|
10265
10332
|
for (const clip of entering.clips) {
|
|
10266
|
-
if ((0,
|
|
10333
|
+
if ((0, import_core22.isLoadingClip)(clip)) this._announcer.expectClip(clip.id);
|
|
10267
10334
|
}
|
|
10268
10335
|
try {
|
|
10269
10336
|
if (moved.from.size === 0) {
|
|
@@ -10347,7 +10414,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
10347
10414
|
const waveformData = await this._resolvePeaks(peaksSrc);
|
|
10348
10415
|
if (!waveformData) return;
|
|
10349
10416
|
const clip = this._arrangement.getTracks().flatMap((t) => t.clips).find((c) => c.id === clipId);
|
|
10350
|
-
if (!clip || !(0,
|
|
10417
|
+
if (!clip || !(0, import_core22.isLoadingClip)(clip)) return;
|
|
10351
10418
|
const rate = waveformData.sample_rate;
|
|
10352
10419
|
const offset = clip.offset ?? 0;
|
|
10353
10420
|
const seconds = clip.duration ?? Math.max(0, waveformData.duration - offset);
|
|
@@ -10499,7 +10566,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
10499
10566
|
}
|
|
10500
10567
|
const sources = this._arrangement.sources.getSnapshot().sources;
|
|
10501
10568
|
const failed = new Set(
|
|
10502
|
-
track.clips.filter(
|
|
10569
|
+
track.clips.filter(import_core22.isLoadingClip).map((clip) => clip.src).filter((src) => sources.get(src)?.status === "failed")
|
|
10503
10570
|
);
|
|
10504
10571
|
for (const src of failed) this._arrangement.retry(src);
|
|
10505
10572
|
}
|
|
@@ -10529,7 +10596,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
10529
10596
|
}
|
|
10530
10597
|
for (const track of this._arrangement.getTracks()) {
|
|
10531
10598
|
for (const clip of track.clips) {
|
|
10532
|
-
if (!(0,
|
|
10599
|
+
if (!(0, import_core22.isLoadingClip)(clip)) continue;
|
|
10533
10600
|
const seconds = this._placeholderSeconds(clip);
|
|
10534
10601
|
if (seconds === null) continue;
|
|
10535
10602
|
maxSample = Math.max(maxSample, Math.round(((clip.start ?? 0) + seconds) * sr));
|
|
@@ -10663,7 +10730,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
10663
10730
|
if (structuralChange) {
|
|
10664
10731
|
this._recomputeDuration();
|
|
10665
10732
|
this._effectsManager?.rewireTrackChains();
|
|
10666
|
-
const audioTracks = engineState.tracks.filter((t) => (0,
|
|
10733
|
+
const audioTracks = engineState.tracks.filter((t) => (0, import_core22.trackKind)(t) !== "midi");
|
|
10667
10734
|
this._adoptLoadedClips(audioTracks);
|
|
10668
10735
|
syncPeaksForChangedClips(this, audioTracks);
|
|
10669
10736
|
this._announceLoading();
|
|
@@ -10772,7 +10839,8 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
10772
10839
|
volume: config.volume ?? DEFAULT_TRACK_MIX.volume,
|
|
10773
10840
|
pan: config.pan ?? DEFAULT_TRACK_MIX.pan,
|
|
10774
10841
|
muted: config.muted ?? false,
|
|
10775
|
-
soloed: config.soloed ?? false
|
|
10842
|
+
soloed: config.soloed ?? false,
|
|
10843
|
+
panLaw: declaredPanLaw(config.panLaw)
|
|
10776
10844
|
};
|
|
10777
10845
|
this._pending = new Map(this._pending).set(trackId, { descriptor, mix });
|
|
10778
10846
|
const entered = this._waitForEntry(trackId);
|
|
@@ -10861,7 +10929,8 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
10861
10929
|
volume: partial.volume,
|
|
10862
10930
|
pan: partial.pan,
|
|
10863
10931
|
muted: partial.muted,
|
|
10864
|
-
soloed: partial.soloed
|
|
10932
|
+
soloed: partial.soloed,
|
|
10933
|
+
...partial.panLaw !== void 0 && { panLaw: declaredPanLaw(partial.panLaw) }
|
|
10865
10934
|
};
|
|
10866
10935
|
this._writeMixFields(trackId, mix);
|
|
10867
10936
|
if (partial.name !== void 0) this._renameTrack(trackId, partial.name);
|
|
@@ -10901,6 +10970,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
10901
10970
|
if (partial.name !== void 0) el.name = partial.name;
|
|
10902
10971
|
if (partial.volume !== void 0) el.volume = partial.volume;
|
|
10903
10972
|
if (partial.pan !== void 0) el.pan = partial.pan;
|
|
10973
|
+
if (partial.panLaw !== void 0) el.panLaw = partial.panLaw;
|
|
10904
10974
|
if (partial.muted !== void 0) el.muted = partial.muted;
|
|
10905
10975
|
if (partial.soloed !== void 0) el.soloed = partial.soloed;
|
|
10906
10976
|
if (partial.renderMode !== void 0) el.renderMode = partial.renderMode;
|
|
@@ -10926,7 +10996,8 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
10926
10996
|
volume: partial.volume ?? mix.volume,
|
|
10927
10997
|
pan: partial.pan ?? mix.pan,
|
|
10928
10998
|
muted: partial.muted ?? mix.muted,
|
|
10929
|
-
soloed: partial.soloed ?? mix.soloed
|
|
10999
|
+
soloed: partial.soloed ?? mix.soloed,
|
|
11000
|
+
panLaw: partial.panLaw !== void 0 ? declaredPanLaw(partial.panLaw) : mix.panLaw
|
|
10930
11001
|
}
|
|
10931
11002
|
});
|
|
10932
11003
|
}
|
|
@@ -11378,7 +11449,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
11378
11449
|
}
|
|
11379
11450
|
const targetId = options?.trackId ?? this._selectedTrackId;
|
|
11380
11451
|
const target = targetId ? this._arrangement.getTracks().find((t) => t.id === targetId) : void 0;
|
|
11381
|
-
if (targetId && target && (0,
|
|
11452
|
+
if (targetId && target && (0, import_core22.trackKind)(target) === "midi") {
|
|
11382
11453
|
const error = new Error(
|
|
11383
11454
|
'Cannot record onto MIDI track "' + target.name + '": a recording is audio. Select or create an audio track first.'
|
|
11384
11455
|
);
|
|
@@ -11518,7 +11589,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
11518
11589
|
this._mixOf(track.id),
|
|
11519
11590
|
this._arrangement.recordingTrackIds.has(track.id)
|
|
11520
11591
|
);
|
|
11521
|
-
rows.push([track.id, loaded, track.clips.filter(
|
|
11592
|
+
rows.push([track.id, loaded, track.clips.filter(import_core22.isLoadingClip)]);
|
|
11522
11593
|
}
|
|
11523
11594
|
return rows;
|
|
11524
11595
|
}
|
|
@@ -11541,7 +11612,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
11541
11612
|
} else {
|
|
11542
11613
|
const startSample = Math.round(startSec * sr);
|
|
11543
11614
|
left = Math.floor(startSample / spp);
|
|
11544
|
-
width = (0,
|
|
11615
|
+
width = (0, import_core22.clipPixelWidth)(startSample, Math.round(seconds * sr), spp);
|
|
11545
11616
|
}
|
|
11546
11617
|
const failed = this._arrangement.sources.getSnapshot().sources.get(clip.src)?.status === "failed";
|
|
11547
11618
|
const peakData = this._previewPeaks.get(clip.id);
|
|
@@ -11589,7 +11660,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
11589
11660
|
const orderedTracks = this._getOrderedTracks().map(([trackId, track, loading]) => {
|
|
11590
11661
|
const descriptor = {
|
|
11591
11662
|
name: track.name ?? "",
|
|
11592
|
-
kind: (0,
|
|
11663
|
+
kind: (0, import_core22.trackKind)(track),
|
|
11593
11664
|
renderMode: this._renderModeOf(trackId)
|
|
11594
11665
|
};
|
|
11595
11666
|
const firstPeaks = [...track.clips, ...loading].map((c) => this._peaksData.get(c.id) ?? this._previewPeaks.get(c.id)).find((p) => p && p.data.length > 0);
|
|
@@ -11717,7 +11788,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
|
|
|
11717
11788
|
width = Math.round(endTick / this.ticksPerPixel) - clipLeft;
|
|
11718
11789
|
} else {
|
|
11719
11790
|
clipLeft = Math.floor(clip.startSample / spp);
|
|
11720
|
-
width = (0,
|
|
11791
|
+
width = (0, import_core22.clipPixelWidth)(clip.startSample, clip.durationSamples, spp);
|
|
11721
11792
|
}
|
|
11722
11793
|
let clipSegments;
|
|
11723
11794
|
let segmentChannels;
|
|
@@ -12256,7 +12327,7 @@ DawRecordButtonElement = __decorateClass([
|
|
|
12256
12327
|
// src/elements/daw-keyboard-shortcuts.ts
|
|
12257
12328
|
var import_lit22 = require("lit");
|
|
12258
12329
|
var import_decorators19 = require("lit/decorators.js");
|
|
12259
|
-
var
|
|
12330
|
+
var import_core23 = require("@waveform-playlist/core");
|
|
12260
12331
|
var DawKeyboardShortcutsElement = class extends import_lit22.LitElement {
|
|
12261
12332
|
constructor() {
|
|
12262
12333
|
super(...arguments);
|
|
@@ -12284,7 +12355,7 @@ var DawKeyboardShortcutsElement = class extends import_lit22.LitElement {
|
|
|
12284
12355
|
const shortcuts = this.shortcuts;
|
|
12285
12356
|
if (shortcuts.length === 0) return;
|
|
12286
12357
|
try {
|
|
12287
|
-
(0,
|
|
12358
|
+
(0, import_core23.handleKeyboardEvent)(e, shortcuts, true);
|
|
12288
12359
|
} catch (err) {
|
|
12289
12360
|
console.warn("[dawcore] Keyboard shortcut failed (key=" + e.key + "): " + String(err));
|
|
12290
12361
|
const target = this._editor ?? this;
|
|
@@ -12477,7 +12548,7 @@ DawKeyboardShortcutsElement = __decorateClass([
|
|
|
12477
12548
|
// src/elements/daw-spectrogram.ts
|
|
12478
12549
|
var import_lit23 = require("lit");
|
|
12479
12550
|
var import_decorators20 = require("lit/decorators.js");
|
|
12480
|
-
var
|
|
12551
|
+
var import_core24 = require("@waveform-playlist/core");
|
|
12481
12552
|
var DawSpectrogramElement = class extends import_lit23.LitElement {
|
|
12482
12553
|
constructor() {
|
|
12483
12554
|
super(...arguments);
|
|
@@ -12542,11 +12613,11 @@ var DawSpectrogramElement = class extends import_lit23.LitElement {
|
|
|
12542
12613
|
this._unregisterAllCanvases();
|
|
12543
12614
|
this._canvases = [];
|
|
12544
12615
|
if (this.length <= 0) return;
|
|
12545
|
-
const chunkCount = Math.ceil(this.length /
|
|
12616
|
+
const chunkCount = Math.ceil(this.length / import_core24.MAX_CANVAS_WIDTH);
|
|
12546
12617
|
for (let i = 0; i < chunkCount; i++) {
|
|
12547
|
-
const widthPx = Math.min(
|
|
12618
|
+
const widthPx = Math.min(import_core24.MAX_CANVAS_WIDTH, this.length - i * import_core24.MAX_CANVAS_WIDTH);
|
|
12548
12619
|
const canvas = document.createElement("canvas");
|
|
12549
|
-
canvas.style.left = i *
|
|
12620
|
+
canvas.style.left = i * import_core24.MAX_CANVAS_WIDTH + "px";
|
|
12550
12621
|
canvas.style.width = widthPx + "px";
|
|
12551
12622
|
const dpr = window.devicePixelRatio || 1;
|
|
12552
12623
|
canvas.width = widthPx * dpr;
|
|
@@ -12572,7 +12643,7 @@ var DawSpectrogramElement = class extends import_lit23.LitElement {
|
|
|
12572
12643
|
}
|
|
12573
12644
|
for (let i = 0; i < this._canvases.length; i++) {
|
|
12574
12645
|
const canvas = this._canvases[i];
|
|
12575
|
-
const canvasId = (0,
|
|
12646
|
+
const canvasId = (0, import_core24.buildSpectrogramCanvasId)({
|
|
12576
12647
|
clipId: this.clipId,
|
|
12577
12648
|
channelIndex: this.channelIndex,
|
|
12578
12649
|
chunkIndex: i
|
|
@@ -12593,7 +12664,7 @@ var DawSpectrogramElement = class extends import_lit23.LitElement {
|
|
|
12593
12664
|
trackId: this.trackId,
|
|
12594
12665
|
channelIndex: this.channelIndex,
|
|
12595
12666
|
chunkIndex: i,
|
|
12596
|
-
globalPixelOffset: this.originX + i *
|
|
12667
|
+
globalPixelOffset: this.originX + i * import_core24.MAX_CANVAS_WIDTH,
|
|
12597
12668
|
widthPx: parseFloat(canvas.style.width),
|
|
12598
12669
|
heightPx: this.waveHeight
|
|
12599
12670
|
});
|