@marmooo/midy 0.4.1 → 0.4.2

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/esm/midy-GM2.js CHANGED
@@ -26,12 +26,6 @@ class Note {
26
26
  writable: true,
27
27
  value: false
28
28
  });
29
- Object.defineProperty(this, "pending", {
30
- enumerable: true,
31
- configurable: true,
32
- writable: true,
33
- value: true
34
- });
35
29
  Object.defineProperty(this, "bufferSource", {
36
30
  enumerable: true,
37
31
  configurable: true,
@@ -107,6 +101,9 @@ class Note {
107
101
  this.noteNumber = noteNumber;
108
102
  this.velocity = velocity;
109
103
  this.startTime = startTime;
104
+ this.ready = new Promise((resolve) => {
105
+ this.resolveReady = resolve;
106
+ });
110
107
  }
111
108
  }
112
109
  const drumExclusiveClassesByKit = new Array(57);
@@ -228,8 +225,9 @@ const pitchEnvelopeKeys = [
228
225
  "playbackRate",
229
226
  ];
230
227
  const pitchEnvelopeKeySet = new Set(pitchEnvelopeKeys);
231
- export class MidyGM2 {
228
+ export class MidyGM2 extends EventTarget {
232
229
  constructor(audioContext) {
230
+ super();
233
231
  Object.defineProperty(this, "mode", {
234
232
  enumerable: true,
235
233
  configurable: true,
@@ -390,6 +388,12 @@ export class MidyGM2 {
390
388
  writable: true,
391
389
  value: false
392
390
  });
391
+ Object.defineProperty(this, "loop", {
392
+ enumerable: true,
393
+ configurable: true,
394
+ writable: true,
395
+ value: false
396
+ });
393
397
  Object.defineProperty(this, "playPromise", {
394
398
  enumerable: true,
395
399
  configurable: true,
@@ -609,7 +613,7 @@ export class MidyGM2 {
609
613
  }
610
614
  return bufferSource;
611
615
  }
612
- async scheduleTimelineEvents(scheduleTime, queueIndex) {
616
+ scheduleTimelineEvents(scheduleTime, queueIndex) {
613
617
  const timeOffset = this.resumeTime - this.startTime;
614
618
  const lookAheadCheckTime = scheduleTime + timeOffset + this.lookAhead;
615
619
  const schedulingOffset = this.startDelay - timeOffset;
@@ -621,7 +625,7 @@ export class MidyGM2 {
621
625
  const startTime = event.startTime + schedulingOffset;
622
626
  switch (event.type) {
623
627
  case "noteOn":
624
- await this.noteOn(event.channel, event.noteNumber, event.velocity, startTime);
628
+ this.noteOn(event.channel, event.noteNumber, event.velocity, startTime);
625
629
  break;
626
630
  case "noteOff": {
627
631
  this.noteOff(event.channel, event.noteNumber, event.velocity, startTime, false);
@@ -665,22 +669,23 @@ export class MidyGM2 {
665
669
  }
666
670
  }
667
671
  updateStates(queueIndex, nextQueueIndex) {
672
+ const now = this.audioContext.currentTime;
668
673
  if (nextQueueIndex < queueIndex)
669
674
  queueIndex = 0;
670
675
  for (let i = queueIndex; i < nextQueueIndex; i++) {
671
676
  const event = this.timeline[i];
672
677
  switch (event.type) {
673
678
  case "controller":
674
- this.setControlChange(event.channel, event.controllerType, event.value, 0);
679
+ this.setControlChange(event.channel, event.controllerType, event.value, now - this.resumeTime + event.startTime);
675
680
  break;
676
681
  case "programChange":
677
- this.setProgramChange(event.channel, event.programNumber, 0);
682
+ this.setProgramChange(event.channel, event.programNumber, now - this.resumeTime + event.startTime);
678
683
  break;
679
684
  case "pitchBend":
680
- this.setPitchBend(event.channel, event.value + 8192, 0);
685
+ this.setPitchBend(event.channel, event.value + 8192, now - this.resumeTime + event.startTime);
681
686
  break;
682
687
  case "sysEx":
683
- this.handleSysEx(event.data, 0);
688
+ this.handleSysEx(event.data, now - this.resumeTime + event.startTime);
684
689
  }
685
690
  }
686
691
  }
@@ -688,58 +693,88 @@ export class MidyGM2 {
688
693
  if (this.audioContext.state === "suspended") {
689
694
  await this.audioContext.resume();
690
695
  }
696
+ const paused = this.isPaused;
691
697
  this.isPlaying = true;
692
698
  this.isPaused = false;
693
699
  this.startTime = this.audioContext.currentTime;
700
+ if (paused) {
701
+ this.dispatchEvent(new Event("resumed"));
702
+ }
703
+ else {
704
+ this.dispatchEvent(new Event("started"));
705
+ }
694
706
  let queueIndex = this.getQueueIndex(this.resumeTime);
695
- let finished = false;
707
+ let exitReason;
696
708
  this.notePromises = [];
697
- while (queueIndex < this.timeline.length) {
709
+ while (true) {
698
710
  const now = this.audioContext.currentTime;
699
711
  if (0 < this.lastActiveSensing &&
700
712
  this.activeSensingThreshold < performance.now() - this.lastActiveSensing) {
701
713
  await this.stopNotes(0, true, now);
702
714
  await this.audioContext.suspend();
703
- finished = true;
715
+ exitReason = "aborted";
704
716
  break;
705
717
  }
718
+ if (this.timeline.length <= queueIndex) {
719
+ await this.stopNotes(0, true, now);
720
+ if (this.loop) {
721
+ this.notePromises = [];
722
+ this.resetAllStates();
723
+ this.startTime = this.audioContext.currentTime;
724
+ this.resumeTime = 0;
725
+ queueIndex = 0;
726
+ this.dispatchEvent(new Event("looped"));
727
+ continue;
728
+ }
729
+ else {
730
+ await this.audioContext.suspend();
731
+ exitReason = "ended";
732
+ break;
733
+ }
734
+ }
706
735
  if (this.isPausing) {
707
736
  await this.stopNotes(0, true, now);
708
737
  await this.audioContext.suspend();
709
738
  this.notePromises = [];
739
+ this.isPausing = false;
740
+ exitReason = "paused";
710
741
  break;
711
742
  }
712
743
  else if (this.isStopping) {
713
744
  await this.stopNotes(0, true, now);
714
745
  await this.audioContext.suspend();
715
- finished = true;
746
+ this.isStopping = false;
747
+ exitReason = "stopped";
716
748
  break;
717
749
  }
718
750
  else if (this.isSeeking) {
719
- await this.stopNotes(0, true, now);
751
+ this.stopNotes(0, true, now);
720
752
  this.startTime = this.audioContext.currentTime;
721
753
  const nextQueueIndex = this.getQueueIndex(this.resumeTime);
722
754
  this.updateStates(queueIndex, nextQueueIndex);
723
755
  queueIndex = nextQueueIndex;
724
756
  this.isSeeking = false;
757
+ this.dispatchEvent(new Event("seeked"));
725
758
  continue;
726
759
  }
727
- queueIndex = await this.scheduleTimelineEvents(now, queueIndex);
760
+ queueIndex = this.scheduleTimelineEvents(now, queueIndex);
728
761
  const waitTime = now + this.noteCheckInterval;
729
762
  await this.scheduleTask(() => { }, waitTime);
730
763
  }
731
- if (this.timeline.length <= queueIndex) {
732
- const now = this.audioContext.currentTime;
733
- await this.stopNotes(0, true, now);
734
- await this.audioContext.suspend();
735
- finished = true;
736
- }
737
- if (finished) {
764
+ if (exitReason !== "paused") {
738
765
  this.notePromises = [];
739
766
  this.resetAllStates();
740
767
  this.lastActiveSensing = 0;
741
768
  }
742
769
  this.isPlaying = false;
770
+ if (exitReason === "paused") {
771
+ this.isPaused = true;
772
+ this.dispatchEvent(new Event("paused"));
773
+ }
774
+ else {
775
+ this.isPaused = false;
776
+ this.dispatchEvent(new Event(exitReason));
777
+ }
743
778
  }
744
779
  ticksToSecond(ticks, secondsPerBeat) {
745
780
  return ticks * secondsPerBeat / this.ticksPerBeat;
@@ -876,24 +911,20 @@ export class MidyGM2 {
876
911
  return;
877
912
  this.isStopping = true;
878
913
  await this.playPromise;
879
- this.isStopping = false;
880
914
  }
881
915
  async pause() {
882
916
  if (!this.isPlaying || this.isPaused)
883
917
  return;
884
918
  const now = this.audioContext.currentTime;
885
- this.resumeTime = now - this.startTime - this.startDelay;
919
+ this.resumeTime = now + this.resumeTime - this.startTime;
886
920
  this.isPausing = true;
887
921
  await this.playPromise;
888
- this.isPausing = false;
889
- this.isPaused = true;
890
922
  }
891
923
  async resume() {
892
924
  if (!this.isPaused)
893
925
  return;
894
926
  this.playPromise = this.playNotes();
895
927
  await this.playPromise;
896
- this.isPaused = false;
897
928
  }
898
929
  seekTo(second) {
899
930
  this.resumeTime = second;
@@ -916,19 +947,23 @@ export class MidyGM2 {
916
947
  const now = this.audioContext.currentTime;
917
948
  return now + this.resumeTime - this.startTime;
918
949
  }
919
- processScheduledNotes(channel, callback) {
950
+ async processScheduledNotes(channel, callback) {
920
951
  const scheduledNotes = channel.scheduledNotes;
952
+ const tasks = [];
921
953
  for (let i = channel.scheduleIndex; i < scheduledNotes.length; i++) {
922
954
  const note = scheduledNotes[i];
923
955
  if (!note)
924
956
  continue;
925
957
  if (note.ending)
926
958
  continue;
927
- callback(note);
959
+ const task = note.ready.then(() => callback(note));
960
+ tasks.push(task);
928
961
  }
962
+ await Promise.all(tasks);
929
963
  }
930
- processActiveNotes(channel, scheduleTime, callback) {
964
+ async processActiveNotes(channel, scheduleTime, callback) {
931
965
  const scheduledNotes = channel.scheduledNotes;
966
+ const tasks = [];
932
967
  for (let i = channel.scheduleIndex; i < scheduledNotes.length; i++) {
933
968
  const note = scheduledNotes[i];
934
969
  if (!note)
@@ -937,8 +972,10 @@ export class MidyGM2 {
937
972
  continue;
938
973
  if (scheduleTime < note.startTime)
939
974
  break;
940
- callback(note);
975
+ const task = note.ready.then(() => callback(note));
976
+ tasks.push(task);
941
977
  }
978
+ await Promise.all(tasks);
942
979
  }
943
980
  createConvolutionReverbImpulse(audioContext, decay, preDecay) {
944
981
  const sampleRate = audioContext.sampleRate;
@@ -1503,11 +1540,7 @@ export class MidyGM2 {
1503
1540
  return;
1504
1541
  await this.setNoteAudioNode(channel, note, realtime);
1505
1542
  this.setNoteRouting(channelNumber, note, startTime);
1506
- note.pending = false;
1507
- const off = note.offEvent;
1508
- if (off) {
1509
- this.noteOff(channelNumber, noteNumber, off.velocity, off.startTime);
1510
- }
1543
+ note.resolveReady();
1511
1544
  }
1512
1545
  disconnectNote(note) {
1513
1546
  note.bufferSource.disconnect();
@@ -1551,7 +1584,7 @@ export class MidyGM2 {
1551
1584
  }, stopTime);
1552
1585
  });
1553
1586
  }
1554
- noteOff(channelNumber, noteNumber, velocity, endTime, force) {
1587
+ noteOff(channelNumber, noteNumber, _velocity, endTime, force) {
1555
1588
  const channel = this.channels[channelNumber];
1556
1589
  const state = channel.state;
1557
1590
  if (!force) {
@@ -1570,13 +1603,11 @@ export class MidyGM2 {
1570
1603
  if (index < 0)
1571
1604
  return;
1572
1605
  const note = channel.scheduledNotes[index];
1573
- if (note.pending) {
1574
- note.offEvent = { velocity, startTime: endTime };
1575
- return;
1576
- }
1577
1606
  note.ending = true;
1578
1607
  this.setNoteIndex(channel, index);
1579
- const promise = this.releaseNote(channel, note, endTime);
1608
+ const promise = note.ready.then(() => {
1609
+ return this.releaseNote(channel, note, endTime);
1610
+ });
1580
1611
  this.notePromises.push(promise);
1581
1612
  return promise;
1582
1613
  }
@@ -1687,7 +1718,7 @@ export class MidyGM2 {
1687
1718
  this.processActiveNotes(channel, scheduleTime, (note) => {
1688
1719
  this.setEffects(channel, note, table, scheduleTime);
1689
1720
  });
1690
- this.applyVoiceParams(channel, 13);
1721
+ this.applyVoiceParams(channel, 13, scheduleTime);
1691
1722
  }
1692
1723
  handlePitchBendMessage(channelNumber, lsb, msb, scheduleTime) {
1693
1724
  const pitchBend = msb * 128 + lsb;
@@ -1697,7 +1728,8 @@ export class MidyGM2 {
1697
1728
  const channel = this.channels[channelNumber];
1698
1729
  if (channel.isDrum)
1699
1730
  return;
1700
- scheduleTime ??= this.audioContext.currentTime;
1731
+ if (!(0 <= scheduleTime))
1732
+ scheduleTime = this.audioContext.currentTime;
1701
1733
  const state = channel.state;
1702
1734
  const prev = state.pitchWheel * 2 - 1;
1703
1735
  const next = (value - 8192) / 8192;
@@ -1991,7 +2023,8 @@ export class MidyGM2 {
1991
2023
  const channel = this.channels[channelNumber];
1992
2024
  if (channel.isDrum)
1993
2025
  return;
1994
- scheduleTime ??= this.audioContext.currentTime;
2026
+ if (!(0 <= scheduleTime))
2027
+ scheduleTime = this.audioContext.currentTime;
1995
2028
  channel.state.modulationDepthMSB = modulation / 127;
1996
2029
  this.updateModulation(channel, scheduleTime);
1997
2030
  }
@@ -2014,7 +2047,8 @@ export class MidyGM2 {
2014
2047
  });
2015
2048
  }
2016
2049
  setPortamentoTime(channelNumber, portamentoTime, scheduleTime) {
2017
- scheduleTime ??= this.audioContext.currentTime;
2050
+ if (!(0 <= scheduleTime))
2051
+ scheduleTime = this.audioContext.currentTime;
2018
2052
  const channel = this.channels[channelNumber];
2019
2053
  channel.state.portamentoTimeMSB = portamentoTime / 127;
2020
2054
  if (channel.isDrum)
@@ -2022,7 +2056,8 @@ export class MidyGM2 {
2022
2056
  this.updatePortamento(channel, scheduleTime);
2023
2057
  }
2024
2058
  setVolume(channelNumber, volume, scheduleTime) {
2025
- scheduleTime ??= this.audioContext.currentTime;
2059
+ if (!(0 <= scheduleTime))
2060
+ scheduleTime = this.audioContext.currentTime;
2026
2061
  const channel = this.channels[channelNumber];
2027
2062
  channel.state.volumeMSB = volume / 127;
2028
2063
  if (channel.isDrum) {
@@ -2042,7 +2077,8 @@ export class MidyGM2 {
2042
2077
  };
2043
2078
  }
2044
2079
  setPan(channelNumber, pan, scheduleTime) {
2045
- scheduleTime ??= this.audioContext.currentTime;
2080
+ if (!(0 <= scheduleTime))
2081
+ scheduleTime = this.audioContext.currentTime;
2046
2082
  const channel = this.channels[channelNumber];
2047
2083
  channel.state.panMSB = pan / 127;
2048
2084
  if (channel.isDrum) {
@@ -2055,7 +2091,8 @@ export class MidyGM2 {
2055
2091
  }
2056
2092
  }
2057
2093
  setExpression(channelNumber, expression, scheduleTime) {
2058
- scheduleTime ??= this.audioContext.currentTime;
2094
+ if (!(0 <= scheduleTime))
2095
+ scheduleTime = this.audioContext.currentTime;
2059
2096
  const channel = this.channels[channelNumber];
2060
2097
  channel.state.expressionMSB = expression / 127;
2061
2098
  this.updateChannelVolume(channel, scheduleTime);
@@ -2104,7 +2141,8 @@ export class MidyGM2 {
2104
2141
  const channel = this.channels[channelNumber];
2105
2142
  if (channel.isDrum)
2106
2143
  return;
2107
- scheduleTime ??= this.audioContext.currentTime;
2144
+ if (!(0 <= scheduleTime))
2145
+ scheduleTime = this.audioContext.currentTime;
2108
2146
  channel.state.sustainPedal = value / 127;
2109
2147
  if (64 <= value) {
2110
2148
  this.processScheduledNotes(channel, (note) => {
@@ -2122,7 +2160,8 @@ export class MidyGM2 {
2122
2160
  const channel = this.channels[channelNumber];
2123
2161
  if (channel.isDrum)
2124
2162
  return;
2125
- scheduleTime ??= this.audioContext.currentTime;
2163
+ if (!(0 <= scheduleTime))
2164
+ scheduleTime = this.audioContext.currentTime;
2126
2165
  channel.state.portamento = value / 127;
2127
2166
  this.updatePortamento(channel, scheduleTime);
2128
2167
  }
@@ -2130,7 +2169,8 @@ export class MidyGM2 {
2130
2169
  const channel = this.channels[channelNumber];
2131
2170
  if (channel.isDrum)
2132
2171
  return;
2133
- scheduleTime ??= this.audioContext.currentTime;
2172
+ if (!(0 <= scheduleTime))
2173
+ scheduleTime = this.audioContext.currentTime;
2134
2174
  channel.state.sostenutoPedal = value / 127;
2135
2175
  if (64 <= value) {
2136
2176
  const sostenutoNotes = [];
@@ -2151,7 +2191,8 @@ export class MidyGM2 {
2151
2191
  if (channel.isDrum)
2152
2192
  return;
2153
2193
  const state = channel.state;
2154
- scheduleTime ??= this.audioContext.currentTime;
2194
+ if (!(0 <= scheduleTime))
2195
+ scheduleTime = this.audioContext.currentTime;
2155
2196
  state.softPedal = softPedal / 127;
2156
2197
  this.processScheduledNotes(channel, (note) => {
2157
2198
  if (this.isPortamento(channel, note)) {
@@ -2165,7 +2206,8 @@ export class MidyGM2 {
2165
2206
  });
2166
2207
  }
2167
2208
  setReverbSendLevel(channelNumber, reverbSendLevel, scheduleTime) {
2168
- scheduleTime ??= this.audioContext.currentTime;
2209
+ if (!(0 <= scheduleTime))
2210
+ scheduleTime = this.audioContext.currentTime;
2169
2211
  const channel = this.channels[channelNumber];
2170
2212
  const state = channel.state;
2171
2213
  state.reverbSendLevel = reverbSendLevel / 127;
@@ -2174,7 +2216,8 @@ export class MidyGM2 {
2174
2216
  });
2175
2217
  }
2176
2218
  setChorusSendLevel(channelNumber, chorusSendLevel, scheduleTime) {
2177
- scheduleTime ??= this.audioContext.currentTime;
2219
+ if (!(0 <= scheduleTime))
2220
+ scheduleTime = this.audioContext.currentTime;
2178
2221
  const channel = this.channels[channelNumber];
2179
2222
  const state = channel.state;
2180
2223
  state.chorusSendLevel = chorusSendLevel / 127;
@@ -2248,7 +2291,8 @@ export class MidyGM2 {
2248
2291
  const channel = this.channels[channelNumber];
2249
2292
  if (channel.isDrum)
2250
2293
  return;
2251
- scheduleTime ??= this.audioContext.currentTime;
2294
+ if (!(0 <= scheduleTime))
2295
+ scheduleTime = this.audioContext.currentTime;
2252
2296
  const state = channel.state;
2253
2297
  const prev = state.pitchWheelSensitivity;
2254
2298
  const next = value / 12800;
@@ -2268,7 +2312,8 @@ export class MidyGM2 {
2268
2312
  const channel = this.channels[channelNumber];
2269
2313
  if (channel.isDrum)
2270
2314
  return;
2271
- scheduleTime ??= this.audioContext.currentTime;
2315
+ if (!(0 <= scheduleTime))
2316
+ scheduleTime = this.audioContext.currentTime;
2272
2317
  const prev = channel.fineTuning;
2273
2318
  const next = value;
2274
2319
  channel.fineTuning = next;
@@ -2285,7 +2330,8 @@ export class MidyGM2 {
2285
2330
  const channel = this.channels[channelNumber];
2286
2331
  if (channel.isDrum)
2287
2332
  return;
2288
- scheduleTime ??= this.audioContext.currentTime;
2333
+ if (!(0 <= scheduleTime))
2334
+ scheduleTime = this.audioContext.currentTime;
2289
2335
  const prev = channel.coarseTuning;
2290
2336
  const next = value;
2291
2337
  channel.coarseTuning = next;
@@ -2302,12 +2348,14 @@ export class MidyGM2 {
2302
2348
  const channel = this.channels[channelNumber];
2303
2349
  if (channel.isDrum)
2304
2350
  return;
2305
- scheduleTime ??= this.audioContext.currentTime;
2351
+ if (!(0 <= scheduleTime))
2352
+ scheduleTime = this.audioContext.currentTime;
2306
2353
  channel.modulationDepthRange = value;
2307
2354
  this.updateModulation(channel, scheduleTime);
2308
2355
  }
2309
2356
  allSoundOff(channelNumber, _value, scheduleTime) {
2310
- scheduleTime ??= this.audioContext.currentTime;
2357
+ if (!(0 <= scheduleTime))
2358
+ scheduleTime = this.audioContext.currentTime;
2311
2359
  return this.stopActiveNotes(channelNumber, 0, true, scheduleTime);
2312
2360
  }
2313
2361
  resetChannelStates(channelNumber) {
@@ -2366,7 +2414,8 @@ export class MidyGM2 {
2366
2414
  }
2367
2415
  }
2368
2416
  allNotesOff(channelNumber, _value, scheduleTime) {
2369
- scheduleTime ??= this.audioContext.currentTime;
2417
+ if (!(0 <= scheduleTime))
2418
+ scheduleTime = this.audioContext.currentTime;
2370
2419
  return this.stopActiveNotes(channelNumber, 0, false, scheduleTime);
2371
2420
  }
2372
2421
  omniOff(channelNumber, value, scheduleTime) {
@@ -2415,7 +2464,8 @@ export class MidyGM2 {
2415
2464
  }
2416
2465
  }
2417
2466
  GM1SystemOn(scheduleTime) {
2418
- scheduleTime ??= this.audioContext.currentTime;
2467
+ if (!(0 <= scheduleTime))
2468
+ scheduleTime = this.audioContext.currentTime;
2419
2469
  this.mode = "GM1";
2420
2470
  for (let i = 0; i < this.channels.length; i++) {
2421
2471
  this.allSoundOff(i, 0, scheduleTime);
@@ -2428,7 +2478,8 @@ export class MidyGM2 {
2428
2478
  this.channels[9].isDrum = true;
2429
2479
  }
2430
2480
  GM2SystemOn(scheduleTime) {
2431
- scheduleTime ??= this.audioContext.currentTime;
2481
+ if (!(0 <= scheduleTime))
2482
+ scheduleTime = this.audioContext.currentTime;
2432
2483
  this.mode = "GM2";
2433
2484
  for (let i = 0; i < this.channels.length; i++) {
2434
2485
  this.allSoundOff(i, 0, scheduleTime);
@@ -2483,7 +2534,8 @@ export class MidyGM2 {
2483
2534
  this.setMasterVolume(volume, scheduleTime);
2484
2535
  }
2485
2536
  setMasterVolume(value, scheduleTime) {
2486
- scheduleTime ??= this.audioContext.currentTime;
2537
+ if (!(0 <= scheduleTime))
2538
+ scheduleTime = this.audioContext.currentTime;
2487
2539
  this.masterVolume.gain
2488
2540
  .cancelScheduledValues(scheduleTime)
2489
2541
  .setValueAtTime(value * value, scheduleTime);
@@ -1,4 +1,4 @@
1
- export class MidyGMLite {
1
+ export class MidyGMLite extends EventTarget {
2
2
  static channelSettings: {
3
3
  scheduleIndex: number;
4
4
  detune: number;
@@ -29,6 +29,7 @@ export class MidyGMLite {
29
29
  isPaused: boolean;
30
30
  isStopping: boolean;
31
31
  isSeeking: boolean;
32
+ loop: boolean;
32
33
  playPromise: any;
33
34
  timeline: any[];
34
35
  notePromises: any[];
@@ -68,7 +69,7 @@ export class MidyGMLite {
68
69
  createChannels(audioContext: any): any[];
69
70
  createAudioBuffer(voiceParams: any): Promise<any>;
70
71
  createBufferSource(channel: any, voiceParams: any, audioBuffer: any): any;
71
- scheduleTimelineEvents(scheduleTime: any, queueIndex: any): Promise<any>;
72
+ scheduleTimelineEvents(scheduleTime: any, queueIndex: any): any;
72
73
  getQueueIndex(second: any): number;
73
74
  resetAllStates(): void;
74
75
  updateStates(queueIndex: any, nextQueueIndex: any): void;
@@ -90,8 +91,8 @@ export class MidyGMLite {
90
91
  seekTo(second: any): void;
91
92
  calcTotalTime(): number;
92
93
  currentTime(): number;
93
- processScheduledNotes(channel: any, callback: any): void;
94
- processActiveNotes(channel: any, scheduleTime: any, callback: any): void;
94
+ processScheduledNotes(channel: any, callback: any): Promise<void>;
95
+ processActiveNotes(channel: any, scheduleTime: any, callback: any): Promise<void>;
95
96
  cbToRatio(cb: any): number;
96
97
  rateToCent(rate: any): number;
97
98
  centToRate(cent: any): number;
@@ -112,10 +113,10 @@ export class MidyGMLite {
112
113
  noteOn(channelNumber: any, noteNumber: any, velocity: any, startTime: any): Promise<void>;
113
114
  disconnectNote(note: any): void;
114
115
  releaseNote(channel: any, note: any, endTime: any): Promise<any>;
115
- noteOff(channelNumber: any, noteNumber: any, velocity: any, endTime: any, force: any): Promise<any> | undefined;
116
+ noteOff(channelNumber: any, noteNumber: any, _velocity: any, endTime: any, force: any): Promise<any>;
116
117
  setNoteIndex(channel: any, index: any): void;
117
118
  findNoteOffIndex(channel: any, noteNumber: any): any;
118
- releaseSustainPedal(channelNumber: any, halfVelocity: any, scheduleTime: any): (Promise<any> | undefined)[];
119
+ releaseSustainPedal(channelNumber: any, halfVelocity: any, scheduleTime: any): Promise<any>[];
119
120
  createMessageHandlers(): any[];
120
121
  handleMessage(data: any, scheduleTime: any): void;
121
122
  handleChannelMessage(statusByte: any, data1: any, data2: any, scheduleTime: any): void | Promise<any>;
@@ -1 +1 @@
1
- {"version":3,"file":"midy-GMLite.d.ts","sourceRoot":"","sources":["../src/midy-GMLite.js"],"names":[],"mappings":"AA2GA;IA6BE;;;;;;;;;MASE;IAEF,+BAeC;IAtDD,aAAa;IACb,oBAAiB;IACjB,qBAAmB;IACnB,kBAAc;IACd,0BAAwB;IACxB,kBAAc;IACd,mBAAiB;IACjB,kBAAc;IACd,mBAAe;IACf,kBAAgB;IAChB,0BAAuD;IACvD,4BAAyB;IACzB,0BAAuB;IACvB,kCAA+B;IAC/B,mBAAkB;IAClB,mBAAkB;IAClB,kBAAiB;IACjB,oBAAmB;IACnB,mBAAkB;IAClB,iBAAY;IACZ,gBAAc;IACd,oBAAkB;IAClB,sBAAwB;IACxB,2BAAqC;IACrC,+BAEE;IAcA,kBAAgC;IAChC,kBAA8C;IAC9C,eAAwD;IACxD,qBAGE;IACF,uBAAmD;IACnD;;;;;;;;;;;MAA2D;IAC3D,6BAA+D;IAC/D,gBAAiD;IAMnD,mCASC;IAED,2DAYC;IAED,yCAmBC;IAED,oCASC;IAED,sBAoCC;IAED,8DAWC;IAED;;;;MAeC;IAED,yCAaC;IAED,kDASC;IAED,0EAUC;IAED,yEAoDC;IAED,mCAOC;IAED,uBASC;IAED,yDA2BC;IAED,2BA8CC;IAED,uDAEC;IAED,wDAEC;IAED,qCAKC;IAED;;;MAwDC;IAED,kGAeC;IAED,mGAeC;IAED,wEAMC;IAED,uBAMC;IAED,sBAKC;IAED,uBAQC;IAED,wBAKC;IAED,0BAKC;IAED,wBAOC;IAED,sBAIC;IAED,yDAQC;IAED,yEASC;IAED,2BAEC;IAED,8BAEC;IAED,8BAEC;IAED,4BAEC;IAED,wCAIC;IAED,2DAIC;IAED,+DAIC;IAED,sDAeC;IAED,qDAoBC;IAED,6CAIC;IAED,sDAsBC;IAED,kEAoBC;IAED,4GAkCC;IAED,uEA4CC;IAED,0EAiBC;IAED,8EAiBC;IAED,oEAUC;IAED,0FAwBC;IAED,gCASC;IAED,iEAqBC;IAED,gHAwBC;IAED,6CAUC;IAED,qDAUC;IAED,4GAeC;IAED,+BAmBC;IAED,kDAOC;IAED,sGA2BC;IAED,mFAGC;IAED,wFAGC;IAED,sEAUC;IAED,mEAYC;IAED,wDAKC;IAED,sDAOC;IAED,mDAMC;IAED,kDAKC;IAED;;;;;;;;;;;MAiCC;IAED,oFAMC;IAED,6EA2BC;IAED,qCAeC;IAED,+FAWC;IAED,wDASC;IAED,iFAKC;IAED,oEAKC;IAED;;;MAMC;IAED,8DAKC;IAED,4EAKC;IAED,sEAGC;IAED,2DAUC;IAED,yEAWC;IAED,kFAeC;IAED,uDAYC;IAED,gDAEC;IAED,gDAEC;IAED,sEAGC;IAED,qEAKC;IAED,2EAUC;IAED,gFAGC;IAED,6CAqBC;IAGD,8EAgCC;IAED,gFAGC;IAED,+EAgBC;IAED,qCASC;IAED,4EAaC;IAED,4DAGC;IAED,qDAKC;IAED,gDAYC;IAGD,6DAgBC;CACF"}
1
+ {"version":3,"file":"midy-GMLite.d.ts","sourceRoot":"","sources":["../src/midy-GMLite.js"],"names":[],"mappings":"AA6GA;IA8BE;;;;;;;;;MASE;IAEF,+BAgBC;IAxDD,aAAa;IACb,oBAAiB;IACjB,qBAAmB;IACnB,kBAAc;IACd,0BAAwB;IACxB,kBAAc;IACd,mBAAiB;IACjB,kBAAc;IACd,mBAAe;IACf,kBAAgB;IAChB,0BAAuD;IACvD,4BAAyB;IACzB,0BAAuB;IACvB,kCAA+B;IAC/B,mBAAkB;IAClB,mBAAkB;IAClB,kBAAiB;IACjB,oBAAmB;IACnB,mBAAkB;IAClB,cAAa;IACb,iBAAY;IACZ,gBAAc;IACd,oBAAkB;IAClB,sBAAwB;IACxB,2BAAqC;IACrC,+BAEE;IAeA,kBAAgC;IAChC,kBAA8C;IAC9C,eAAwD;IACxD,qBAGE;IACF,uBAAmD;IACnD;;;;;;;;;;;MAA2D;IAC3D,6BAA+D;IAC/D,gBAAiD;IAMnD,mCASC;IAED,2DAYC;IAED,yCAmBC;IAED,oCASC;IAED,sBAoCC;IAED,8DAWC;IAED;;;;MAeC;IAED,yCAaC;IAED,kDASC;IAED,0EAUC;IAED,gEAoDC;IAED,mCAOC;IAED,uBASC;IAED,yDAgCC;IAED,2BAyEC;IAED,uDAEC;IAED,wDAEC;IAED,qCAKC;IAED;;;MAwDC;IAED,kGAeC;IAED,mGAeC;IAED,wEAMC;IAED,uBAMC;IAED,sBAIC;IAED,uBAMC;IAED,wBAIC;IAED,0BAKC;IAED,wBAOC;IAED,sBAIC;IAED,kEAWC;IAED,kFAYC;IAED,2BAEC;IAED,8BAEC;IAED,8BAEC;IAED,4BAEC;IAED,wCAIC;IAED,2DAIC;IAED,+DAIC;IAED,sDAeC;IAED,qDAoBC;IAED,6CAIC;IAED,sDAsBC;IAED,kEAoBC;IAED,4GAkCC;IAED,uEA4CC;IAED,0EAiBC;IAED,8EAiBC;IAED,oEAUC;IAED,0FAoBC;IAED,gCASC;IAED,iEAqBC;IAED,qGAsBC;IAED,6CAUC;IAED,qDAUC;IAED,8FAeC;IAED,+BAmBC;IAED,kDAOC;IAED,sGA2BC;IAED,mFAGC;IAED,wFAGC;IAED,sEAUC;IAED,mEAYC;IAED,wDAKC;IAED,sDAOC;IAED,mDAMC;IAED,kDAKC;IAED;;;;;;;;;;;MAiCC;IAED,oFAMC;IAED,6EA2BC;IAED,qCAeC;IAED,+FAWC;IAED,wDASC;IAED,iFAKC;IAED,oEAKC;IAED;;;MAMC;IAED,8DAKC;IAED,4EAKC;IAED,sEAGC;IAED,2DAUC;IAED,yEAWC;IAED,kFAeC;IAED,uDAYC;IAED,gDAEC;IAED,gDAEC;IAED,sEAGC;IAED,qEAKC;IAED,2EAUC;IAED,gFAGC;IAED,6CAqBC;IAGD,8EAgCC;IAED,gFAGC;IAED,+EAgBC;IAED,qCASC;IAED,4EAaC;IAED,4DAGC;IAED,qDAKC;IAED,gDAYC;IAGD,6DAgBC;CACF"}