spessasynth_core 4.0.15 → 4.0.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/dist/index.d.ts +14 -0
- package/dist/index.js +40 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3743,6 +3743,7 @@ interface SequencerEventData {
|
|
|
3743
3743
|
};
|
|
3744
3744
|
/**
|
|
3745
3745
|
* Called when the playback stops.
|
|
3746
|
+
* @deprecated use songEnded instead.
|
|
3746
3747
|
*/
|
|
3747
3748
|
pause: {
|
|
3748
3749
|
/**
|
|
@@ -3750,6 +3751,10 @@ interface SequencerEventData {
|
|
|
3750
3751
|
*/
|
|
3751
3752
|
isFinished: boolean;
|
|
3752
3753
|
};
|
|
3754
|
+
/**
|
|
3755
|
+
* Called when the playback stops.
|
|
3756
|
+
*/
|
|
3757
|
+
songEnded: object;
|
|
3753
3758
|
/**
|
|
3754
3759
|
* Called when the song changes.
|
|
3755
3760
|
*/
|
|
@@ -3828,6 +3833,15 @@ declare class SpessaSynthSequencer {
|
|
|
3828
3833
|
* Defaults to true.
|
|
3829
3834
|
*/
|
|
3830
3835
|
skipToFirstNoteOn: boolean;
|
|
3836
|
+
/**
|
|
3837
|
+
* Indicates if the sequencer has finished playing.
|
|
3838
|
+
*/
|
|
3839
|
+
isFinished: boolean;
|
|
3840
|
+
/**
|
|
3841
|
+
* Indicates if the synthesizer should preload the voices for the newly loaded sequence.
|
|
3842
|
+
* Recommended.
|
|
3843
|
+
*/
|
|
3844
|
+
preload: boolean;
|
|
3831
3845
|
/**
|
|
3832
3846
|
* Called when the sequencer calls an event.
|
|
3833
3847
|
* @param event The event
|
package/dist/index.js
CHANGED
|
@@ -3942,10 +3942,12 @@ function loadNewSequenceInternal(parsedMidi) {
|
|
|
3942
3942
|
if (parsedMidi.duration === 0) {
|
|
3943
3943
|
SpessaSynthWarn("This MIDI file has a duration of exactly 0 seconds.");
|
|
3944
3944
|
this.pausedTime = 0;
|
|
3945
|
+
this.isFinished = true;
|
|
3945
3946
|
return;
|
|
3946
3947
|
}
|
|
3947
3948
|
this.oneTickToSeconds = 60 / (120 * parsedMidi.timeDivision);
|
|
3948
3949
|
this._midiData = parsedMidi;
|
|
3950
|
+
this.isFinished = false;
|
|
3949
3951
|
this.synth.clearEmbeddedBank();
|
|
3950
3952
|
if (this._midiData.embeddedSoundBank !== void 0) {
|
|
3951
3953
|
SpessaSynthInfo(
|
|
@@ -3957,23 +3959,33 @@ function loadNewSequenceInternal(parsedMidi) {
|
|
|
3957
3959
|
this._midiData.bankOffset
|
|
3958
3960
|
);
|
|
3959
3961
|
}
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
);
|
|
3964
|
-
used.forEach((combos, preset) => {
|
|
3965
|
-
SpessaSynthInfo(
|
|
3966
|
-
`%cPreloading used samples on %c${preset.name}%c...`,
|
|
3967
|
-
consoleColors.info,
|
|
3968
|
-
consoleColors.recognized,
|
|
3962
|
+
if (this.preload) {
|
|
3963
|
+
SpessaSynthGroupCollapsed(
|
|
3964
|
+
"%cPreloading samples...",
|
|
3969
3965
|
consoleColors.info
|
|
3970
3966
|
);
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3967
|
+
const used = this._midiData.getUsedProgramsAndKeys(
|
|
3968
|
+
this.synth.soundBankManager
|
|
3969
|
+
);
|
|
3970
|
+
used.forEach((combos, preset) => {
|
|
3971
|
+
SpessaSynthInfo(
|
|
3972
|
+
`%cPreloading used samples on %c${preset.name}%c...`,
|
|
3973
|
+
consoleColors.info,
|
|
3974
|
+
consoleColors.recognized,
|
|
3975
|
+
consoleColors.info
|
|
3976
|
+
);
|
|
3977
|
+
for (const combo of combos) {
|
|
3978
|
+
const [midiNote, velocity] = combo.split("-").map(Number);
|
|
3979
|
+
this.synth.getVoicesForPreset(
|
|
3980
|
+
preset,
|
|
3981
|
+
midiNote,
|
|
3982
|
+
velocity,
|
|
3983
|
+
midiNote
|
|
3984
|
+
);
|
|
3985
|
+
}
|
|
3986
|
+
});
|
|
3987
|
+
SpessaSynthGroupEnd();
|
|
3988
|
+
}
|
|
3977
3989
|
this.currentMIDIPorts = this._midiData.tracks.map((t) => t.port);
|
|
3978
3990
|
this.midiPortChannelOffset = 0;
|
|
3979
3991
|
this.midiPortChannelOffsets = {};
|
|
@@ -4957,6 +4969,15 @@ var SpessaSynthSequencer = class {
|
|
|
4957
4969
|
* Defaults to true.
|
|
4958
4970
|
*/
|
|
4959
4971
|
skipToFirstNoteOn = true;
|
|
4972
|
+
/**
|
|
4973
|
+
* Indicates if the sequencer has finished playing.
|
|
4974
|
+
*/
|
|
4975
|
+
isFinished = false;
|
|
4976
|
+
/**
|
|
4977
|
+
* Indicates if the synthesizer should preload the voices for the newly loaded sequence.
|
|
4978
|
+
* Recommended.
|
|
4979
|
+
*/
|
|
4980
|
+
preload = false;
|
|
4960
4981
|
/**
|
|
4961
4982
|
* Called when the sequencer calls an event.
|
|
4962
4983
|
* @param event The event
|
|
@@ -5208,8 +5229,12 @@ var SpessaSynthSequencer = class {
|
|
|
5208
5229
|
}
|
|
5209
5230
|
this.stop();
|
|
5210
5231
|
this.callEvent("pause", { isFinished });
|
|
5232
|
+
if (isFinished) {
|
|
5233
|
+
this.callEvent("songEnded", {});
|
|
5234
|
+
}
|
|
5211
5235
|
}
|
|
5212
5236
|
songIsFinished() {
|
|
5237
|
+
this.isFinished = true;
|
|
5213
5238
|
if (this.songs.length === 1) {
|
|
5214
5239
|
this.pauseInternal(true);
|
|
5215
5240
|
return;
|