Add dei ports 0x2 and 0x4 to audio devices

This commit is contained in:
Bad Diode 2023-10-19 19:41:52 +02:00 committed by neauoire
parent 9c8ae94825
commit c26c27a730
2 changed files with 16 additions and 2 deletions

View File

@ -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;
}

View File

@ -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);