alphatheta-connect 0.26.0 → 0.26.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.
package/lib/index.js CHANGED
@@ -1356,7 +1356,9 @@ async function viaLocal(local, opts) {
1356
1356
  if (!orm) {
1357
1357
  break;
1358
1358
  }
1359
- yield orm.findTrack(entry.id);
1359
+ // Playlist entries reference the track through trackId; entry.id is the
1360
+ // entry's own row id (or its index, for OneLibrary), not a track.
1361
+ yield orm.findTrack(entry.trackId);
1360
1362
  }
1361
1363
  };
1362
1364
  const tracks = { [Symbol.asyncIterator]: iterateTracks };
@@ -3255,7 +3257,9 @@ var RekordboxAnlz = (function() {
3255
3257
  this.time = this._io.readU4be();
3256
3258
  this.loopTime = this._io.readU4be();
3257
3259
  this.colorId = this._io.readU1();
3258
- this._unnamed9 = this._io.readBytes(11);
3260
+ this._unnamed9 = this._io.readBytes(7);
3261
+ this.loopNumerator = this._io.readU2be();
3262
+ this.loopDenominator = this._io.readU2be();
3259
3263
  if (this.lenEntry > 43) {
3260
3264
  this.lenComment = this._io.readU4be();
3261
3265
  }
@@ -3275,7 +3279,7 @@ var RekordboxAnlz = (function() {
3275
3279
  this.colorBlue = this._io.readU1();
3276
3280
  }
3277
3281
  if ((this.lenEntry - this.lenComment) > 48) {
3278
- this._unnamed16 = this._io.readBytes(((this.lenEntry - 48) - this.lenComment));
3282
+ this._unnamed18 = this._io.readBytes(((this.lenEntry - 48) - this.lenComment));
3279
3283
  }
3280
3284
  }
3281
3285
 
@@ -3307,6 +3311,16 @@ var RekordboxAnlz = (function() {
3307
3311
  * and has been assigned a color.
3308
3312
  */
3309
3313
 
3314
+ /**
3315
+ * The numerator of the loop size fraction for a quantized loop,
3316
+ * e.g. 4 for a 4-beat loop. Zero when the loop is not quantized.
3317
+ */
3318
+
3319
+ /**
3320
+ * The denominator of the loop size fraction for a quantized loop,
3321
+ * e.g. 1 for a 4-beat loop.
3322
+ */
3323
+
3310
3324
  /**
3311
3325
  * The comment assigned to this cue by the DJ, if any, with a trailing NUL.
3312
3326
  */
@@ -5760,16 +5774,20 @@ function makeBeatGrid(data) {
5760
5774
  * Fill cue and loop data from the ANLZ section
5761
5775
  */
5762
5776
  function makeCueAndLoop(data) {
5763
- return data.body.cues.map((entry) => {
5777
+ return data.body.cues
5778
+ .map((entry) => {
5764
5779
  // Cues with the status 0 are likely leftovers that were removed
5765
- const button = entry.hotCue === 0 ? false : entry.type;
5780
+ // `hotCue` is the button number (1-8, A-H); zero marks a memory cue.
5781
+ // `type` only says whether the entry is a cue point (1) or a loop (2).
5782
+ const button = entry.hotCue === 0 ? false : entry.hotCue;
5766
5783
  const isCue = entry.type === 0x01;
5767
5784
  const isLoop = entry.type === 0x02;
5768
5785
  // NOTE: Unlike the remotedb, these entries are already in milliseconds.
5769
5786
  const offset = entry.time;
5770
5787
  const length = entry.loopTime - offset;
5771
5788
  return (0, utils_1.makeCueLoopEntry)(isCue, isLoop, offset, length, button);
5772
- });
5789
+ })
5790
+ .filter((c) => c !== null);
5773
5791
  }
5774
5792
  /**
5775
5793
  * Fill waveform HD data from the ANLZ section
@@ -5805,9 +5823,13 @@ function makeExtendedCues(data) {
5805
5823
  b: (_c = entry.colorBlue) !== null && _c !== void 0 ? _c : 0,
5806
5824
  };
5807
5825
  }
5808
- // Add comment if present
5826
+ // Add comment if present. The tag stores it with a trailing NUL, which
5827
+ // is not part of what the DJ typed.
5809
5828
  if (entry.lenComment > 0 && entry.comment) {
5810
- cue.comment = entry.comment;
5829
+ const comment = entry.comment.replace(/\0+$/, '');
5830
+ if (comment.length > 0) {
5831
+ cue.comment = comment;
5832
+ }
5811
5833
  }
5812
5834
  // Add quantized loop information if present
5813
5835
  if (entry.loopNumerator !== undefined && entry.loopNumerator > 0) {
@@ -5873,19 +5895,24 @@ function makeSongStructure(data) {
5873
5895
  },
5874
5896
  };
5875
5897
  const mood = (_a = moodMap[data.body.mood]) !== null && _a !== void 0 ? _a : 'high';
5876
- const bank = (_b = bankMap[data.body.rawBank]) !== null && _b !== void 0 ? _b : 'default';
5898
+ const bank = (_b = bankMap[data.body.bank]) !== null && _b !== void 0 ? _b : 'default';
5899
+ // Field names follow the Kaitai-generated object (rekordbox_anlz.ksy
5900
+ // `song_structure_entry`): `phraseNumber`, `beatNumber`, `fillIn`,
5901
+ // `fillInBeatNumber`, and `kind` is a `phrase_high` / `phrase_mid` /
5902
+ // `phrase_low` object whose `id` carries the raw kind value.
5877
5903
  const phrases = data.body.entries.map((entry) => {
5878
5904
  var _a;
5905
+ const kind = typeof entry.kind === 'object' ? entry.kind.id : entry.kind;
5879
5906
  const phrase = {
5880
- index: entry.index,
5881
- beat: entry.beat,
5882
- kind: entry.kind,
5883
- phraseType: (_a = phraseTypeMap[mood][entry.kind]) !== null && _a !== void 0 ? _a : 'Unknown',
5907
+ index: entry.phraseNumber,
5908
+ beat: entry.beatNumber,
5909
+ kind,
5910
+ phraseType: (_a = phraseTypeMap[mood][kind]) !== null && _a !== void 0 ? _a : 'Unknown',
5884
5911
  };
5885
5912
  // Add fill-in information if present
5886
- if (entry.fill > 0) {
5887
- phrase.fill = entry.fill;
5888
- phrase.fillBeat = entry.beatFill;
5913
+ if (entry.fillIn > 0) {
5914
+ phrase.fill = entry.fillIn;
5915
+ phrase.fillBeat = entry.fillInBeatNumber;
5889
5916
  }
5890
5917
  return phrase;
5891
5918
  });