commit c26c27a730375a2c44cf9dceb445f68604df2193
parent 9c8ae9482561f1205530505f36b8747dad2c492f
Author: Bad Diode <bd@badd10de.dev>
Date: Thu, 19 Oct 2023 19:41:52 +0200
Add dei ports 0x2 and 0x4 to audio devices
Diffstat:
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/devices/audio.c b/src/devices/audio.c
@@ -303,3 +303,13 @@ audio_start(int idx, Uint8 *d, Uxn *u)
note_off(&channel[idx], duration);
}
}
+
+Uint8
+audio_get_vu(int instance) {
+ return channel[instance].sample.env.vol * 255.0f;
+}
+
+Uint16
+audio_get_position(int instance) {
+ return channel[instance].sample.pos;
+}
diff --git a/src/uxnemu.c b/src/uxnemu.c
@@ -70,10 +70,14 @@ clamp(int v, int min, int max)
static Uint8
audio_dei(int instance, Uint8 *d, Uint8 port)
{
- /* TODO: get envelope */
switch(port) {
- case 0x0:
case 0x2:
+ return audio_get_position(instance) >> 8;
+ case 0x3:
+ return audio_get_position(instance);
+ case 0x4:
+ return audio_get_vu(instance);
+ case 0x0:
case 0x8:
case 0xa:
case 0xc: return PEEK2(d + port);