spessasynth_lib 3.9.12 → 3.9.13
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.
|
@@ -87,6 +87,12 @@ export class Sequencer {
|
|
|
87
87
|
* @param id {string} must be unique
|
|
88
88
|
*/
|
|
89
89
|
addOnSongChangeEvent(callback: (arg0: MidiData) => any, id: string): void;
|
|
90
|
+
/**
|
|
91
|
+
* Adds a new event that gets called when the song ends
|
|
92
|
+
* @param callback {function}
|
|
93
|
+
* @param id {string} must be unique
|
|
94
|
+
*/
|
|
95
|
+
addOnSongEndedEvent(callback: Function, id: string): void;
|
|
90
96
|
/**
|
|
91
97
|
* Adds a new event that gets called when the time changes
|
|
92
98
|
* @param callback {function(number)} the new time, in seconds
|
|
@@ -160,6 +166,11 @@ export class Sequencer {
|
|
|
160
166
|
* @private
|
|
161
167
|
*/
|
|
162
168
|
private onTimeChange;
|
|
169
|
+
/**
|
|
170
|
+
* @type {Object<string, function>}
|
|
171
|
+
* @private
|
|
172
|
+
*/
|
|
173
|
+
private onSongEnded;
|
|
163
174
|
}
|
|
164
175
|
/**
|
|
165
176
|
* {Object}
|
package/package.json
CHANGED
package/sequencer/sequencer.js
CHANGED
|
@@ -190,6 +190,10 @@ export class Sequencer
|
|
|
190
190
|
case WorkletSequencerReturnMessageType.pause:
|
|
191
191
|
this.pausedTime = this.currentTime;
|
|
192
192
|
this.isFinished = messageData;
|
|
193
|
+
if(this.isFinished)
|
|
194
|
+
{
|
|
195
|
+
Object.entries(this.onSongEnded).forEach((callback) => callback[1]());
|
|
196
|
+
}
|
|
193
197
|
break;
|
|
194
198
|
|
|
195
199
|
case WorkletSequencerReturnMessageType.midiError:
|
|
@@ -240,6 +244,17 @@ export class Sequencer
|
|
|
240
244
|
callback(this.midiData);
|
|
241
245
|
}
|
|
242
246
|
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Adds a new event that gets called when the song ends
|
|
250
|
+
* @param callback {function}
|
|
251
|
+
* @param id {string} must be unique
|
|
252
|
+
*/
|
|
253
|
+
addOnSongEndedEvent(callback, id)
|
|
254
|
+
{
|
|
255
|
+
this.onSongEnded[id] = callback;
|
|
256
|
+
}
|
|
257
|
+
|
|
243
258
|
/**
|
|
244
259
|
* Adds a new event that gets called when the time changes
|
|
245
260
|
* @param callback {function(number)} the new time, in seconds
|
|
@@ -436,4 +451,10 @@ export class Sequencer
|
|
|
436
451
|
* @private
|
|
437
452
|
*/
|
|
438
453
|
onTimeChange = {};
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* @type {Object<string, function>}
|
|
457
|
+
* @private
|
|
458
|
+
*/
|
|
459
|
+
onSongEnded = {};
|
|
439
460
|
}
|