Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | import { Type, Static } from "@sinclair/typebox"; import { Value } from "@sinclair/typebox/value"; export const PatternCell = Type.Object({ note: Type.Union([Type.Number(), Type.Null()]), instrument: Type.Union([Type.Number(), Type.Null()]), effectCode: Type.Union([Type.Number(), Type.Null()]), effectParam: Type.Union([Type.Number(), Type.Null()]), }); export type PatternCell = Static<typeof PatternCell>; export const Pattern = Type.Tuple([ PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, PatternCell, ]); export type Pattern = Static<typeof Pattern>; export const SequenceItem = Type.Object({ splitPattern: Type.Boolean(), channels: Type.Tuple([ Type.Number(), Type.Number(), Type.Number(), Type.Number(), ]), }); export type SequenceItem = Static<typeof SequenceItem>; export const SubPatternCell = Type.Object({ note: Type.Union([Type.Number(), Type.Null()]), jump: Type.Union([Type.Number(), Type.Null()]), effectCode: Type.Union([Type.Number(), Type.Null()]), effectParam: Type.Union([Type.Number(), Type.Null()]), }); export type SubPatternCell = Static<typeof SubPatternCell>; export const DutyInstrument = Type.Object({ index: Type.Number(), name: Type.String(), length: Type.Union([Type.Number(), Type.Null()]), dutyCycle: Type.Number(), initialVolume: Type.Number(), volumeSweepChange: Type.Number(), frequencySweepTime: Type.Number(), frequencySweepShift: Type.Number(), subpatternEnabled: Type.Boolean(), subpattern: Type.Array(SubPatternCell), }); export type DutyInstrument = Static<typeof DutyInstrument>; export const WaveInstrument = Type.Object({ index: Type.Number(), name: Type.String(), length: Type.Union([Type.Number(), Type.Null()]), volume: Type.Number(), waveIndex: Type.Number(), subpatternEnabled: Type.Boolean(), subpattern: Type.Array(SubPatternCell), }); export type WaveInstrument = Static<typeof WaveInstrument>; export const NoiseInstrument = Type.Object({ index: Type.Number(), name: Type.String(), length: Type.Union([Type.Number(), Type.Null()]), initialVolume: Type.Number(), volumeSweepChange: Type.Number(), bitCount: Type.Union([Type.Literal(7), Type.Literal(15)]), subpatternEnabled: Type.Boolean(), subpattern: Type.Array(SubPatternCell), }); export type NoiseInstrument = Static<typeof NoiseInstrument>; export const Song = Type.Object({ version: Type.Number(), name: Type.String(), artist: Type.String(), comment: Type.String(), filename: Type.String(), dutyInstruments: Type.Array(DutyInstrument), waveInstruments: Type.Array(WaveInstrument), noiseInstruments: Type.Array(NoiseInstrument), waves: Type.Array(Type.Uint8Array()), ticksPerRow: Type.Number(), timerEnabled: Type.Boolean(), timerDivider: Type.Number(), patterns: Type.Array(Pattern), sequence: Type.Array(SequenceItem), }); export type Song = Static<typeof Song>; export const isSong = (value: unknown): value is Song => { return Value.Check(Song, value); }; |