@dawcore/components 0.0.39-next.13 → 0.0.39-next.15

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 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.8", "@dawcore/transport": "@dawcore/transport@^0.0.16-next.7", "@dawcore/wam": "@dawcore/wam@^0.0.5-next.0", "@waveform-playlist/core": "@waveform-playlist/core@^13.0.0-next.7", "@waveform-playlist/engine": "@waveform-playlist/engine@^14.0.0-next.5", "@waveform-playlist/worklets": "@waveform-playlist/worklets@^13.0.1-next.0", "@waveform-playlist/playout": "@waveform-playlist/playout@^13.0.0-next.7" };
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.6", "@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");
@@ -1185,10 +1185,54 @@ function isDomClip(desc) {
1185
1185
  return desc.kind === "dom";
1186
1186
  }
1187
1187
 
1188
+ // src/utils/track-mix.ts
1189
+ var import_core3 = require("@waveform-playlist/core");
1190
+ var DEFAULT_TRACK_MIX = Object.freeze({
1191
+ volume: 1,
1192
+ pan: 0,
1193
+ muted: false,
1194
+ soloed: false,
1195
+ panLaw: "auto"
1196
+ });
1197
+ function toPanLaw(value) {
1198
+ return (0, import_core3.isDecidedPanLaw)(value) ? value : "auto";
1199
+ }
1200
+ function declaredPanLaw(value) {
1201
+ if (value == null || value === "" || value === "auto" || (0, import_core3.isDecidedPanLaw)(value)) {
1202
+ return toPanLaw(value);
1203
+ }
1204
+ console.warn(
1205
+ '[dawcore] <daw-track pan-law> must be "mono", "stereo" or "auto", got ' + JSON.stringify(value)
1206
+ );
1207
+ return "auto";
1208
+ }
1209
+ function mixOfTrack(track) {
1210
+ return {
1211
+ volume: track.volume,
1212
+ pan: track.pan,
1213
+ muted: track.muted,
1214
+ soloed: track.soloed,
1215
+ panLaw: toPanLaw(track.panLaw)
1216
+ };
1217
+ }
1218
+ function mixOfElement(el) {
1219
+ return {
1220
+ volume: el.volume,
1221
+ pan: el.pan,
1222
+ muted: el.muted,
1223
+ soloed: el.soloed,
1224
+ panLaw: toPanLaw(el.panLaw)
1225
+ };
1226
+ }
1227
+ function clampNumber(value, min, max) {
1228
+ return Math.max(min, Math.min(max, Number(value)));
1229
+ }
1230
+
1188
1231
  // src/elements/daw-track.ts
