... | ... |
@@ -2,12 +2,19 @@ |
2 | 2 |
|
3 | 3 |
%RTN { JMP2r } |
4 | 4 |
%8+ { #0008 ADD2 } %8- { #0008 SUB2 } |
5 |
+%++ { #0001 ADD2 } |
|
5 | 6 |
%MOD { DUP2 DIV MUL SUB } |
6 | 7 |
|
7 | 8 |
( variables ) |
8 | 9 |
|
9 | 10 |
;pointer { x 2 y 2 } |
10 | 11 |
;color { byte 1 } |
12 |
+;rect { x1 2 y1 2 x2 2 y2 2 } |
|
13 |
+;frame { x1 2 y1 2 x2 2 y2 2 } |
|
14 |
+;label { x 2 y 2 color 1 addr 2 } |
|
15 |
+;knob { x 2 y 2 value 1 } |
|
16 |
+;head { pos 1 } |
|
17 |
+;track { ch1 20 ch2 20 ch3 20 ch4 20 } |
|
11 | 18 |
|
12 | 19 |
( devices ) |
13 | 20 |
|
... | ... |
@@ -28,15 +35,49 @@ |
28 | 35 |
|
29 | 36 |
@RESET |
30 | 37 |
|
31 |
- ( theme ) #f0fd =System.r #f0f3 =System.g #f0f2 =System.b |
|
38 |
+ ( theme ) #f0fd =System.r #f0c3 =System.g #f032 =System.b |
|
39 |
+ |
|
40 |
+ ~Screen.width #0002 DIV2 #0080 SUB2 =frame.x1 |
|
41 |
+ ~Screen.height #0002 DIV2 #0038 SUB2 =frame.y1 |
|
42 |
+ ~Screen.width #0002 DIV2 #0080 ADD2 =frame.x2 |
|
43 |
+ ~Screen.height #0002 DIV2 #0038 ADD2 =frame.y2 |
|
32 | 44 |
|
33 | 45 |
,draw-timeline JSR2 |
46 |
+ ,draw-controls JSR2 |
|
34 | 47 |
|
35 | 48 |
BRK |
36 | 49 |
|
37 | 50 |
@FRAME |
38 |
- |
|
51 |
+ |
|
39 | 52 |
,draw-cursor JSR2 |
53 |
+ ,move-head JSR2 |
|
54 |
+ |
|
55 |
+ ~head.pos #08 MOD #00 NEQ ^$skip JNZ |
|
56 |
+ ,bang JSR2 |
|
57 |
+ ,draw-position JSR2 |
|
58 |
+ $skip |
|
59 |
+ |
|
60 |
+ |
|
61 |
+ ~Mouse.state #00 EQU ,$click-end JNZ2 |
|
62 |
+ |
|
63 |
+ ~Mouse.x ~frame.x1 GTH2 ~Mouse.x ~frame.x2 LTH2 #0101 EQU2 |
|
64 |
+ ~Mouse.y ~frame.y1 GTH2 ~Mouse.y ~frame.y2 LTH2 #0101 EQU2 |
|
65 |
+ #0101 NEQ2 ,$no-track-click JNZ2 |
|
66 |
+ ,clear-notes JSR2 |
|
67 |
+ ( get note ) |
|
68 |
+ #0e ~Mouse.y ~frame.y1 SUB2 SWP POP #08 DIV SUB |
|
69 |
+ ~Mouse.state #10 NEQ ^$no-erase JNZ |
|
70 |
+ POP #00 |
|
71 |
+ $no-erase |
|
72 |
+ ( get track ) |
|
73 |
+ ,track.ch1 #00 ~Mouse.x ~frame.x1 SUB2 SWP POP #08 DIV ADD2 |
|
74 |
+ POK2 |
|
75 |
+ ( release ) #00 =Mouse.state |
|
76 |
+ ,draw-notes JSR2 |
|
77 |
+ ,draw-bars JSR2 |
|
78 |
+ $no-track-click |
|
79 |
+ |
|
80 |
+ $click-end |
|
40 | 81 |
|
41 | 82 |
BRK |
42 | 83 |
|
... | ... |
@@ -44,25 +85,92 @@ BRK |
44 | 85 |
|
45 | 86 |
BRK |
46 | 87 |
|
88 |
+@bang ( -- ) |
|
89 |
+ ( |
|
90 |
+ ~head.pos #08 DIV =Console.byte |
|
91 |
+ ,track.ch1 #00 ~head.pos #08 DIV ADD2 PEK2 =Console.byte |
|
92 |
+ ) |
|
93 |
+ |
|
94 |
+RTN |
|
95 |
+ |
|
96 |
+@move-head ( -- ) |
|
97 |
+ |
|
98 |
+ ( clear ) |
|
99 |
+ ~frame.y1 #0008 SUB2 =Sprite.y |
|
100 |
+ ~frame.x1 #00 ~head.pos ADD2 =Sprite.x |
|
101 |
+ ,head_icn =Sprite.addr |
|
102 |
+ #00 =Sprite.color |
|
103 |
+ ( incr ) ~head.pos #01 ADD =head.pos |
|
104 |
+ ( draw ) |
|
105 |
+ ~frame.x1 #00 ~head.pos ADD2 =Sprite.x |
|
106 |
+ ,head_icn =Sprite.addr |
|
107 |
+ #01 =Sprite.color |
|
108 |
+ |
|
109 |
+RTN |
|
110 |
+ |
|
111 |
+@draw-position ( -- ) |
|
112 |
+ |
|
113 |
+ ~frame.x2 #0008 SUB2 =Sprite.x |
|
114 |
+ ~frame.y1 #0010 SUB2 =Sprite.y |
|
115 |
+ ,font_hex #00 ~head.pos #10 DIV #0008 MUL2 ADD2 =Sprite.addr |
|
116 |
+ #01 =Sprite.color |
|
117 |
+ |
|
118 |
+RTN |
|
119 |
+ |
|
120 |
+@clear-notes ( -- ) |
|
121 |
+ |
|
122 |
+ #00 #20 |
|
123 |
+ $loop |
|
124 |
+ ( load ) OVR #00 SWP ,track.ch1 ADD2 PEK2 |
|
125 |
+ #00 SWP #0e SWP SUB #0008 MUL2 ~frame.y1 ADD2 =Sprite.y |
|
126 |
+ OVR #00 SWP #0008 MUL2 ~frame.x1 ADD2 =Sprite.x |
|
127 |
+ #00 =Sprite.color |
|
128 |
+ ( incr ) SWP #01 ADD SWP |
|
129 |
+ DUP2 LTH ^$loop JNZ |
|
130 |
+ POP2 |
|
131 |
+ |
|
132 |
+RTN |
|
133 |
+ |
|
134 |
+@draw-notes ( -- ) |
|
135 |
+ |
|
136 |
+ #00 #20 |
|
137 |
+ $notes-loop |
|
138 |
+ ( load ) OVR #00 SWP ,track.ch1 ADD2 PEK2 |
|
139 |
+ DUP STH #00 SWP #0e SWP SUB #0008 MUL2 ~frame.y1 ADD2 =Sprite.y |
|
140 |
+ OVR #00 SWP #0008 MUL2 ~frame.x1 ADD2 =Sprite.x |
|
141 |
+ ,note2_icn =Sprite.addr |
|
142 |
+ #01 STHr #00 EQU SUB =Sprite.color |
|
143 |
+ ( incr ) SWP #01 ADD SWP |
|
144 |
+ DUP2 LTH ^$notes-loop JNZ |
|
145 |
+ POP2 |
|
146 |
+ |
|
147 |
+RTN |
|
148 |
+ |
|
47 | 149 |
@draw-bars ( -- ) |
48 | 150 |
|
151 |
+ ( draw notes ) |
|
152 |
+ |
|
153 |
+ ~frame.x1 ~frame.y1 ~frame.x2 ~frame.y2 #01 ,line-rect JSR2 |
|
49 | 154 |
|
50 |
- #0040 =Sprite.y |
|
155 |
+ ( grid ) |
|
156 |
+ ~frame.y1 #0010 SUB2 =Sprite.y |
|
51 | 157 |
,font_hex =Sprite.addr |
52 | 158 |
#0000 #0100 |
53 | 159 |
$loop |
54 | 160 |
OVR2 SWP POP #02 DIV #0f AND #00 NEQ ^$skip JNZ |
55 |
- OVR2 #0060 ADD2 =Sprite.x |
|
161 |
+ OVR2 ~frame.x1 ADD2 =Sprite.x |
|
56 | 162 |
#01 =Sprite.color |
57 | 163 |
~Sprite.addr 8+ =Sprite.addr |
58 |
- OVR2 #0060 ADD2 #0051 #00c1 #01 ,line-vertical-dotted JSR2 |
|
164 |
+ OVR2 ~frame.x1 ADD2 ~frame.y1 #0001 ADD2 ~frame.y2 #01 ,line-vertical-dotted JSR2 |
|
59 | 165 |
$skip |
60 |
- OVR2 #0060 ADD2 #0050 #00c0 #01 ,line-vertical-dotted JSR2 |
|
166 |
+ OVR2 ~frame.x1 ADD2 ~frame.y1 ~frame.y2 #01 ,line-vertical-dotted JSR2 |
|
61 | 167 |
SWP2 #0008 ADD2 SWP2 |
62 | 168 |
OVR2 OVR2 LTH2 ^$loop JNZ |
63 | 169 |
POP2 |
64 | 170 |
POP2 |
65 | 171 |
|
172 |
+ ~frame.x1 ~frame.x2 ~frame.y1 #0008 SUB2 #0040 ADD2 #01 ,line-horizontal-dotted JSR2 |
|
173 |
+ |
|
66 | 174 |
RTN |
67 | 175 |
|
68 | 176 |
@draw-octave ( x y -- ) |
... | ... |
@@ -85,28 +193,25 @@ RTN |
85 | 193 |
POP2 |
86 | 194 |
POP2 |
87 | 195 |
|
88 |
- |
|
89 | 196 |
RTN |
90 | 197 |
|
91 | 198 |
@draw-octaves ( -- ) |
92 | 199 |
|
93 |
- #0040 #0050 ,draw-octave JSR2 |
|
94 |
- #0040 #0088 ,draw-octave JSR2 |
|
95 |
- |
|
96 |
- #0028 =Sprite.x |
|
97 |
- #0080 =Sprite.y |
|
200 |
+ ~frame.x1 #0018 SUB2 ~frame.y1 ,draw-octave JSR2 |
|
201 |
+ ~frame.x1 #0018 SUB2 ~frame.y1 #0038 ADD2 ,draw-octave JSR2 |
|
202 |
+ ~frame.x1 #0028 SUB2 =Sprite.x |
|
203 |
+ ~frame.y1 =Sprite.y |
|
98 | 204 |
,font_hex #0060 ADD2 =Sprite.addr |
99 | 205 |
#01 =Sprite.color |
100 |
- #0030 =Sprite.x |
|
101 |
- ,font_hex #0018 ADD2 =Sprite.addr |
|
206 |
+ ~frame.x1 #0030 SUB2 =Sprite.x |
|
207 |
+ ,font_hex #0020 ADD2 =Sprite.addr |
|
102 | 208 |
#01 =Sprite.color |
103 |
- |
|
104 |
- #0028 =Sprite.x |
|
105 |
- #00b8 =Sprite.y |
|
209 |
+ ~frame.x1 #0028 SUB2 =Sprite.x |
|
210 |
+ ~frame.y1 #0038 ADD2 =Sprite.y |
|
106 | 211 |
,font_hex #0060 ADD2 =Sprite.addr |
107 | 212 |
#01 =Sprite.color |
108 |
- #0030 =Sprite.x |
|
109 |
- ,font_hex #0010 ADD2 =Sprite.addr |
|
213 |
+ ~frame.x1 #0030 SUB2 =Sprite.x |
|
214 |
+ ,font_hex #0018 ADD2 =Sprite.addr |
|
110 | 215 |
#01 =Sprite.color |
111 | 216 |
|
112 | 217 |
RTN |
... | ... |
@@ -118,14 +223,55 @@ RTN |
118 | 223 |
|
119 | 224 |
RTN |
120 | 225 |
|
121 |
-@line-vertical-dotted ( x y0 y1 color -- ) |
|
226 |
+@draw-knob ( x* y* value -- ) |
|
122 | 227 |
|
123 |
- =color STH2 SWP2 =Screen.x STH2r OVR2 =Screen.y |
|
124 |
- $draw-ver |
|
125 |
- ( draw ) ~color =Screen.color |
|
126 |
- ( incr ) SWP2 #0002 ADD2 DUP2 =Screen.y SWP2 |
|
127 |
- OVR2 OVR2 LTH2 ^$draw-ver JNZ |
|
128 |
- POP2 POP2 |
|
228 |
+ =knob.value |
|
229 |
+ =knob.y |
|
230 |
+ =knob.x |
|
231 |
+ |
|
232 |
+ ~knob.x =Sprite.x |
|
233 |
+ ~knob.y =Sprite.y |
|
234 |
+ ,knob_icns =Sprite.addr |
|
235 |
+ #01 =Sprite.color |
|
236 |
+ |
|
237 |
+ ~knob.x 8+ =Sprite.x |
|
238 |
+ ,knob_icns 8+ =Sprite.addr |
|
239 |
+ #01 =Sprite.color |
|
240 |
+ |
|
241 |
+ ~knob.y 8+ =Sprite.y |
|
242 |
+ ,knob_icns #0018 ADD2 =Sprite.addr |
|
243 |
+ #01 =Sprite.color |
|
244 |
+ |
|
245 |
+ ~knob.x =Sprite.x |
|
246 |
+ ,knob_icns #0010 ADD2 =Sprite.addr |
|
247 |
+ #01 =Sprite.color |
|
248 |
+ |
|
249 |
+ ~knob.x #0004 ADD2 =Sprite.x |
|
250 |
+ ~knob.y #0001 ADD2 =Sprite.y |
|
251 |
+ ,knob_icns #0020 ADD2 =Sprite.addr |
|
252 |
+ #05 =Sprite.color |
|
253 |
+ |
|
254 |
+ ~knob.x #0004 ADD2 =Sprite.x |
|
255 |
+ ~knob.y #0010 ADD2 =Sprite.y |
|
256 |
+ ,font_hex #00 ~knob.value #08 MUL ADD2 =Sprite.addr |
|
257 |
+ #01 =Sprite.color |
|
258 |
+ |
|
259 |
+RTN |
|
260 |
+ |
|
261 |
+@draw-controls ( -- ) |
|
262 |
+ |
|
263 |
+ ~frame.x1 #0000 ADD2 ~frame.y2 #0008 ADD2 #01 ,ch1_txt ,draw-label JSR2 |
|
264 |
+ ~frame.x1 #0000 ADD2 ~frame.y2 #0010 ADD2 #01 ,env_txt ,draw-label JSR2 |
|
265 |
+ |
|
266 |
+ ~frame.x1 #0000 ADD2 ~frame.y2 #0020 ADD2 #00 ,draw-knob JSR2 |
|
267 |
+ ~frame.x1 #0010 ADD2 ~frame.y2 #0020 ADD2 #02 ,draw-knob JSR2 |
|
268 |
+ ~frame.x1 #0020 ADD2 ~frame.y2 #0020 ADD2 #0a ,draw-knob JSR2 |
|
269 |
+ ~frame.x1 #0030 ADD2 ~frame.y2 #0020 ADD2 #0c ,draw-knob JSR2 |
|
270 |
+ |
|
271 |
+ ~frame.x1 #0050 ADD2 ~frame.y2 #0010 ADD2 #01 ,vol_txt ,draw-label JSR2 |
|
272 |
+ |
|
273 |
+ ~frame.x1 #0050 ADD2 ~frame.y2 #0020 ADD2 #00 ,draw-knob JSR2 |
|
274 |
+ ~frame.x1 #0060 ADD2 ~frame.y2 #0020 ADD2 #0f ,draw-knob JSR2 |
|
129 | 275 |
|
130 | 276 |
RTN |
131 | 277 |
|
... | ... |
@@ -148,9 +294,84 @@ RTN |
148 | 294 |
|
149 | 295 |
RTN |
150 | 296 |
|
297 |
+( generics ) |
|
298 |
+ |
|
299 |
+@draw-label ( x y color addr -- ) |
|
300 |
+ |
|
301 |
+ ( load ) =label.addr =label.color =Sprite.y =Sprite.x |
|
302 |
+ ~label.addr |
|
303 |
+ $loop |
|
304 |
+ ( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color |
|
305 |
+ ( incr ) #0001 ADD2 |
|
306 |
+ ( incr ) ~Sprite.x #0008 ADD2 =Sprite.x |
|
307 |
+ DUP2 PEK2 #00 NEQ ^$loop JNZ |
|
308 |
+ POP2 |
|
309 |
+ |
|
310 |
+RTN |
|
311 |
+ |
|
312 |
+@line-vertical-dotted ( x y0 y1 color -- ) |
|
313 |
+ |
|
314 |
+ =color STH2 SWP2 =Screen.x STH2r OVR2 =Screen.y |
|
315 |
+ $draw-ver |
|
316 |
+ ( draw ) ~color =Screen.color |
|
317 |
+ ( incr ) SWP2 #0002 ADD2 DUP2 =Screen.y SWP2 |
|
318 |
+ OVR2 OVR2 LTH2 ^$draw-ver JNZ |
|
319 |
+ POP2 POP2 |
|
320 |
+ |
|
321 |
+RTN |
|
322 |
+ |
|
323 |
+@line-horizontal-dotted ( x0 x1 y color -- ) |
|
324 |
+ |
|
325 |
+ =color =Screen.y OVR2 =Screen.x |
|
326 |
+ $draw-hor |
|
327 |
+ ( draw ) ~color =Screen.color |
|
328 |
+ ( incr ) SWP2 #0002 ADD2 DUP2 =Screen.x SWP2 |
|
329 |
+ OVR2 OVR2 LTH2 ^$draw-hor JNZ |
|
330 |
+ POP2 POP2 |
|
331 |
+ |
|
332 |
+RTN |
|
333 |
+ |
|
334 |
+@line-rect ( x1 y1 x2 y2 color ) |
|
335 |
+ |
|
336 |
+ ( load ) =color =rect.y2 =rect.x2 DUP2 =Screen.y =rect.y1 DUP2 =Screen.x =rect.x1 |
|
337 |
+ $hor |
|
338 |
+ ( incr ) ~Screen.x ++ =Screen.x |
|
339 |
+ ( draw ) ~rect.y1 =Screen.y ~color =Screen.color |
|
340 |
+ ( draw ) ~rect.y2 =Screen.y ~color =Screen.color |
|
341 |
+ ~Screen.x ~rect.x2 LTH2 ^$hor JNZ |
|
342 |
+ ~rect.y1 =Screen.y |
|
343 |
+ $ver |
|
344 |
+ ( draw ) ~rect.x1 =Screen.x ~color =Screen.color |
|
345 |
+ ( draw ) ~rect.x2 =Screen.x ~color =Screen.color |
|
346 |
+ ( incr ) ~Screen.y ++ =Screen.y |
|
347 |
+ ~Screen.y ~rect.y2 ++ LTH2 ^$ver JNZ |
|
348 |
+ |
|
349 |
+RTN |
|
350 |
+ |
|
151 | 351 |
@clear_icn [ 0000 0000 0000 0000 ] |
152 | 352 |
@cursor_icn [ 80c0 e0f0 f8e0 1000 ] |
153 | 353 |
|
354 |
+@note1_icn [ 0000 1c22 2222 1c00 ] |
|
355 |
+@note2_icn [ 0000 1c3e 3e3e 1c00 ] |
|
356 |
+@head_icn [ 0018 1818 7e3c 1800 ] |
|
357 |
+ |
|
358 |
+@ch1_txt [ Channel1 00 ] |
|
359 |
+@env_txt [ Enveloppe 00 ] |
|
360 |
+@vol_txt [ Volume 00 ] |
|
361 |
+ |
|
362 |
+@notes [ |
|
363 |
+ 60 61 62 63 64 65 66 |
|
364 |
+ 67 68 69 6a 6b 6c 6d |
|
365 |
+] |
|
366 |
+ |
|
367 |
+@knob_icns [ |
|
368 |
+ 0003 0c10 2020 4040 |
|
369 |
+ 00c0 3008 0404 0202 |
|
370 |
+ 4040 2020 100c 0300 |
|
371 |
+ 0202 0404 0830 c000 |
|
372 |
+ 0000 183c 3c18 0000 |
|
373 |
+] |
|
374 |
+ |
|
154 | 375 |
@piano-white [ |
155 | 376 |
ffc0 8080 80c0 ff00 |
156 | 377 |
fc02 0202 0202 fc00 |
... | ... |
@@ -189,3 +410,39 @@ RTN |
189 | 410 |
007c 8280 8080 827c 00fc 8282 8282 82fc |
190 | 411 |
007c 8280 f080 827c 007c 8280 f080 8080 |
191 | 412 |
] |
413 |
+ |
|
414 |
+@font ( spectrum-zx font ) |
|
415 |
+[ |
|
416 |
+ 0000 0000 0000 0000 0000 2400 7e3c 0000 0000 2400 3c42 0000 0000 6c7c 7c38 1000 |
|
417 |
+ 0010 387c 7c38 1000 0038 387c 6c10 3800 0010 387c 7c10 3800 0000 0018 1800 0000 |
|
418 |
+ 007e 4242 4242 7e00 0000 1824 2418 0000 0018 2442 4224 1800 001e 063a 4a48 3000 |
|
419 |
+ 0038 446c 107c 1000 000c 0808 0838 3800 003e 2222 2266 6600 0000 0822 0022 0800 |
|
420 |
+ 0000 1018 1c18 1000 0000 0818 3818 0800 0008 1c00 001c 0800 0028 2828 2800 2800 |
|
421 |
+ 003e 4a4a 3a0a 0a00 000c 3046 620c 3000 0000 0000 0000 ffff 0010 3800 3810 0038 |
|
422 |
+ 0008 1c2a 0808 0800 0008 0808 2a1c 0800 0000 0804 7e04 0800 0000 1020 7e20 1000 |
|
423 |
+ 0000 4040 7e00 0000 0000 0024 6624 0000 0000 1038 7c00 0000 0000 007c 3810 0000 |
|
424 |
+ 0000 0000 0000 0000 0008 0808 0800 0800 0014 1400 0000 0000 0024 7e24 247e 2400 |
|
425 |
+ 0008 1e28 1c0a 3c08 0042 0408 1020 4200 0030 4832 4c44 3a00 0008 1000 0000 0000 |
|
426 |
+ 0004 0808 0808 0400 0010 0808 0808 1000 0000 1408 3e08 1400 0000 0808 3e08 0800 |
|
427 |
+ 0000 0000 0008 0810 0000 0000 3c00 0000 0000 0000 0000 0800 0000 0204 0810 2000 |
|
428 |
+ 003c 464a 5262 3c00 0018 2808 0808 3e00 003c 4202 3c40 7e00 003c 421c 0242 3c00 |
|
429 |
+ 0008 1828 487e 0800 007e 407c 0242 3c00 003c 407c 4242 3c00 007e 0204 0810 1000 |
|
430 |
+ 003c 423c 4242 3c00 003c 4242 3e02 3c00 0000 0008 0000 0800 0000 0800 0008 0810 |
|
431 |
+ 0000 0810 2010 0800 0000 003e 003e 0000 0000 1008 0408 1000 003c 4202 0c00 0800 |
|
432 |
+ 003c 425a 5442 3c00 0018 2442 7e42 4200 007c 427c 4242 7c00 003c 4240 4042 3c00 |
|
433 |
+ 0078 4442 4244 7800 007e 407c 4040 7e00 003e 4040 7c40 4000 003c 4240 4e42 3c00 |
|
434 |
+ 0042 427e 4242 4200 003e 0808 0808 3e00 0002 0202 4242 3c00 0044 4870 4844 4200 |
|
435 |
+ 0040 4040 4040 7e00 0042 665a 4242 4200 0042 6252 4a46 4200 003c 4242 4242 3c00 |
|
436 |
+ 007c 4242 7c40 4000 003c 4242 524a 3c00 007c 4242 7c44 4200 003c 403c 0242 3c00 |
|
437 |
+ 00fe 1010 1010 1000 0042 4242 4242 3c00 0042 4242 4224 1800 0042 4242 5a66 4200 |
|
438 |
+ 0042 2418 1824 4200 0082 4428 1010 1000 007e 0408 1020 7e00 000c 0808 0808 0c00 |
|
439 |
+ 0040 2010 0804 0200 0018 0808 0808 1800 0008 1422 0000 0000 0000 0000 0000 7e00 |
|
440 |
+ 0008 0400 0000 0000 0000 1c02 1e22 1e00 0020 203c 2222 3c00 0000 1e20 2020 1e00 |
|
441 |
+ 0002 021e 2222 1e00 0000 1c22 3c20 1e00 000c 101c 1010 1000 0000 1c22 221e 021c |
|
442 |
+ 0020 202c 3222 2200 0008 0018 0808 0400 0008 0008 0808 4830 0020 2428 3028 2400 |
|
443 |
+ 0010 1010 1010 0c00 0000 6854 5454 5400 0000 5864 4444 4400 0000 3844 4444 3800 |
|
444 |
+ 0000 7844 4478 4040 0000 3c44 443c 0406 0000 2c30 2020 2000 0000 3840 3804 7800 |
|
445 |
+ 0010 103c 1010 0c00 0000 4444 4444 3800 0000 4444 2828 1000 0000 4454 5454 2800 |
|
446 |
+ 0000 4428 1028 4400 0000 4444 443c 0438 0000 7c08 1020 7c00 000c 0810 1008 0c00 |
|
447 |
+ 0008 0808 0808 0800 0030 1008 0810 3000 0000 0032 4c00 0000 3c42 99a1 a199 423c |
|
448 |
+] |
|
192 | 449 |
\ No newline at end of file |
... | ... |
@@ -15,7 +15,7 @@ WITH REGARD TO THIS SOFTWARE. |
15 | 15 |
|
16 | 16 |
#include "uxn.h" |
17 | 17 |
|
18 |
-#define HOR 64 |
|
18 |
+#define HOR 48 |
|
19 | 19 |
#define VER 32 |
20 | 20 |
#define PAD 2 |
21 | 21 |
#define RES (HOR * VER * 16) |
... | ... |
@@ -64,7 +64,7 @@ static Uint32 note_periods[12] = { |
64 | 64 |
(Uint32)0x9dcd * SAMPLE_FREQUENCY, |
65 | 65 |
(Uint32)0x94f2 * SAMPLE_FREQUENCY, /* A-1 */ |
66 | 66 |
(Uint32)0x8c95 * SAMPLE_FREQUENCY, |
67 |
- (Uint32)0x84b2 * SAMPLE_FREQUENCY /* B-1 */ |
|
67 |
+ (Uint32)0x84b2 * SAMPLE_FREQUENCY /* B-1 */ |
|
68 | 68 |
}; |
69 | 69 |
|
70 | 70 |
typedef struct audio_channel { |
... | ... |
@@ -240,32 +240,34 @@ togglezoom(Uxn *u) |
240 | 240 |
} |
241 | 241 |
|
242 | 242 |
Sint16 |
243 |
-audio_envelope(Channel *c) { |
|
244 |
- if (c->age < c->a) |
|
243 |
+audio_envelope(Channel *c) |
|
244 |
+{ |
|
245 |
+ if(c->age < c->a) |
|
245 | 246 |
return 0x0888 * c->age / c->a; |
246 |
- else if (c->age < c->d) |
|
247 |
+ else if(c->age < c->d) |
|
247 | 248 |
return 0x0444 * (2 * c->d - c->a - c->age) / (c->d - c->a); |
248 |
- else if (c->age < c->s) |
|
249 |
+ else if(c->age < c->s) |
|
249 | 250 |
return 0x0444; |
250 |
- else if (c->age < c->r) |
|
251 |
+ else if(c->age < c->r) |
|
251 | 252 |
return 0x0444 * (c->r - c->age) / (c->r - c->s); |
252 | 253 |
else |
253 | 254 |
return 0x0000; |
254 | 255 |
} |
255 | 256 |
|
256 | 257 |
void |
257 |
-audio_callback(void* userdata, Uint8* stream, int len) { |
|
258 |
- Sint16 *samples = (Sint16 *) stream; |
|
258 |
+audio_callback(void *userdata, Uint8 *stream, int len) |
|
259 |
+{ |
|
260 |
+ Sint16 *samples = (Sint16 *)stream; |
|
259 | 261 |
int i, j; |
260 | 262 |
len >>= 2; /* use len for number of samples, not bytes */ |
261 |
- for (j = len * 2 - 1; j >= 0; --j) samples[j] = 0; |
|
262 |
- for (i = 0; i < 4; ++i) { |
|
263 |
+ for(j = len * 2 - 1; j >= 0; --j) samples[j] = 0; |
|
264 |
+ for(i = 0; i < 4; ++i) { |
|
263 | 265 |
Channel *c = &channels[i]; |
264 |
- if (c->period < (1 << 20)) continue; |
|
265 |
- for (j = 0; j < len; ++j) { |
|
266 |
+ if(c->period < (1 << 20)) continue; |
|
267 |
+ for(j = 0; j < len; ++j) { |
|
266 | 268 |
c->age += 1; |
267 | 269 |
c->count += 1 << 20; |
268 |
- while (c->count > c->period) { |
|
270 |
+ while(c->count > c->period) { |
|
269 | 271 |
Sint16 mul; |
270 | 272 |
c->count -= c->period; |
271 | 273 |
c->phase = !c->phase; |
... | ... |
@@ -277,13 +279,14 @@ audio_callback(void* userdata, Uint8* stream, int len) { |
277 | 279 |
samples[j * 2 + 1] += c->value[1]; |
278 | 280 |
} |
279 | 281 |
} |
280 |
- (void) userdata; |
|
282 |
+ (void)userdata; |
|
281 | 283 |
} |
282 | 284 |
|
283 | 285 |
void |
284 |
-silence(void) { |
|
286 |
+silence(void) |
|
287 |
+{ |
|
285 | 288 |
int i; |
286 |
- for (i = 0; i < 4; ++i) { |
|
289 |
+ for(i = 0; i < 4; ++i) { |
|
287 | 290 |
Channel *c = &channels[i]; |
288 | 291 |
c->volume[0] = 0; |
289 | 292 |
c->volume[1] = 0; |
... | ... |
@@ -496,7 +499,7 @@ Uint8 |
496 | 499 |
audio_poke(Uxn *u, Uint16 ptr, Uint8 b0, Uint8 b1) |
497 | 500 |
{ |
498 | 501 |
Uint8 *m = u->ram.dat; |
499 |
- if (b0 & 1) { |
|
502 |
+ if(b0 & 1) { |
|
500 | 503 |
Uint16 addr = ptr + (b0 & 0x6); |
501 | 504 |
Channel *c = &channels[(b0 & 0x6) >> 1]; |
502 | 505 |
SDL_LockAudioDevice(audio_id); |