implement pattern / song jumps

This commit is contained in:
Andy Sloane 2015-10-28 16:21:12 -07:00
commit 16167bc599
2 changed files with 21 additions and 7 deletions

View file

@ -14,9 +14,8 @@ todo:
- instrument fadeout
- missing XM effects (in rough order of priority):
- Rxy - retrigger
- Bxx / Dxx - position / pattern jumps
- 7xy - tremolo
- E3x, E4x, E5x, E6x, E7x, E9x, EDx, EEx
- 7xy - tremolo
- Gxx, Hxy, Kxx, Lxx, Pxy, Txy
- oscilloscopes
</pre>

25
xm.js
View file

@ -473,10 +473,25 @@ function eff_t0_a(ch, data) { // volume slide
}
}
function eff_t0_b(ch, data) { // song jump (untested)
if (data < songpats.length) {
cur_songpos = data
cur_pat = songpats[cur_songpos];
}
}
function eff_t0_c(ch, data) { // set volume
ch.vol = data & 0x3f;
}
function eff_t0_d(ch, data) { // pattern jump
cur_songpos++;
if (cur_songpos >= songpats.length)
cur_songpos = song_looppos;
cur_pat = songpats[cur_songpos];
cur_row = data;
}
function eff_t0_e(ch, data) { // extended effects!
var eff = data >> 4;
data = data & 0x0f;
@ -537,9 +552,9 @@ var effects_t0 = [ // effect functions on tick 0
eff_t0_8, // 8
eff_t0_9, // 9
eff_t0_a, // a
eff_unimplemented_t0, // b
eff_t0_b, // b
eff_t0_c, // c
eff_unimplemented_t0, // d
eff_t0_d, // d
eff_t0_e, // e
eff_t0_f, // f
];
@ -622,11 +637,11 @@ var effects_t1 = [ // effect functions on tick 1+
eff_nop, // 8
eff_nop, // 9
eff_t1_a, // a
eff_unimplemented, // b
eff_nop, // b
eff_nop, // c
eff_unimplemented, // d
eff_nop, // d
eff_t1_e, // e
eff_unimplemented, // f
eff_nop, // f
];
function ConvertSample(array, bits) {