spessasynth_core 4.0.13 → 4.0.14
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 +19 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3280,11 +3280,17 @@ var BasicMIDI2 = class _BasicMIDI {
|
|
|
3280
3280
|
// Cc change: loop points
|
|
3281
3281
|
case midiMessageTypes.controllerChange:
|
|
3282
3282
|
switch (e.data[0]) {
|
|
3283
|
+
// Touhou
|
|
3283
3284
|
case 2:
|
|
3285
|
+
// RPG Maker
|
|
3286
|
+
case 111:
|
|
3287
|
+
// EMIDI/XMI
|
|
3284
3288
|
case 116:
|
|
3285
3289
|
loopStart = e.ticks;
|
|
3286
3290
|
break;
|
|
3291
|
+
// Touhou
|
|
3287
3292
|
case 4:
|
|
3293
|
+
// EMIDI/XMI
|
|
3288
3294
|
case 117:
|
|
3289
3295
|
if (loopEnd === null) {
|
|
3290
3296
|
loopEnd = e.ticks;
|
|
@@ -3425,14 +3431,9 @@ var BasicMIDI2 = class _BasicMIDI {
|
|
|
3425
3431
|
consoleColors.recognized,
|
|
3426
3432
|
consoleColors.info
|
|
3427
3433
|
);
|
|
3428
|
-
|
|
3429
|
-
|
|
3434
|
+
loopStart ??= this.firstNoteOn;
|
|
3435
|
+
if (loopEnd === null || loopEnd === 0) {
|
|
3430
3436
|
loopEnd = this.lastVoiceEventTick;
|
|
3431
|
-
} else {
|
|
3432
|
-
loopStart ??= this.firstNoteOn;
|
|
3433
|
-
if (loopEnd === null || loopEnd === 0) {
|
|
3434
|
-
loopEnd = this.lastVoiceEventTick;
|
|
3435
|
-
}
|
|
3436
3437
|
}
|
|
3437
3438
|
this.loop = { start: loopStart, end: loopEnd };
|
|
3438
3439
|
SpessaSynthInfo(
|
|
@@ -3532,9 +3533,6 @@ var BasicMIDI2 = class _BasicMIDI {
|
|
|
3532
3533
|
);
|
|
3533
3534
|
}
|
|
3534
3535
|
this.duration = this.midiTicksToSeconds(this.lastVoiceEventTick);
|
|
3535
|
-
if (this.duration === 0) {
|
|
3536
|
-
throw new Error("The MIDI file no duration.");
|
|
3537
|
-
}
|
|
3538
3536
|
if (this.binaryName && this.binaryName.length < 1) {
|
|
3539
3537
|
this.binaryName = void 0;
|
|
3540
3538
|
}
|
|
@@ -3940,6 +3938,11 @@ function loadNewSequenceInternal(parsedMidi) {
|
|
|
3940
3938
|
if (!parsedMidi.tracks) {
|
|
3941
3939
|
throw new Error("This MIDI has no tracks!");
|
|
3942
3940
|
}
|
|
3941
|
+
if (parsedMidi.duration === 0) {
|
|
3942
|
+
SpessaSynthWarn("This MIDI file has a duration of exactly 0 seconds.");
|
|
3943
|
+
this.pausedTime = 0;
|
|
3944
|
+
return;
|
|
3945
|
+
}
|
|
3943
3946
|
this.oneTickToSeconds = 60 / (120 * parsedMidi.timeDivision);
|
|
3944
3947
|
this._midiData = parsedMidi;
|
|
3945
3948
|
this.synth.clearEmbeddedBank();
|
|
@@ -5099,9 +5102,9 @@ var SpessaSynthSequencer = class {
|
|
|
5099
5102
|
* @param value the playback rate to set.
|
|
5100
5103
|
*/
|
|
5101
5104
|
set playbackRate(value) {
|
|
5102
|
-
const
|
|
5105
|
+
const t = this.currentTime;
|
|
5103
5106
|
this._playbackRate = value;
|
|
5104
|
-
this.
|
|
5107
|
+
this.recalculateStartTime(t);
|
|
5105
5108
|
}
|
|
5106
5109
|
/**
|
|
5107
5110
|
* The current time of the sequencer.
|
|
@@ -5137,11 +5140,6 @@ var SpessaSynthSequencer = class {
|
|
|
5137
5140
|
} else {
|
|
5138
5141
|
this.playingNotes = [];
|
|
5139
5142
|
this.callEvent("timeChange", { newTime: time });
|
|
5140
|
-
if (this._midiData.duration === 0) {
|
|
5141
|
-
SpessaSynthWarn("No duration!");
|
|
5142
|
-
this.callEvent("pause", { isFinished: true });
|
|
5143
|
-
return;
|
|
5144
|
-
}
|
|
5145
5143
|
this.setTimeTo(time);
|
|
5146
5144
|
this.recalculateStartTime(time);
|
|
5147
5145
|
}
|
|
@@ -5158,7 +5156,10 @@ var SpessaSynthSequencer = class {
|
|
|
5158
5156
|
*/
|
|
5159
5157
|
play() {
|
|
5160
5158
|
if (!this._midiData) {
|
|
5161
|
-
|
|
5159
|
+
SpessaSynthWarn(
|
|
5160
|
+
"No songs loaded in the sequencer. Ignoring the play call."
|
|
5161
|
+
);
|
|
5162
|
+
return;
|
|
5162
5163
|
}
|
|
5163
5164
|
if (this.currentTime >= this._midiData.duration) {
|
|
5164
5165
|
this.currentTime = 0;
|