Browse code

Add dei ports 0x2 and 0x4 to audio devices

Bad Diode authored on 19/10/2023 17:41:52 • neauoire committed on 03/11/2023 00:30:14
Showing 2 changed files
... ...
@@ -303,3 +303,13 @@ audio_start(int idx, Uint8 *d, Uxn *u)
303 303
         note_off(&channel[idx], duration);
304 304
     }
305 305
 }
306
+
307
+Uint8
308
+audio_get_vu(int instance) {
309
+    return channel[instance].sample.env.vol * 255.0f;
310
+}
311
+
312
+Uint16
313
+audio_get_position(int instance) {
314
+    return channel[instance].sample.pos;
315
+}
... ...
@@ -70,10 +70,14 @@ clamp(int v, int min, int max)
70 70
 static Uint8
71 71
 audio_dei(int instance, Uint8 *d, Uint8 port)
72 72
 {
73
-    /* TODO: get envelope */
74 73
     switch(port) {
75
-        case 0x0:
76 74
         case 0x2:
75
+            return audio_get_position(instance) >> 8;
76
+        case 0x3:
77
+            return audio_get_position(instance);
78
+        case 0x4:
79
+            return audio_get_vu(instance);
80
+        case 0x0:
77 81
         case 0x8:
78 82
         case 0xa:
79 83
         case 0xc: return PEEK2(d + port);