example/aica_xm: add vibrato effect

This commit is contained in:
Zack Buhman 2025-06-19 17:10:36 -05:00
parent b1fa6f1f50
commit 5acc19473f
2 changed files with 21 additions and 7 deletions

View File

@ -15,6 +15,7 @@ AICA_XM_OBJ = \
printf/parse.o \
xm/milkypack01.xm.o \
xm/test.xm.o \
xm/middle_c.xm.o \
$(LIBGCC)
example/aica/aica_xm.elf: LDSCRIPT = $(LIB)/main.lds

View File

@ -359,13 +359,19 @@ void _play_note(int ch, xm_pattern_format_t * pf)
int disdl = volume_table[sample_header->volume];
bool pcms = !sample_type;
/*
wait(); aica_sound.channel[ch].LFOF(0x12);
wait(); aica_sound.channel[ch].ALFOWS(2);
wait(); aica_sound.channel[ch].PLFOWS(2);
wait(); aica_sound.channel[ch].ALFOS(0);
wait(); aica_sound.channel[ch].PLFOS(5);
*/
if (pf->effect_type == 0x04) { // vibrato
wait(); aica_sound.channel[ch].LFOF(0x12);
wait(); aica_sound.channel[ch].ALFOWS(2);
wait(); aica_sound.channel[ch].PLFOWS(2);
wait(); aica_sound.channel[ch].ALFOS(0);
wait(); aica_sound.channel[ch].PLFOS(4);
} else {
//wait(); aica_sound.channel[ch].LFOF(0x11);
//wait(); aica_sound.channel[ch].ALFOWS(2);
//wait(); aica_sound.channel[ch].PLFOWS(2);
wait(); aica_sound.channel[ch].ALFOS(0);
wait(); aica_sound.channel[ch].PLFOS(0);
}
wait(); aica_sound.channel[ch].PCMS(pcms);
wait(); aica_sound.channel[ch].SA(start);
@ -382,6 +388,13 @@ void play_note_effect(interpreter_state& state, int ch, xm_pattern_format_t * pf
int effect_tick = (state.tick / 2) % state.ticks_per_line;
switch (pf->effect_type) {
case 0x04: // 4 vibrato
wait(); aica_sound.channel[ch].LFOF(0x12);
wait(); aica_sound.channel[ch].ALFOWS(2);
wait(); aica_sound.channel[ch].PLFOWS(2);
wait(); aica_sound.channel[ch].ALFOS(0);
wait(); aica_sound.channel[ch].PLFOS(4);
break;
case 0x0d: // D pattern break
state.pattern_break = pf->effect_parameter;
break;