audio-mixer-ui 1.0.3 → 1.1.1

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.
@@ -2758,7 +2758,7 @@ class fU {
2758
2758
  }
2759
2759
  /**
2760
2760
  * Generate bar order from legacy bars array format
2761
- * @param {Array} bars - Legacy bars array with from/beats/repeat fields
2761
+ * @param {Array} bars - Legacy bars array with from/to/beats/repeat fields
2762
2762
  * @param {Array} midiBarStructure - MIDI bar structure for calculating bar counts
2763
2763
  * @returns {Array} Bar order with bar numbers and repeat counts
2764
2764
  */
@@ -2768,24 +2768,43 @@ class fU {
2768
2768
  for (const Q of l) {
2769
2769
  Q.from !== void 0 && (t = Q.from === -1 ? 0 : Q.from, Z = 0), Q.timeSig !== void 0 && (a = Q.timeSig);
2770
2770
  const n = Q.repeat || 1;
2771
- let V = Q.beats;
2772
- for (; V > 0; ) {
2773
- const R = (a !== void 0 ? a : this._getBeatsPerBar(t, U)) - Z;
2774
- V >= R ? (F.push({
2771
+ let V = 0;
2772
+ if (Q.to !== void 0)
2773
+ if (Z > 0) {
2774
+ const e = a !== void 0 ? a : this._getBeatsPerBar(t, U);
2775
+ V += e - Z;
2776
+ for (let m = t + 1; m <= Q.to; m++) {
2777
+ const W = a !== void 0 ? a : this._getBeatsPerBar(m, U);
2778
+ V += W;
2779
+ }
2780
+ } else
2781
+ for (let e = t; e <= Q.to; e++) {
2782
+ const m = a !== void 0 ? a : this._getBeatsPerBar(e, U);
2783
+ V += m;
2784
+ }
2785
+ if (Q.beats !== void 0 && (V += Q.beats), V === 0 && Q.to === void 0 && Q.beats === void 0)
2786
+ throw new Error(`Bar entry must specify either 'to' or 'beats': ${JSON.stringify(Q)}`);
2787
+ let R = V;
2788
+ for (; R > 0; ) {
2789
+ const e = (a !== void 0 ? a : this._getBeatsPerBar(t, U)) - Z;
2790
+ R >= e ? (F.push({
2775
2791
  barNumber: t,
2776
2792
  repeat: n,
2777
2793
  sectionIndex: 0,
2778
2794
  // Legacy format doesn't have sections
2779
2795
  voltaTime: 1
2780
2796
  // Legacy format doesn't have voltas
2781
- }), V -= R, Z = 0, t === 0 ? t = 1 : t++) : (Z += V, V = 0);
2797
+ }), R -= e, Z = 0, t === 0 ? t = 1 : t++) : (Z += R, R = 0);
2782
2798
  }
2783
2799
  }
2784
2800
  return Z > 0 && F.push({
2785
2801
  barNumber: t,
2786
2802
  repeat: 1,
2803
+ // Partial bars at the end default to repeat 1
2787
2804
  sectionIndex: 0,
2788
- voltaTime: 1
2805
+ voltaTime: 1,
2806
+ partialBeats: Z
2807
+ // Track partial bar beat count
2789
2808
  }), F;
2790
2809
  }
2791
2810
  /**
@@ -2831,13 +2850,18 @@ class fU {
2831
2850
  const Q = [...U];
2832
2851
  for (; a < l.length && Z < Q.length; ) {
2833
2852
  const n = l[a], V = n.barNumber;
2834
- if (t[V] === void 0) {
2835
- const W = Q[Z];
2836
- if (!W || !W.sig)
2837
- throw new Error(`Invalid MIDI bar structure at index ${Z}`);
2838
- t[V] = W.sig[0];
2853
+ let R;
2854
+ if (n.partialBeats !== void 0)
2855
+ R = n.partialBeats;
2856
+ else {
2857
+ if (t[V] === void 0) {
2858
+ const W = Q[Z];
2859
+ if (!W || !W.sig)
2860
+ throw new Error(`Invalid MIDI bar structure at index ${Z}`);
2861
+ t[V] = W.sig[0];
2862
+ }
2863
+ R = t[V];
2839
2864
  }
2840
- const R = t[V];
2841
2865
  let e = Q[Z], m = e.sig[0];
2842
2866
  for (; m < R && Z + 1 < Q.length; ) {
2843
2867
  const W = Q[Z + 1], c = [