spessasynth_lib 4.2.0 → 4.2.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/README.md +0 -1
- package/dist/index.d.ts +30 -7
- package/dist/index.js +30 -10
- package/dist/index.js.map +1 -1
- package/dist/spessasynth_processor.min.js +12 -12
- package/dist/spessasynth_processor.min.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,7 +45,6 @@ It allows you to:
|
|
|
45
45
|
- **[Detailed documentation:](https://spessasus.github.io/spessasynth_lib/)** _With [examples!](https://spessasus.github.io/spessasynth_lib/getting-started/#examples)_
|
|
46
46
|
- **Easy to Use:** _Basic setup is just [two lines of code!](https://spessasus.github.io/spessasynth_lib/getting-started/#minimal-setup)_
|
|
47
47
|
- **No external dependencies:** _Just spessasynth_core!_
|
|
48
|
-
- **Reverb and chorus support:** [customizable](https://spessasus.github.io/spessasynth_lib/synthesizer/#effects-configuration-object) and can be used standalone!
|
|
49
48
|
- **Export audio files** using [OfflineAudioContext](https://developer.mozilla.org/en-US/docs/Web/API/OfflineAudioContext)!
|
|
50
49
|
- **AudioWorklet synthesizer:**
|
|
51
50
|
- Runs in a **separate thread** for maximum performance!
|
package/dist/index.d.ts
CHANGED
|
@@ -169,7 +169,16 @@ interface SequencerMessageData {
|
|
|
169
169
|
getMIDI: null;
|
|
170
170
|
setSkipToFirstNote: boolean;
|
|
171
171
|
}
|
|
172
|
-
type SequencerReturnMessage = (SequencerEvent
|
|
172
|
+
type SequencerReturnMessage = (Exclude<SequencerEvent, {
|
|
173
|
+
type: "songListChange";
|
|
174
|
+
}> & {
|
|
175
|
+
id: number;
|
|
176
|
+
}) | (Extract<SequencerEvent, {
|
|
177
|
+
type: "songListChange";
|
|
178
|
+
}> & {
|
|
179
|
+
data: {
|
|
180
|
+
shuffledSongIndexes: number[];
|
|
181
|
+
};
|
|
173
182
|
id: number;
|
|
174
183
|
}) | {
|
|
175
184
|
type: "getMIDI";
|
|
@@ -975,10 +984,6 @@ declare class SeqEventHandler {
|
|
|
975
984
|
}
|
|
976
985
|
|
|
977
986
|
declare class Sequencer {
|
|
978
|
-
/**
|
|
979
|
-
* The current MIDI data, with the exclusion of the embedded sound bank and event data.
|
|
980
|
-
*/
|
|
981
|
-
midiData?: MIDIData;
|
|
982
987
|
/**
|
|
983
988
|
* The current MIDI data for all songs, like the midiData property.
|
|
984
989
|
*/
|
|
@@ -995,6 +1000,10 @@ declare class Sequencer {
|
|
|
995
1000
|
* The synthesizer attached to this sequencer.
|
|
996
1001
|
*/
|
|
997
1002
|
readonly synth: BasicSynthesizer;
|
|
1003
|
+
/**
|
|
1004
|
+
* The current MIDI data, with the exclusion of the embedded sound bank and event data.
|
|
1005
|
+
*/
|
|
1006
|
+
midiData?: MIDIData;
|
|
998
1007
|
/**
|
|
999
1008
|
* The MIDI port to play to.
|
|
1000
1009
|
*/
|
|
@@ -1021,13 +1030,21 @@ declare class Sequencer {
|
|
|
1021
1030
|
* @param options the sequencer's options.
|
|
1022
1031
|
*/
|
|
1023
1032
|
constructor(synth: BasicSynthesizer, options?: Partial<SequencerOptions>);
|
|
1033
|
+
private _shuffledSongIndexes;
|
|
1034
|
+
/**
|
|
1035
|
+
* The shuffled song indexes.
|
|
1036
|
+
* This is used when shuffleMode is enabled.
|
|
1037
|
+
*/
|
|
1038
|
+
get shuffledSongIndexes(): number[];
|
|
1024
1039
|
private _songIndex;
|
|
1025
1040
|
/**
|
|
1026
1041
|
* The current song number in the playlist.
|
|
1042
|
+
* If shuffle Mode is enabled, this is the index of the shuffled song list.
|
|
1027
1043
|
*/
|
|
1028
1044
|
get songIndex(): number;
|
|
1029
1045
|
/**
|
|
1030
1046
|
* The current song number in the playlist.
|
|
1047
|
+
* If shuffle Mode is enabled, this is the index of the shuffled song list.
|
|
1031
1048
|
*/
|
|
1032
1049
|
set songIndex(value: number);
|
|
1033
1050
|
private _currentTempo;
|
|
@@ -1076,11 +1093,17 @@ declare class Sequencer {
|
|
|
1076
1093
|
set playbackRate(value: number);
|
|
1077
1094
|
private _shuffleSongs;
|
|
1078
1095
|
/**
|
|
1079
|
-
*
|
|
1096
|
+
* Controls if the sequencer should shuffle the songs in the song list.
|
|
1097
|
+
* If true, the sequencer will play the songs in a random order.
|
|
1098
|
+
*
|
|
1099
|
+
* Songs are shuffled on a `loadNewSongList` call.
|
|
1080
1100
|
*/
|
|
1081
1101
|
get shuffleSongs(): boolean;
|
|
1082
1102
|
/**
|
|
1083
|
-
*
|
|
1103
|
+
* Controls if the sequencer should shuffle the songs in the song list.
|
|
1104
|
+
* If true, the sequencer will play the songs in a random order.
|
|
1105
|
+
*
|
|
1106
|
+
* Songs are shuffled on a `loadNewSongList` call.
|
|
1084
1107
|
*/
|
|
1085
1108
|
set shuffleSongs(value: boolean);
|
|
1086
1109
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1682,7 +1682,10 @@ var BasicSynthesizerCore = class {
|
|
|
1682
1682
|
type: "sequencerReturn",
|
|
1683
1683
|
data: {
|
|
1684
1684
|
type: e.type,
|
|
1685
|
-
data: {
|
|
1685
|
+
data: {
|
|
1686
|
+
newSongList: midiDatas,
|
|
1687
|
+
shuffledSongIndexes: sequencer.shuffledSongIndexes
|
|
1688
|
+
},
|
|
1686
1689
|
id: sequencerID
|
|
1687
1690
|
},
|
|
1688
1691
|
currentTime: this.synthesizer.currentSynthTime
|
|
@@ -1722,7 +1725,7 @@ var BasicSynthesizerCore = class {
|
|
|
1722
1725
|
destroy() {
|
|
1723
1726
|
this.synthesizer.destroySynthProcessor();
|
|
1724
1727
|
delete this.synthesizer;
|
|
1725
|
-
delete this.
|
|
1728
|
+
delete this.sequencers;
|
|
1726
1729
|
}
|
|
1727
1730
|
handleMessage(m) {
|
|
1728
1731
|
const channel = m.channelNumber;
|
|
@@ -2361,10 +2364,6 @@ var SeqEventHandler = class {
|
|
|
2361
2364
|
|
|
2362
2365
|
// src/sequencer/sequencer.ts
|
|
2363
2366
|
var Sequencer = class {
|
|
2364
|
-
/**
|
|
2365
|
-
* The current MIDI data, with the exclusion of the embedded sound bank and event data.
|
|
2366
|
-
*/
|
|
2367
|
-
midiData;
|
|
2368
2367
|
/**
|
|
2369
2368
|
* The current MIDI data for all songs, like the midiData property.
|
|
2370
2369
|
*/
|
|
@@ -2381,6 +2380,10 @@ var Sequencer = class {
|
|
|
2381
2380
|
* The synthesizer attached to this sequencer.
|
|
2382
2381
|
*/
|
|
2383
2382
|
synth;
|
|
2383
|
+
/**
|
|
2384
|
+
* The current MIDI data, with the exclusion of the embedded sound bank and event data.
|
|
2385
|
+
*/
|
|
2386
|
+
midiData;
|
|
2384
2387
|
/**
|
|
2385
2388
|
* The MIDI port to play to.
|
|
2386
2389
|
*/
|
|
@@ -2424,15 +2427,25 @@ var Sequencer = class {
|
|
|
2424
2427
|
this.resetMIDIOutput.bind(this)
|
|
2425
2428
|
);
|
|
2426
2429
|
}
|
|
2430
|
+
_shuffledSongIndexes = [];
|
|
2431
|
+
/**
|
|
2432
|
+
* The shuffled song indexes.
|
|
2433
|
+
* This is used when shuffleMode is enabled.
|
|
2434
|
+
*/
|
|
2435
|
+
get shuffledSongIndexes() {
|
|
2436
|
+
return this._shuffledSongIndexes;
|
|
2437
|
+
}
|
|
2427
2438
|
_songIndex = 0;
|
|
2428
2439
|
/**
|
|
2429
2440
|
* The current song number in the playlist.
|
|
2441
|
+
* If shuffle Mode is enabled, this is the index of the shuffled song list.
|
|
2430
2442
|
*/
|
|
2431
2443
|
get songIndex() {
|
|
2432
2444
|
return this._songIndex;
|
|
2433
2445
|
}
|
|
2434
2446
|
/**
|
|
2435
2447
|
* The current song number in the playlist.
|
|
2448
|
+
* If shuffle Mode is enabled, this is the index of the shuffled song list.
|
|
2436
2449
|
*/
|
|
2437
2450
|
set songIndex(value) {
|
|
2438
2451
|
const clamped = Math.max(0, value % this._songsAmount);
|
|
@@ -2517,13 +2530,19 @@ var Sequencer = class {
|
|
|
2517
2530
|
}
|
|
2518
2531
|
_shuffleSongs = false;
|
|
2519
2532
|
/**
|
|
2520
|
-
*
|
|
2533
|
+
* Controls if the sequencer should shuffle the songs in the song list.
|
|
2534
|
+
* If true, the sequencer will play the songs in a random order.
|
|
2535
|
+
*
|
|
2536
|
+
* Songs are shuffled on a `loadNewSongList` call.
|
|
2521
2537
|
*/
|
|
2522
2538
|
get shuffleSongs() {
|
|
2523
2539
|
return this._shuffleSongs;
|
|
2524
2540
|
}
|
|
2525
2541
|
/**
|
|
2526
|
-
*
|
|
2542
|
+
* Controls if the sequencer should shuffle the songs in the song list.
|
|
2543
|
+
* If true, the sequencer will play the songs in a random order.
|
|
2544
|
+
*
|
|
2545
|
+
* Songs are shuffled on a `loadNewSongList` call.
|
|
2527
2546
|
*/
|
|
2528
2547
|
set shuffleSongs(value) {
|
|
2529
2548
|
this._shuffleSongs = value;
|
|
@@ -2641,7 +2660,8 @@ var Sequencer = class {
|
|
|
2641
2660
|
}
|
|
2642
2661
|
case "songChange": {
|
|
2643
2662
|
this._songIndex = m.data.songIndex;
|
|
2644
|
-
const
|
|
2663
|
+
const idx = this._shuffleSongs ? this._shuffledSongIndexes[this._songIndex] : this._songIndex;
|
|
2664
|
+
const songChangeData = this.songListData[idx];
|
|
2645
2665
|
this.midiData = songChangeData;
|
|
2646
2666
|
this.isLoading = false;
|
|
2647
2667
|
this.absoluteStartTime = 0;
|
|
@@ -2738,7 +2758,7 @@ var Sequencer = class {
|
|
|
2738
2758
|
this.songListData = m.data.newSongList.map(
|
|
2739
2759
|
(m2) => new MIDIData(m2)
|
|
2740
2760
|
);
|
|
2741
|
-
this.
|
|
2761
|
+
this._shuffledSongIndexes = m.data.shuffledSongIndexes;
|
|
2742
2762
|
break;
|
|
2743
2763
|
}
|
|
2744
2764
|
default: {
|