1189
1232
  var TRACK_PROPS = [
1190
1233
  "volume",
1191
1234
  "pan",
1235
+ "panLaw",
1192
1236
  "muted",
1193
1237
  "soloed",
1194
1238
  "src",
@@ -1202,7 +1246,14 @@ var DawTrackElement = class extends import_lit5.LitElement {
1202
1246
  super(...arguments);
1203
1247
  this.src = "";
1204
1248
  /** What the page declared: the attributes, and a property set before the track entered. */
1205
- this._declared = { name: "", volume: 1, pan: 0, muted: false, soloed: false };
1249
+ this._declared = {
1250
+ name: "",
1251
+ volume: 1,
1252
+ pan: 0,
1253
+ panLaw: "auto",
1254
+ muted: false,
1255
+ soloed: false
1256
+ };
1206
1257
  this._fromAttribute = false;
1207
1258
  this._internals = this.attachInternals?.() ?? null;
1208
1259
  this._kind = "audio";
@@ -1232,6 +1283,12 @@ var DawTrackElement = class extends import_lit5.LitElement {
1232
1283
  set pan(value) {
1233
1284
  this._request("pan", value);
1234
1285
  }
1286
+ get panLaw() {
1287
+ return this._linked("panLaw");
1288
+ }
1289
+ set panLaw(value) {
1290
+ this._request("panLaw", declaredPanLaw(value));
1291
+ }
1235
1292
  get muted() {
1236
1293
  return this._linked("muted");
1237
1294
  }
@@ -1443,6 +1500,9 @@ __decorateClass([
1443
1500
  __decorateClass([
1444
1501
  (0, import_decorators5.property)({ type: Number, noAccessor: true })
1445
1502
  ], DawTrackElement.prototype, "pan", 1);
1503
+ __decorateClass([
1504
+ (0, import_decorators5.property)({ attribute: "pan-law", noAccessor: true })
1505
+ ], DawTrackElement.prototype, "panLaw", 1);
1446
1506
  __decorateClass([
1447
1507
  (0, import_decorators5.property)({ type: Boolean, noAccessor: true })
1448
1508
  ], DawTrackElement.prototype, "muted", 1);
@@ -2505,7 +2565,7 @@ DawStopButtonElement = __decorateClass([
2505
2565
  var import_lit19 = require("lit");
2506
2566
  var import_decorators16 = require("lit/decorators.js");
2507
2567
  var import_repeat = require("lit/directives/repeat.js");
2508
- var import_core21 = require("@waveform-playlist/core");
2568
+ var import_core22 = require("@waveform-playlist/core");
2509
2569
 
2510
2570
  // src/workers/peaksWorker.ts
2511
2571
  var import_waveform_data = __toESM(require("waveform-data"));
@@ -3043,7 +3103,7 @@ function computeTemporalTicks(samplesPerPixel, sampleRate, duration, rulerHeight
3043
3103
  }
3044
3104
 
3045
3105
  // src/utils/musical-tick-cache.ts
3046
- var import_core3 = require("@waveform-playlist/core");
3106
+ var import_core4 = require("@waveform-playlist/core");
3047
3107
  var cachedParams = null;
3048
3108
  var cachedResult = null;
3049
3109
  function meterEntriesMatch(a, b) {
@@ -3061,7 +3121,7 @@ function getCachedMusicalTicks(params) {
3061
3121
  if (cachedParams && cachedResult && paramsMatch(cachedParams, params)) {
3062
3122
  return cachedResult;
3063
3123
  }
3064
- cachedResult = (0, import_core3.computeMusicalTicks)(params);
3124
+ cachedResult = (0, import_core4.computeMusicalTicks)(params);
3065
3125
  cachedParams = {
3066
3126
  ...params,
3067
3127
  meterEntries: params.meterEntries.map((e) => ({ ...e }))
@@ -3251,27 +3311,10 @@ DawRulerElement = __decorateClass([
3251
3311
  // src/elements/daw-editor.ts
3252
3312
  var import_engine3 = require("@waveform-playlist/engine");
3253
3313
 
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
3314
  // src/elements/daw-track-controls.ts
3272
3315
  var import_lit15 = require("lit");
3273
3316
  var import_decorators14 = require("lit/decorators.js");
3274
- var import_core4 = require("@waveform-playlist/core");
3317
+ var import_core5 = require("@waveform-playlist/core");
3275
3318
  var DawTrackControlsElement = class extends import_lit15.LitElement {
3276
3319
  constructor() {
3277
3320
  super(...arguments);
@@ -3291,8 +3334,8 @@ var DawTrackControlsElement = class extends import_lit15.LitElement {
3291
3334
  * `gesture` id, and the editor makes them one undo step. Each gesture is
3292
3335
  * attached to its range input while the element is connected.
3293
3336
  */
3294
- this._volumeGesture = (0, import_core4.createMixerGesture)();
3295
- this._panGesture = (0, import_core4.createMixerGesture)();
3337
+ this._volumeGesture = (0, import_core5.createMixerGesture)();
3338
+ this._panGesture = (0, import_core5.createMixerGesture)();
3296
3339
  this._detachGestures = [];
3297
3340
  this._onVolumeInput = (e) => {
3298
3341
  const value = Number(e.target.value);
@@ -3683,7 +3726,7 @@ DawTrackControlsElement = __decorateClass([
3683
3726
  // src/elements/daw-grid.ts
3684
3727
  var import_lit16 = require("lit");
3685
3728
  var import_decorators15 = require("lit/decorators.js");
3686
- var import_core5 = require("@waveform-playlist/core");
3729
+ var import_core6 = require("@waveform-playlist/core");
3687
3730
  var MAX_CANVAS_WIDTH4 = 1e3;
3688
3731
  var DawGridElement = class extends import_lit16.LitElement {
3689
3732
  constructor() {
@@ -3760,7 +3803,7 @@ var DawGridElement = class extends import_lit16.LitElement {
3760
3803
  ctx.resetTransform();
3761
3804
  ctx.clearRect(0, 0, canvas.width, canvas.height);
3762
3805
  ctx.scale(dpr, dpr);
3763
- if (pixelsPerQuarterNote * 4 >= import_core5.MIN_PIXELS_PER_UNIT) {
3806
+ if (pixelsPerQuarterNote * 4 >= import_core6.MIN_PIXELS_PER_UNIT) {
3764
3807
  ctx.fillStyle = barHighlight;
3765
3808
  const majorTicks = ticks.filter((t) => t.type === "major");
3766
3809
  for (let i = 0; i < majorTicks.length; i++) {
@@ -4113,7 +4156,7 @@ function installCommand(...names) {
4113
4156
  }
4114
4157
 
4115
4158
  // src/controllers/recording-controller.ts
4116
- var import_core6 = require("@waveform-playlist/core");
4159
+ var import_core7 = require("@waveform-playlist/core");
4117
4160
  var RecordingController = class {
4118
4161
  constructor(host) {
4119
4162
  this._sessions = /* @__PURE__ */ new Map();
@@ -4208,7 +4251,7 @@ var RecordingController = class {
4208
4251
  }
4209
4252
  const channelCount = detectedChannelCount ?? options.channelCount ?? 1;
4210
4253
  const startSample = options.startSample ?? Math.floor(this._host.currentTime * this._host.effectiveSampleRate);
4211
- const latencySamples = (0, import_core6.resolveRecordingOffsetSamples)({
4254
+ const latencySamples = (0, import_core7.resolveRecordingOffsetSamples)({
4212
4255
  overrideSeconds: options.latencyOffset,
4213
4256
  outputLatency: rawCtx.outputLatency ?? 0,
4214
4257
  lookAhead: 0,
@@ -4377,8 +4420,8 @@ var RecordingController = class {
4377
4420
  return;
4378
4421
  }
4379
4422
  const stopCtx = this._host.audioContext;
4380
- const channelData = session.chunks.map((chunkArr) => (0, import_core6.concatenateAudioData)(chunkArr));
4381
- const audioBuffer = (0, import_core6.createAudioBuffer)(
4423
+ const channelData = session.chunks.map((chunkArr) => (0, import_core7.concatenateAudioData)(chunkArr));
4424
+ const audioBuffer = (0, import_core7.createAudioBuffer)(
4382
4425
  stopCtx,
4383
4426
  channelData,
4384
4427
  session.captureSampleRate,
@@ -4472,7 +4515,7 @@ var RecordingController = class {
4472
4515
  for (let ch = 0; ch < session.channelCount; ch++) {
4473
4516
  if (!channels[ch]) continue;
4474
4517
  const oldPeakCount = Math.floor(session.peaks[ch].length / 2);
4475
- session.peaks[ch] = (0, import_core6.appendPeaks)(
4518
+ session.peaks[ch] = (0, import_core7.appendPeaks)(
4476
4519
  session.peaks[ch],
4477
4520
  channels[ch],
4478
4521
  // Render-space scale — in beats mode this differs from
@@ -4769,7 +4812,7 @@ var AnnotationController = class {
4769
4812
 
4770
4813
  // src/controllers/spectrogram-controller.ts
4771
4814
  var import_spectrogram = require("@dawcore/spectrogram");
4772
- var import_core7 = require("@waveform-playlist/core");
4815
+ var import_core8 = require("@waveform-playlist/core");
4773
4816
  var SpectrogramController = class {
4774
4817
  constructor(host, workerFactory) {
4775
4818
  this.orchestrator = null;
@@ -4878,18 +4921,18 @@ var SpectrogramController = class {
4878
4921
  track = c;
4879
4922
  break;
4880
4923
  }
4881
- return { ...import_core7.SPECTROGRAM_DEFAULTS, ...this.editorConfig ?? {}, ...track ?? {} };
4924
+ return { ...import_core8.SPECTROGRAM_DEFAULTS, ...this.editorConfig ?? {}, ...track ?? {} };
4882
4925
  }
4883
4926
  mergedColorMap() {
4884
4927
  for (const c of this.trackColorMaps.values()) {
4885
- return c ?? import_core7.DEFAULT_SPECTROGRAM_COLOR_MAP;
4928
+ return c ?? import_core8.DEFAULT_SPECTROGRAM_COLOR_MAP;
4886
4929
  }
4887
- return this.editorColorMap ?? import_core7.DEFAULT_SPECTROGRAM_COLOR_MAP;
4930
+ return this.editorColorMap ?? import_core8.DEFAULT_SPECTROGRAM_COLOR_MAP;
4888
4931
  }
4889
4932
  };
4890
4933
 
4891
4934
  // src/interactions/pointer-handler.ts
4892
- var import_core8 = require("@waveform-playlist/core");
4935
+ var import_core9 = require("@waveform-playlist/core");
4893
4936
 
4894
4937
  // src/interactions/constants.ts
4895
4938
  var DRAG_THRESHOLD = 3;
@@ -5060,10 +5103,10 @@ var PointerHandler = class {
5060
5103
  const h = this._host;
5061
5104
  if (h.scaleMode === "beats") {
5062
5105
  let tick = px * h.ticksPerPixel;
5063
- tick = (0, import_core8.snapTickToGrid)(tick, h.snapTo, h._meterEntries, h.ppqn);
5106
+ tick = (0, import_core9.snapTickToGrid)(tick, h.snapTo, h._meterEntries, h.ppqn);
5064
5107
  return h._ticksToSeconds(tick);
5065
5108
  }
5066
- return (0, import_core8.pixelsToSeconds)(px, h.samplesPerPixel, h.effectiveSampleRate);
5109
+ return (0, import_core9.pixelsToSeconds)(px, h.samplesPerPixel, h.effectiveSampleRate);
5067
5110
  }
5068
5111
  _timeToPx(time) {
5069
5112
  const h = this._host;
@@ -5192,7 +5235,7 @@ var PointerHandler = class {
5192
5235
  };
5193
5236
 
5194
5237
  // src/interactions/clip-pointer-handler.ts
5195
- var import_core9 = require("@waveform-playlist/core");
5238
+ var import_core10 = require("@waveform-playlist/core");
5196
5239
  var import_engine = require("@waveform-playlist/engine");
5197
5240
  var ClipPointerHandler = class {
5198
5241
  constructor(host) {
@@ -5231,7 +5274,7 @@ var ClipPointerHandler = class {
5231
5274
  const anchorTick = h._secondsToTicks(anchorSeconds);
5232
5275
  const deltaTicks = totalDeltaPx * h.ticksPerPixel;
5233
5276
  const targetTick = anchorTick + deltaTicks;
5234
- const snappedTick = h.snapTo !== "off" ? (0, import_core9.snapTickToGrid)(targetTick, h.snapTo, h._meterEntries, h.ppqn) : targetTick;
5277
+ const snappedTick = h.snapTo !== "off" ? (0, import_core10.snapTickToGrid)(targetTick, h.snapTo, h._meterEntries, h.ppqn) : targetTick;
5235
5278
  const snappedSeconds = h._ticksToSeconds(snappedTick);
5236
5279
  const snappedSample = Math.round(snappedSeconds * h.effectiveSampleRate);
5237
5280
  return snappedSample - anchorSample;
@@ -5555,8 +5598,8 @@ var ClipPointerHandler = class {
5555
5598
  };
5556
5599
 
5557
5600
  // src/interactions/annotation-drag.ts
5558
- var import_core10 = require("@waveform-playlist/core");
5559
5601
  var import_core11 = require("@waveform-playlist/core");
5602
+ var import_core12 = require("@waveform-playlist/core");
5560
5603
  var AnnotationDragHandler = class {
5561
5604
  constructor(host) {
5562
5605
  this._drag = null;
@@ -5622,7 +5665,7 @@ var AnnotationDragHandler = class {
5622
5665
  ) - drag.edgeTime;
5623
5666
  let newTick = drag.edgeTime + deltaTicks;
5624
5667
  if (this._host.scaleMode === "beats" && this._host.snapTo !== "off") {
5625
- newTick = (0, import_core10.snapTickToGrid)(
5668
+ newTick = (0, import_core11.snapTickToGrid)(
5626
5669
  newTick,
5627
5670
  this._host.snapTo,
5628
5671
  this._host._meterEntries,
@@ -5630,7 +5673,7 @@ var AnnotationDragHandler = class {
5630
5673
  );
5631
5674
  }
5632
5675
  const clamp = this._host._annotationClampDuration;
5633
- const updated2 = (0, import_core10.updateAnnotationBoundaries)(
5676
+ const updated2 = (0, import_core11.updateAnnotationBoundaries)(
5634
5677
  {
5635
5678
  annotationIndex: index,
5636
5679
  newTime: newTick,
@@ -5640,15 +5683,15 @@ var AnnotationDragHandler = class {
5640
5683
  linkEndpoints: drag.track.linkEndpoints
5641
5684
  },
5642
5685
  {
5643
- linkThreshold: import_core11.ANNOTATION_LINK_THRESHOLD_TICKS,
5644
- minDuration: (0, import_core11.annotationMinDurationTicks)(this._host.ppqn)
5686
+ linkThreshold: import_core12.ANNOTATION_LINK_THRESHOLD_TICKS,
5687
+ minDuration: (0, import_core12.annotationMinDurationTicks)(this._host.ppqn)
5645
5688
  }
5646
5689
  );
5647
5690
  applyTickBoundaryResults(elements, updated2, (t) => this._host._ticksToSeconds(t));
5648
5691
  return;
5649
5692
  }
5650
5693
  const deltaSeconds = deltaPx * this._host._renderSpp / this._host.effectiveSampleRate;
5651
- const updated = (0, import_core10.updateAnnotationBoundaries)({
5694
+ const updated = (0, import_core11.updateAnnotationBoundaries)({
5652
5695
  annotationIndex: index,
5653
5696
  newTime: drag.edgeTime + deltaSeconds,
5654
5697
  isDraggingStart: drag.edge === "start",
@@ -6173,7 +6216,7 @@ function stringifyReason(reason) {
6173
6216
  }
6174
6217
 
6175
6218
  // src/interactions/recording-clip.ts
6176
- var import_core12 = require("@waveform-playlist/core");
6219
+ var import_core13 = require("@waveform-playlist/core");
6177
6220
  function addRecordedClip(host, trackId, buf, startSample, durSamples, offsetSamples = 0, clipName) {
6178
6221
  let trimmedBuf = buf;
6179
6222
  if (offsetSamples > 0 && offsetSamples < buf.length) {
@@ -6188,7 +6231,7 @@ function addRecordedClip(host, trackId, buf, startSample, durSamples, offsetSamp
6188
6231
  }
6189
6232
  trimmedBuf = trimmed;
6190
6233
  }
6191
- const clip = (0, import_core12.createClip)({
6234
+ const clip = (0, import_core13.createClip)({
6192
6235
  audioBuffer: trimmedBuf,
6193
6236
  startSample,
6194
6237
  durationSamples: durSamples,
@@ -6213,7 +6256,7 @@ function addRecordedClip(host, trackId, buf, startSample, durSamples, offsetSamp
6213
6256
  ...current,
6214
6257
  clips: [
6215
6258
  ...current.clips.flatMap(
6216
- (c) => (0, import_core12.isLoadingClip)(c) ? [c] : (0, import_core12.carveClipRange)([c], startSample, startSample + durSamples)
6259
+ (c) => (0, import_core13.isLoadingClip)(c) ? [c] : (0, import_core13.carveClipRange)([c], startSample, startSample + durSamples)
6217
6260
  ),
6218
6261
  clip
6219
6262
  ]
@@ -6413,7 +6456,7 @@ function findAudioBufferForClip(host, clip, track) {
6413
6456
  }
6414
6457
 
6415
6458
  // src/interactions/track-entry.ts
6416
- var import_core13 = require("@waveform-playlist/core");
6459
+ var import_core14 = require("@waveform-playlist/core");
6417
6460
  function validMidiNotes(notes) {
6418
6461
  return notes.filter((n) => {
6419
6462
  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 +6493,7 @@ function buildMidiClip(clipDesc, sampleRate) {
6450
6493
  Math.max(noteSpanSeconds, clipDesc.duration, 1) * sampleRate
6451
6494
  );
6452
6495
  const requestedDurationSamples = clipDesc.duration > 0 ? Math.round(clipDesc.duration * sampleRate) : sourceDurationSamples;
6453
- const clip = (0, import_core13.createClip)({
6496
+ const clip = (0, import_core14.createClip)({
6454
6497
  startSample: Math.round(clipDesc.start * sampleRate),
6455
6498
  durationSamples: requestedDurationSamples,
6456
6499
  offsetSamples: Math.round(clipDesc.offset * sampleRate),
@@ -6496,7 +6539,12 @@ function buildArrangementTrack(trackId, descriptor, mix, sampleRate) {
6496
6539
  else clips.push(isMidi ? buildMidiClip(identified, sampleRate) : buildLoadingClip(identified));
6497
6540
  return identified;
6498
6541
  });
6499
- const base = (0, import_core13.createTrack)({ name: descriptor.name, kind: descriptor.kind, clips: [], ...mix });
6542
+ const { panLaw, ...fields } = mix;
6543
+ const base = {
6544
+ ...(0, import_core14.createTrack)({ name: descriptor.name, kind: descriptor.kind, clips: [], ...fields }),
6545
+ // The law the track enters with (#684); 'auto' is the arrangement's default.
6546
+ ...(0, import_core14.isDecidedPanLaw)(panLaw) && { panLaw }
6547
+ };
6500
6548
  const track = { ...base, id: trackId, clips };
6501
6549
  return { track, descriptor: changed ? { ...descriptor, clips: descClips } : descriptor, refused };
6502
6550
  }
@@ -6510,7 +6558,7 @@ function entryIndex(trackEls, trackId, arrangementIds) {
6510
6558
  }
6511
6559
 
6512
6560
  // src/interactions/load-announcer.ts
6513
- var import_core14 = require("@waveform-playlist/core");
6561
+ var import_core15 = require("@waveform-playlist/core");
6514
6562
  var LoadAnnouncer = class {
6515
6563
  constructor(_dispatch) {
6516
6564
  this._dispatch = _dispatch;
@@ -6564,7 +6612,7 @@ var LoadAnnouncer = class {
6564
6612
  let loaded = 0;
6565
6613
  let firstError = null;
6566
6614
  for (const clip of track.clips) {
6567
- if (!(0, import_core14.isLoadingClip)(clip)) {
6615
+ if (!(0, import_core15.isLoadingClip)(clip)) {
6568
6616
  loaded++;
6569
6617
  if (this._loadingClips.delete(clip.id)) {
6570
6618
  this._clipErrors.delete(clip.id);
@@ -6612,21 +6660,23 @@ var LoadAnnouncer = class {
6612
6660
  };
6613
6661
 
6614
6662
  // src/interactions/arrangement-view.ts
6615
- var import_core15 = require("@waveform-playlist/core");
6663
+ var import_core16 = require("@waveform-playlist/core");
6616
6664
  var views = /* @__PURE__ */ new WeakMap();
6617
6665
  function sameMix(a, b) {
6618
- return a.volume === b.volume && a.pan === b.pan && a.muted === b.muted && a.soloed === b.soloed;
6666
+ return a.volume === b.volume && a.pan === b.pan && a.muted === b.muted && a.soloed === b.soloed && a.panLaw === b.panLaw;
6619
6667
  }
6620
6668
  function loadedTrack(track, mix, recording) {
6621
6669
  const cached = views.get(track);
6622
6670
  if (cached && cached.recording === recording && sameMix(cached.mix, mix)) return cached.view;
6623
6671
  const view = {
6624
6672
  ...track,
6625
- clips: track.clips.filter((c) => !(0, import_core15.isLoadingClip)(c)),
6673
+ clips: track.clips.filter((c) => !(0, import_core16.isLoadingClip)(c)),
6626
6674
  volume: mix.volume,
6627
6675
  pan: mix.pan,
6628
6676
  muted: mix.muted || recording,
6629
- soloed: mix.soloed
6677
+ soloed: mix.soloed,
6678
+ // What both exports pan the track with (core's trackPanLaw, #684).
6679
+ panLaw: mix.panLaw
6630
6680
  };
6631
6681
  views.set(track, { mix: { ...mix }, recording, view });
6632
6682
  return view;
@@ -6637,7 +6687,7 @@ function mixOf(arrangement, trackId) {
6637
6687
  return arrangement.recordingTrackIds.has(trackId) ? { ...mix, muted: true } : mix;
6638
6688
  }
6639
6689
  function clipSeconds(clip, fallbackSampleRate) {
6640
- if ((0, import_core15.isLoadingClip)(clip)) {
6690
+ if ((0, import_core16.isLoadingClip)(clip)) {
6641
6691
  return { start: clip.start ?? 0, duration: clip.duration ?? 0, offset: clip.offset ?? 0 };
6642
6692
  }
6643
6693
  const sr = clip.sampleRate ?? fallbackSampleRate;
@@ -6678,10 +6728,10 @@ function swapArrangement(host, next) {
6678
6728
  }
6679
6729
 
6680
6730
  // src/interactions/drag-watch.ts
6681
- var import_core16 = require("@waveform-playlist/core");
6731
+ var import_core17 = require("@waveform-playlist/core");
6682
6732
  function clipDragChanged(arrangement, drag) {
6683
6733
  const clip = arrangement.getTracks().find((t) => t.id === drag.trackId)?.clips.find((c) => c.id === drag.clipId);
6684
- if (!clip || (0, import_core16.isLoadingClip)(clip)) return true;
6734
+ if (!clip || (0, import_core17.isLoadingClip)(clip)) return true;
6685
6735
  return clip.startSample !== drag.startSample || clip.durationSamples !== drag.durationSamples || clip.offsetSamples !== drag.offsetSamples;
6686
6736
  }
6687
6737
  function trackDragChanged(arrangement, drag) {
@@ -6931,10 +6981,10 @@ function loadFaustModule(feature) {
6931
6981
  }
6932
6982
 
6933
6983
  // src/effects/effects-manager.ts
6934
- var import_core18 = require("@waveform-playlist/core");
6984
+ var import_core19 = require("@waveform-playlist/core");
6935
6985
 
6936
6986
  // src/effects/effect-registry.ts
6937
- var import_core17 = require("@waveform-playlist/core");
6987
+ var import_core18 = require("@waveform-playlist/core");
6938
6988
  var MAX_DELAY_SECONDS = 10;
6939
6989
  function singleNode(node, applyParams) {
6940
6990
  return { input: node, output: node, applyParams };
@@ -7010,8 +7060,8 @@ function biquadDefinition(spec) {
7010
7060
  };
7011
7061
  }
7012
7062
  function registerBuiltIn(type, definition) {
7013
- if (!(0, import_core17.getEffectDefinitions)().has(type)) {
7014
- (0, import_core17.registerEffect)(type, { ...definition, builtIn: true });
7063
+ if (!(0, import_core18.getEffectDefinitions)().has(type)) {
7064
+ (0, import_core18.registerEffect)(type, { ...definition, builtIn: true });
7015
7065
  }
7016
7066
  }
7017
7067
  function registerBuiltIns() {
@@ -7166,7 +7216,7 @@ var EffectsManager = class {
7166
7216
  /** Run a registered effect's async `prepare` hook on the adapter's
7167
7217
  * context, so the synchronous addEffect() can create it. */
7168
7218
  async prepareEffect(type) {
7169
- await (0, import_core18.prepareEffect)(type, this._requireWiring().audioContext);
7219
+ await (0, import_core19.prepareEffect)(type, this._requireWiring().audioContext);
7170
7220
  }
7171
7221
  // --- Track chains ---
7172
7222
  addTrackEffect(trackId, target, type, params) {
@@ -7371,7 +7421,7 @@ var EffectsManager = class {
7371
7421
  this._runOp(chain, target, "setParams", effectId, { [paramId]: value });
7372
7422
  };
7373
7423
  if (entry.kind === "native") {
7374
- const definition = (0, import_core18.getEffectDefinitions)().get(entry.type);
7424
+ const definition = (0, import_core19.getEffectDefinitions)().get(entry.type);
7375
7425
  if (!definition) {
7376
7426
  throw new Error(
7377
7427
  PREFIX2 + 'openEffectGui: no registry definition for effect type "' + entry.type + '"'
@@ -7430,7 +7480,7 @@ var EffectsManager = class {
7430
7480
  }
7431
7481
  _addToChain(chain, target, type, params) {
7432
7482
  const audioContext = this._requireWiring().audioContext;
7433
- const created = (0, import_core18.createEffectInstance)(type, audioContext, params);
7483
+ const created = (0, import_core19.createEffectInstance)(type, audioContext, params);
7434
7484
  const effectId = chain.add({
7435
7485
  kind: "native",
7436
7486
  type,
@@ -7602,8 +7652,8 @@ var EffectsManager = class {
7602
7652
  if (entry.kind === "native") {
7603
7653
  try {
7604
7654
  const liveContext = this._requireWiring().audioContext;
7605
- if ((0, import_core18.needsPrepare)(entry.type, liveContext)) {
7606
- await (0, import_core18.ensureEffectPrepared)(entry.type, liveContext);
7655
+ if ((0, import_core19.needsPrepare)(entry.type, liveContext)) {
7656
+ await (0, import_core19.ensureEffectPrepared)(entry.type, liveContext);
7607
7657
  if (superseded() || chain.disposed) return;
7608
7658
  }
7609
7659
  const id = this._addToChain(chain, target, entry.type, entry.params);
@@ -7778,8 +7828,8 @@ function toWamParameterMap(params) {
7778
7828
  }
7779
7829
 
7780
7830
  // src/interactions/export-audio.ts
7781
- var import_core19 = require("@waveform-playlist/core");
7782
7831
  var import_core20 = require("@waveform-playlist/core");
7832
+ var import_core21 = require("@waveform-playlist/core");
7783
7833
  var PREFIX3 = "[waveform-playlist] ";
7784
7834
  async function exportAudioImpl(host, options = {}) {
7785
7835
  const sampleRate = options.sampleRate ?? host.effectiveSampleRate;
@@ -7814,7 +7864,7 @@ async function exportAudioImpl(host, options = {}) {
7814
7864
  cleanups.push(chain.dispose);
7815
7865
  const volume = ctx.createGain();
7816
7866
  volume.gain.value = track.volume;
7817
- const panStage = (0, import_core19.createPanStage)(ctx, track.pan, (0, import_core19.trackChannelCount)(track));
7867
+ const panStage = (0, import_core20.createPanStage)(ctx, track.pan, (0, import_core20.trackPanLaw)(track));
7818
7868
  cleanups.push(panStage.dispose);
7819
7869
  chain.output.connect(volume);
7820
7870
  volume.connect(panStage.input);
@@ -7896,12 +7946,12 @@ async function buildOfflineChain(ctx, entries) {
7896
7946
  continue;
7897
7947
  }
7898
7948
  if (entry.kind === "native") {
7899
- const definition = (0, import_core20.getEffectDefinitions)().get(entry.type);
7949
+ const definition = (0, import_core21.getEffectDefinitions)().get(entry.type);
7900
7950
  if (entry.bypassed && definition && !definition.wetParam) {
7901
7951
  continue;
7902
7952
  }
7903
- await (0, import_core20.ensureEffectPrepared)(entry.type, ctx);
7904
- const created = (0, import_core20.createEffectInstance)(entry.type, ctx, entry.params);
7953
+ await (0, import_core21.ensureEffectPrepared)(entry.type, ctx);
7954
+ const created = (0, import_core21.createEffectInstance)(entry.type, ctx, entry.params);
7905
7955
  if (entry.bypassed && created.wetParam) {
7906
7956
  created.instance.applyParams({ [created.wetParam]: 0 });
7907
7957
  }
@@ -9103,7 +9153,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
9103
9153
  _loadedClip(trackId, clipId) {
9104
9154
  const track = this._arrangement.getTracks().find((t) => t.id === trackId);
9105
9155
  const clip = track?.clips.find((c) => c.id === clipId);
9106
- return clip && !(0, import_core21.isLoadingClip)(clip) ? clip : void 0;
9156
+ return clip && !(0, import_core22.isLoadingClip)(clip) ? clip : void 0;
9107
9157
  }
9108
9158
  get effectiveSampleRate() {
9109
9159
  return this.sampleRate;
@@ -9204,7 +9254,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
9204
9254
  const clips = track.clips.map((clip) => {
9205
9255
  const el = clipEls.get(clip.id);
9206
9256
  const times = clipSeconds(clip, sr);
9207
- const midi = (0, import_core21.isLoadingClip)(clip) ? null : clip;
9257
+ const midi = (0, import_core22.isLoadingClip)(clip) ? null : clip;
9208
9258
  const base = {
9209
9259
  src: typeof clip.src === "string" ? clip.src : "",
9210
9260
  peaksSrc: extras?.peaksSrc.get(clip.id) ?? this._takenPeaksSrc(clip.id) ?? "",
@@ -9224,7 +9274,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
9224
9274
  trackId: track.id,
9225
9275
  name: track.name ?? "",
9226
9276
  src: extras?.src ?? "",
9227
- kind: (0, import_core21.trackKind)(track),
9277
+ kind: (0, import_core22.trackKind)(track),
9228
9278
  renderMode: this._renderModeOf(track.id),
9229
9279
  spectrogramConfig: extras?.spectrogramConfig ?? null,
9230
9280
  clips,
@@ -9243,7 +9293,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
9243
9293
  _defaultExtras(trackId) {
9244
9294
  const track = this._arrangementOf(trackId).getTracks().find((t) => t.id === trackId);
9245
9295
  if (!track) return null;
9246
- const kind = (0, import_core21.trackKind)(track);
9296
+ const kind = (0, import_core22.trackKind)(track);
9247
9297
  return {
9248
9298
  kind,
9249
9299
  renderMode: trackDescriptorRenderMode(kind, "waveform"),
@@ -9256,7 +9306,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
9256
9306
  const extras = this._extras.get(trackId);
9257
9307
  if (extras) return extras.renderMode;
9258
9308
  const track = this._arrangement.getTracks().find((t) => t.id === trackId);
9259
- return trackDescriptorRenderMode(track ? (0, import_core21.trackKind)(track) : "audio", "waveform");
9309
+ return trackDescriptorRenderMode(track ? (0, import_core22.trackKind)(track) : "audio", "waveform");
9260
9310
  }
9261
9311
  /**
9262
9312
  * A track's mix, from its one owner, the arrangement (#843), as the engine
@@ -9298,7 +9348,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
9298
9348
  _clipValues(trackId, clipId) {
9299
9349
  const clip = this._arrangement.getTracks().find((t) => t.id === this._clipHolderId(trackId, clipId))?.clips.find((c) => c.id === clipId);
9300
9350
  if (!clip) return null;
9301
- const midi = (0, import_core21.isLoadingClip)(clip) ? null : clip;
9351
+ const midi = (0, import_core22.isLoadingClip)(clip) ? null : clip;
9302
9352
  return {
9303
9353
  ...clipSeconds(clip, this.effectiveSampleRate),
9304
9354
  gain: clip.gain ?? 1,
@@ -9317,7 +9367,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
9317
9367
  _taskGesture(trackId) {
9318
9368
  let id = this._taskGestures.get(trackId);
9319
9369
  if (!id) {
9320
- id = (0, import_core21.createMixerGesture)().id;
9370
+ id = (0, import_core22.createMixerGesture)().id;
9321
9371
  this._taskGestures.set(trackId, id);
9322
9372
  if (this._taskGestures.size === 1) queueMicrotask(() => this._taskGestures.clear());
9323
9373
  }
@@ -9343,7 +9393,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
9343
9393
  const movedIds = /* @__PURE__ */ new Set();
9344
9394
  const refused = [];
9345
9395
  const others = this._arrangement.getTracks().filter((t) => t.id !== trackId);
9346
- const kind = (0, import_core21.trackKind)(track);
9396
+ const kind = (0, import_core22.trackKind)(track);
9347
9397
  const clips = [];
9348
9398
  for (const clip of track.clips) {
9349
9399
  const holder = others.find((t) => t.clips.some((c) => c.id === clip.id));
@@ -9407,7 +9457,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
9407
9457
  /** @internal */
9408
9458
  _trackKind(trackId) {
9409
9459
  const track = this._arrangement.getTracks().find((t) => t.id === trackId);
9410
- return track ? (0, import_core21.trackKind)(track) : null;
9460
+ return track ? (0, import_core22.trackKind)(track) : null;
9411
9461
  }
9412
9462
  /** @internal */
9413
9463
  _trackIndex(trackId) {
@@ -9431,18 +9481,22 @@ var DawEditorElement = class extends import_lit19.LitElement {
9431
9481
  if (field === "volume") arrangement.setTrackVolume(trackId, value, options);
9432
9482
  else if (field === "pan") arrangement.setTrackPan(trackId, value, options);
9433
9483
  else if (field === "muted") arrangement.setTrackMute(trackId, value, options);
9434
- else arrangement.setTrackSolo(trackId, value, options);
9484
+ else if (field === "soloed") arrangement.setTrackSolo(trackId, value, options);
9485
+ else if (field === "panLaw" && (0, import_core22.isDecidedPanLaw)(value)) {
9486
+ arrangement.setTrackPanLaw(trackId, value, options);
9487
+ }
9435
9488
  }
9436
9489
  /**
9437
9490
  * Change the given mixer fields of a track as ONE undo step (#843): all
9438
9491
  * of them carry one fresh gesture id. A field left out is not sent.
9439
9492
  */
9440
- _writeMixFields(trackId, mix, gesture = (0, import_core21.createMixerGesture)().id) {
9493
+ _writeMixFields(trackId, mix, gesture = (0, import_core22.createMixerGesture)().id) {
9441
9494
  const options = { gesture };
9442
9495
  if (mix.volume !== void 0) this._writeMix(trackId, "volume", mix.volume, options);
9443
9496
  if (mix.pan !== void 0) this._writeMix(trackId, "pan", mix.pan, options);
9444
9497
  if (mix.muted !== void 0) this._writeMix(trackId, "muted", mix.muted, options);
9445
9498
  if (mix.soloed !== void 0) this._writeMix(trackId, "soloed", mix.soloed, options);
9499
+ if (mix.panLaw !== void 0) this._writeMix(trackId, "panLaw", mix.panLaw, options);
9446
9500
  }
9447
9501
  get selectedTrackId() {
9448
9502
  return this._selectedTrackId;
@@ -9944,7 +9998,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
9944
9998
  const loadedClip = this._loadedClip(trackId, clipId);
9945
9999
  if (!loadedClip) {
9946
10000
  const loading = t.clips.find((c) => c.id === clipId);
9947
- if (loading && (0, import_core21.isLoadingClip)(loading)) {
10001
+ if (loading && (0, import_core22.isLoadingClip)(loading)) {
9948
10002
  this._updateLoadingClip(trackId, loading, clipEl);
9949
10003
  return;
9950
10004
  }
@@ -9957,7 +10011,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
9957
10011
  const sr = oldClip.sampleRate ?? this.effectiveSampleRate;
9958
10012
  const isMidiNow = clipEl.midiNotes != null && !clipEl.src;
9959
10013
  const wasMidi = oldClip.midiNotes != null;
9960
- if (isMidiNow && (0, import_core21.trackKind)(t) !== "midi") {
10014
+ if (isMidiNow && (0, import_core22.trackKind)(t) !== "midi") {
9961
10015
  const kindError = clipKindError(t.name ?? "", "audio", true, clipEl.name || clipId);
9962
10016
  console.warn("[dawcore] _applyClipUpdate: " + kindError?.message);
9963
10017
  this.dispatchEvent(
@@ -10088,7 +10142,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
10088
10142
  this._previewPeaks = nextPreview;
10089
10143
  }
10090
10144
  this._forgetClip(trackId, clipId);
10091
- const wasLoading = track.clips.some((c) => c.id === clipId && (0, import_core21.isLoadingClip)(c));
10145
+ const wasLoading = track.clips.some((c) => c.id === clipId && (0, import_core22.isLoadingClip)(c));
10092
10146
  if (options.undoable === false) arrangement.removeClip(trackId, clipId, { undoable: false });
10093
10147
  else
10094
10148
  arrangement.updateTrack(trackId, (current) => ({
@@ -10263,7 +10317,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
10263
10317
  }
10264
10318
  this._announcer.expect(trackId, built.refused.length + moved.refused.length);
10265
10319
  for (const clip of entering.clips) {
10266
- if ((0, import_core21.isLoadingClip)(clip)) this._announcer.expectClip(clip.id);
10320
+ if ((0, import_core22.isLoadingClip)(clip)) this._announcer.expectClip(clip.id);
10267
10321
  }
10268
10322
  try {
10269
10323
  if (moved.from.size === 0) {
@@ -10347,7 +10401,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
10347
10401
  const waveformData = await this._resolvePeaks(peaksSrc);
10348
10402
  if (!waveformData) return;
10349
10403
  const clip = this._arrangement.getTracks().flatMap((t) => t.clips).find((c) => c.id === clipId);
10350
- if (!clip || !(0, import_core21.isLoadingClip)(clip)) return;
10404
+ if (!clip || !(0, import_core22.isLoadingClip)(clip)) return;
10351
10405
  const rate = waveformData.sample_rate;
10352
10406
  const offset = clip.offset ?? 0;
10353
10407
  const seconds = clip.duration ?? Math.max(0, waveformData.duration - offset);
@@ -10499,7 +10553,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
10499
10553
  }
10500
10554
  const sources = this._arrangement.sources.getSnapshot().sources;
10501
10555
  const failed = new Set(
10502
- track.clips.filter(import_core21.isLoadingClip).map((clip) => clip.src).filter((src) => sources.get(src)?.status === "failed")
10556
+ track.clips.filter(import_core22.isLoadingClip).map((clip) => clip.src).filter((src) => sources.get(src)?.status === "failed")
10503
10557
  );
10504
10558
  for (const src of failed) this._arrangement.retry(src);
10505
10559
  }
@@ -10529,7 +10583,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
10529
10583
  }
10530
10584
  for (const track of this._arrangement.getTracks()) {
10531
10585
  for (const clip of track.clips) {
10532
- if (!(0, import_core21.isLoadingClip)(clip)) continue;
10586
+ if (!(0, import_core22.isLoadingClip)(clip)) continue;
10533
10587
  const seconds = this._placeholderSeconds(clip);
10534
10588
  if (seconds === null) continue;
10535
10589
  maxSample = Math.max(maxSample, Math.round(((clip.start ?? 0) + seconds) * sr));
@@ -10663,7 +10717,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
10663
10717
  if (structuralChange) {
10664
10718
  this._recomputeDuration();
10665
10719
  this._effectsManager?.rewireTrackChains();
10666
- const audioTracks = engineState.tracks.filter((t) => (0, import_core21.trackKind)(t) !== "midi");
10720
+ const audioTracks = engineState.tracks.filter((t) => (0, import_core22.trackKind)(t) !== "midi");
10667
10721
  this._adoptLoadedClips(audioTracks);
10668
10722
  syncPeaksForChangedClips(this, audioTracks);
10669
10723
  this._announceLoading();
@@ -10772,7 +10826,8 @@ var DawEditorElement = class extends import_lit19.LitElement {
10772
10826
  volume: config.volume ?? DEFAULT_TRACK_MIX.volume,
10773
10827
  pan: config.pan ?? DEFAULT_TRACK_MIX.pan,
10774
10828
  muted: config.muted ?? false,
10775
- soloed: config.soloed ?? false
10829
+ soloed: config.soloed ?? false,
10830
+ panLaw: declaredPanLaw(config.panLaw)
10776
10831
  };
10777
10832
  this._pending = new Map(this._pending).set(trackId, { descriptor, mix });
10778
10833
  const entered = this._waitForEntry(trackId);
@@ -10861,7 +10916,8 @@ var DawEditorElement = class extends import_lit19.LitElement {
10861
10916
  volume: partial.volume,
10862
10917
  pan: partial.pan,
10863
10918
  muted: partial.muted,
10864
- soloed: partial.soloed
10919
+ soloed: partial.soloed,
10920
+ ...partial.panLaw !== void 0 && { panLaw: declaredPanLaw(partial.panLaw) }
10865
10921
  };
10866
10922
  this._writeMixFields(trackId, mix);
10867
10923
  if (partial.name !== void 0) this._renameTrack(trackId, partial.name);
@@ -10901,6 +10957,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
10901
10957
  if (partial.name !== void 0) el.name = partial.name;
10902
10958
  if (partial.volume !== void 0) el.volume = partial.volume;
10903
10959
  if (partial.pan !== void 0) el.pan = partial.pan;
10960
+ if (partial.panLaw !== void 0) el.panLaw = partial.panLaw;
10904
10961
  if (partial.muted !== void 0) el.muted = partial.muted;
10905
10962
  if (partial.soloed !== void 0) el.soloed = partial.soloed;
10906
10963
  if (partial.renderMode !== void 0) el.renderMode = partial.renderMode;
@@ -10926,7 +10983,8 @@ var DawEditorElement = class extends import_lit19.LitElement {
10926
10983
  volume: partial.volume ?? mix.volume,
10927
10984
  pan: partial.pan ?? mix.pan,
10928
10985
  muted: partial.muted ?? mix.muted,
10929
- soloed: partial.soloed ?? mix.soloed
10986
+ soloed: partial.soloed ?? mix.soloed,
10987
+ panLaw: partial.panLaw !== void 0 ? declaredPanLaw(partial.panLaw) : mix.panLaw
10930
10988
  }
10931
10989
  });
10932
10990
  }
@@ -11378,7 +11436,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
11378
11436
  }
11379
11437
  const targetId = options?.trackId ?? this._selectedTrackId;
11380
11438
  const target = targetId ? this._arrangement.getTracks().find((t) => t.id === targetId) : void 0;
11381
- if (targetId && target && (0, import_core21.trackKind)(target) === "midi") {
11439
+ if (targetId && target && (0, import_core22.trackKind)(target) === "midi") {
11382
11440
  const error = new Error(
11383
11441
  'Cannot record onto MIDI track "' + target.name + '": a recording is audio. Select or create an audio track first.'
11384
11442
  );
@@ -11518,7 +11576,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
11518
11576
  this._mixOf(track.id),
11519
11577
  this._arrangement.recordingTrackIds.has(track.id)
11520
11578
  );
11521
- rows.push([track.id, loaded, track.clips.filter(import_core21.isLoadingClip)]);
11579
+ rows.push([track.id, loaded, track.clips.filter(import_core22.isLoadingClip)]);
11522
11580
  }
11523
11581
  return rows;
11524
11582
  }
@@ -11541,7 +11599,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
11541
11599
  } else {
11542
11600
  const startSample = Math.round(startSec * sr);
11543
11601
  left = Math.floor(startSample / spp);
11544
- width = (0, import_core21.clipPixelWidth)(startSample, Math.round(seconds * sr), spp);
11602
+ width = (0, import_core22.clipPixelWidth)(startSample, Math.round(seconds * sr), spp);
11545
11603
  }
11546
11604
  const failed = this._arrangement.sources.getSnapshot().sources.get(clip.src)?.status === "failed";
11547
11605
  const peakData = this._previewPeaks.get(clip.id);
@@ -11589,7 +11647,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
11589
11647
  const orderedTracks = this._getOrderedTracks().map(([trackId, track, loading]) => {
11590
11648
  const descriptor = {
11591
11649
  name: track.name ?? "",
11592
- kind: (0, import_core21.trackKind)(track),
11650
+ kind: (0, import_core22.trackKind)(track),
11593
11651
  renderMode: this._renderModeOf(trackId)
11594
11652
  };
11595
11653
  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 +11775,7 @@ var DawEditorElement = class extends import_lit19.LitElement {
11717
11775
  width = Math.round(endTick / this.ticksPerPixel) - clipLeft;
11718
11776
  } else {
11719
11777
  clipLeft = Math.floor(clip.startSample / spp);
11720
- width = (0, import_core21.clipPixelWidth)(clip.startSample, clip.durationSamples, spp);
11778
+ width = (0, import_core22.clipPixelWidth)(clip.startSample, clip.durationSamples, spp);
11721
11779
  }
11722
11780
  let clipSegments;
11723
11781
  let segmentChannels;
@@ -12256,7 +12314,7 @@ DawRecordButtonElement = __decorateClass([
12256
12314
  // src/elements/daw-keyboard-shortcuts.ts
12257
12315
  var import_lit22 = require("lit");
12258
12316
  var import_decorators19 = require("lit/decorators.js");
12259
- var import_core22 = require("@waveform-playlist/core");
12317
+ var import_core23 = require("@waveform-playlist/core");
12260
12318
  var DawKeyboardShortcutsElement = class extends import_lit22.LitElement {
12261
12319
  constructor() {
12262
12320
  super(...arguments);
@@ -12284,7 +12342,7 @@ var DawKeyboardShortcutsElement = class extends import_lit22.LitElement {
12284
12342
  const shortcuts = this.shortcuts;
12285
12343
  if (shortcuts.length === 0) return;
12286
12344
  try {
12287
- (0, import_core22.handleKeyboardEvent)(e, shortcuts, true);
12345
+ (0, import_core23.handleKeyboardEvent)(e, shortcuts, true);
12288
12346
  } catch (err) {
12289
12347
  console.warn("[dawcore] Keyboard shortcut failed (key=" + e.key + "): " + String(err));
12290
12348
  const target = this._editor ?? this;
@@ -12477,7 +12535,7 @@ DawKeyboardShortcutsElement = __decorateClass([
12477
12535
  // src/elements/daw-spectrogram.ts
12478
12536
  var import_lit23 = require("lit");
12479
12537
  var import_decorators20 = require("lit/decorators.js");
12480
- var import_core23 = require("@waveform-playlist/core");
12538
+ var import_core24 = require("@waveform-playlist/core");
12481
12539
  var DawSpectrogramElement = class extends import_lit23.LitElement {
12482
12540
  constructor() {
12483
12541
  super(...arguments);
@@ -12542,11 +12600,11 @@ var DawSpectrogramElement = class extends import_lit23.LitElement {
12542
12600
  this._unregisterAllCanvases();
12543
12601
  this._canvases = [];
12544
12602
  if (this.length <= 0) return;
12545
- const chunkCount = Math.ceil(this.length / import_core23.MAX_CANVAS_WIDTH);
12603
+ const chunkCount = Math.ceil(this.length / import_core24.MAX_CANVAS_WIDTH);
12546
12604
  for (let i = 0; i < chunkCount; i++) {
12547
- const widthPx = Math.min(import_core23.MAX_CANVAS_WIDTH, this.length - i * import_core23.MAX_CANVAS_WIDTH);
12605
+ const widthPx = Math.min(import_core24.MAX_CANVAS_WIDTH, this.length - i * import_core24.MAX_CANVAS_WIDTH);
12548
12606
  const canvas = document.createElement("canvas");
12549
- canvas.style.left = i * import_core23.MAX_CANVAS_WIDTH + "px";
12607
+ canvas.style.left = i * import_core24.MAX_CANVAS_WIDTH + "px";
12550
12608
  canvas.style.width = widthPx + "px";
12551
12609
  const dpr = window.devicePixelRatio || 1;
12552
12610
  canvas.width = widthPx * dpr;
@@ -12572,7 +12630,7 @@ var DawSpectrogramElement = class extends import_lit23.LitElement {
12572
12630
  }
12573
12631
  for (let i = 0; i < this._canvases.length; i++) {
12574
12632
  const canvas = this._canvases[i];
12575
- const canvasId = (0, import_core23.buildSpectrogramCanvasId)({
12633
+ const canvasId = (0, import_core24.buildSpectrogramCanvasId)({
12576
12634
  clipId: this.clipId,
12577
12635
  channelIndex: this.channelIndex,
12578
12636
  chunkIndex: i
@@ -12593,7 +12651,7 @@ var DawSpectrogramElement = class extends import_lit23.LitElement {
12593
12651
  trackId: this.trackId,
12594
12652
  channelIndex: this.channelIndex,
12595
12653
  chunkIndex: i,
12596
- globalPixelOffset: this.originX + i * import_core23.MAX_CANVAS_WIDTH,
12654
+ globalPixelOffset: this.originX + i * import_core24.MAX_CANVAS_WIDTH,
12597
12655
  widthPx: parseFloat(canvas.style.width),
12598
12656
  heightPx: this.waveHeight
12599
12657
  });