diff --git a/src/devices/audio.c b/src/devices/audio.c index 19860f4..63d5162 100644 --- 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 index df3765b..74ef494 100644 --- 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);