pxt-common-packages 10.2.7 → 10.2.8

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.
Files changed (34) hide show
  1. package/libs/azureiot/built/debug/binary.js +461 -461
  2. package/libs/color/built/debug/binary.js +8 -8
  3. package/libs/color-sensor/built/debug/binary.js +8 -8
  4. package/libs/controller/built/debug/binary.js +6969 -6969
  5. package/libs/controller---none/built/debug/binary.js +6949 -6949
  6. package/libs/datalogger/built/debug/binary.js +63 -63
  7. package/libs/edge-connector/built/debug/binary.js +9 -9
  8. package/libs/esp32/built/debug/binary.js +462 -462
  9. package/libs/game/assetTemplates.ts +0 -10
  10. package/libs/game/built/debug/binary.js +6888 -6888
  11. package/libs/lcd/built/debug/binary.js +8 -8
  12. package/libs/light-spectrum-sensor/built/debug/binary.js +8 -8
  13. package/libs/lora/built/debug/binary.js +8 -8
  14. package/libs/matrix-keypad/built/debug/binary.js +8 -8
  15. package/libs/mixer/melody.h +1 -1
  16. package/libs/mixer/melody.ts +1 -29
  17. package/libs/mixer/pxt.json +0 -2
  18. package/libs/mqtt/built/debug/binary.js +176 -176
  19. package/libs/net/built/debug/binary.js +176 -176
  20. package/libs/net-game/built/debug/binary.js +8477 -8477
  21. package/libs/palette/built/debug/binary.js +6887 -6887
  22. package/libs/pixel/built/debug/binary.js +8 -8
  23. package/libs/power/built/debug/binary.js +8 -8
  24. package/libs/proximity/built/debug/binary.js +8 -8
  25. package/libs/radio/built/debug/binary.js +8 -8
  26. package/libs/radio-broadcast/built/debug/binary.js +8 -8
  27. package/libs/rotary-encoder/built/debug/binary.js +8 -8
  28. package/libs/screen/built/debug/binary.js +50 -50
  29. package/libs/servo/built/debug/binary.js +8 -8
  30. package/libs/sprite-scaling/built/debug/binary.js +6887 -6887
  31. package/libs/storyboard/built/debug/binary.js +6887 -6887
  32. package/package.json +1 -1
  33. package/libs/mixer/instrument.ts +0 -776
  34. package/libs/mixer/sequencer.ts +0 -88
@@ -1,88 +0,0 @@
1
- namespace music.sequencer {
2
- export class Sequencer {
3
- currentTick: number;
4
- isPlaying: boolean;
5
- isLooping: boolean;
6
- isRunning: boolean;
7
-
8
- constructor(public song: Song) {
9
- this.currentTick = 0;
10
- this.isPlaying = false;
11
- this.isLooping = false;
12
- }
13
-
14
- start(loop: boolean) {
15
- this.currentTick = 0;
16
- this.isLooping = loop;
17
- this.isPlaying = true;
18
-
19
- if (this.isRunning) return;
20
- this.isRunning = true;
21
-
22
- control.runInParallel(() => {
23
- while (this.isPlaying) {
24
- this.scheduleCurrentTick();
25
-
26
- this.currentTick ++;
27
-
28
- if (this.currentTick >= this.song.beatsPerMeasure * this.song.measures * this.song.ticksPerBeat) {
29
- if (this.isLooping) this.currentTick = 0;
30
- else this.isPlaying = false;
31
- }
32
-
33
- pause(this.tickToMs(1))
34
- }
35
- this.isRunning = false;
36
- })
37
- }
38
-
39
- stop() {
40
- this.isPlaying = false;
41
- }
42
-
43
- tickToMs(ticks: number) {
44
- return ((60000 / this.song.beatsPerMinute) / this.song.ticksPerBeat) * ticks;
45
- }
46
-
47
- protected scheduleCurrentTick() {
48
- for (const track of this.song.tracks) {
49
- if (track.currentNoteEvent.startTick === this.currentTick) {
50
- if (track.isMelodicTrack) {
51
- this.scheduleMelodicTrack(track as MelodicTrack);
52
- }
53
- else {
54
- this.scheduleDrumTrack(track as DrumTrack);
55
- }
56
-
57
- track.advanceNoteEvent();
58
- }
59
- }
60
- }
61
-
62
- protected scheduleMelodicTrack(track: MelodicTrack) {
63
- for (let i = 0; i < track.currentNoteEvent.polyphony; i++) {
64
- playInstructions(
65
- 0,
66
- renderInstrument(
67
- track.instrument,
68
- lookupFrequency(track.currentNoteEvent.getNote(i)),
69
- this.tickToMs(track.currentNoteEvent.endTick - track.currentNoteEvent.startTick),
70
- music.volume()
71
- )
72
- );
73
- }
74
- }
75
-
76
- protected scheduleDrumTrack(track: DrumTrack) {
77
- for (let i = 0; i < track.currentNoteEvent.polyphony; i++) {
78
- playInstructions(
79
- 0,
80
- renderDrumInstrument(
81
- track.drums[track.currentNoteEvent.getNote(i)],
82
- music.volume()
83
- )
84
- );
85
- }
86
- }
87
- }
88
- }