@@ -13,6 +13,7 @@ inductive ParseResult (a : Type) where
1313| parsed : a → ParseResult a
1414| throw : String → ParseResult a
1515deriving Repr, BEq
16+ open ParseResult (throw)
1617
1718instance : Monad ParseResult where
1819 pure := ParseResult.parsed
@@ -39,16 +40,14 @@ deriving Repr, BEq, Hashable
3940
4041namespace EffectLabel
4142
42- open ParseResult
43-
4443 def ofUInt8 : UInt8 → ParseResult EffectLabel
45- | 0 => parsed OFF
46- | 1 => parsed DLY
47- | 2 => parsed RVB
48- | 3 => parsed DST
49- | 4 => parsed CXO
50- | 5 => parsed FLT
51- | 6 => parsed CMP
44+ | 0 => pure OFF
45+ | 1 => pure DLY
46+ | 2 => pure RVB
47+ | 3 => pure DST
48+ | 4 => pure CXO
49+ | 5 => pure FLT
50+ | 6 => pure CMP
5251 | i => throw $ "Effect " ++ toString i ++ " is not defined."
5352
5453end EffectLabel
@@ -111,6 +110,88 @@ structure Scenes where
111110deriving Repr, BEq
112111
113112
113+ inductive TimeStretch where
114+ | OFF
115+ | BPM
116+ | BARS
117+ deriving Repr, BEq
118+
119+ namespace TimeStretch
120+
121+ def ofUInt8 : UInt8 → ParseResult TimeStretch
122+ | 0 => pure OFF
123+ | 1 => pure BPM
124+ | 2 => pure BARS
125+ | i => throw $ "Time stretch " ++ toString i ++ " is not defined."
126+
127+ end TimeStretch
128+
129+
130+ inductive TimeStretchBars where
131+ | WHOLE
132+ | DOUBLE
133+ | QUADRUPLE
134+ | HALF
135+ | QUARTER
136+ deriving Repr, BEq
137+
138+ namespace TimeStretchBars
139+
140+ def ofUInt8 : UInt8 → ParseResult TimeStretchBars
141+ | 0 => pure WHOLE
142+ | 1 => pure DOUBLE
143+ | 2 => pure QUADRUPLE
144+ | 255 => pure HALF
145+ | 254 => pure QUARTER
146+ | i => throw $ "Time stretch bars " ++ toString i ++ " is not defined."
147+
148+ end TimeStretchBars
149+
150+
151+ inductive PlayMode where
152+ | ONE
153+ | KEY
154+ | LEG
155+ deriving Repr, BEq
156+
157+ namespace PlayMode
158+
159+ def ofUInt8 : UInt8 → ParseResult PlayMode
160+ | 0 => pure ONE
161+ | 1 => pure KEY
162+ | 2 => pure LEG
163+ | i => throw $ "Play mode " ++ toString i ++ " is not defined."
164+
165+ end PlayMode
166+
167+
168+ inductive ChokeGroup where
169+ | TRUE
170+ | FALSE
171+ deriving Repr, BEq
172+
173+ namespace ChokeGroup
174+
175+ def ofUInt8 : UInt8 → ParseResult ChokeGroup
176+ | 0 => pure TRUE
177+ | 1 => pure FALSE
178+ | i => throw $ "Choke group " ++ toString i ++ " is not defined."
179+
180+ end ChokeGroup
181+
182+
183+ def Volume := Fin 201
184+ deriving Repr, BEq
185+
186+
187+ def Attack := UInt8
188+ deriving Repr, BEq
189+
190+
191+ def Release := UInt8
192+ deriving Repr, BEq
193+
194+
114195structure Project where
115196 pads : ByteArray
116197 scenes : ByteArray
0 commit comments