various envelope/effect fixes
Dubmood's .xms seem to expose a lot of bugs...
This commit is contained in:
parent
837e302796
commit
32b09bdf63
1 changed files with 11 additions and 8 deletions
19
xm.js
19
xm.js
|
|
@ -309,8 +309,8 @@ function next_row() {
|
||||||
// alone
|
// alone
|
||||||
ch.envtick = 0;
|
ch.envtick = 0;
|
||||||
ch.release = 0;
|
ch.release = 0;
|
||||||
ch.env_vol = new EnvelopeFollower(inst.env_vol, inst.fadeout);
|
ch.env_vol = new EnvelopeFollower(inst.env_vol);
|
||||||
ch.env_pan = new EnvelopeFollower(inst.env_pan, 0);
|
ch.env_pan = new EnvelopeFollower(inst.env_pan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -691,7 +691,7 @@ function eff_t0_b(ch, data) { // song jump (untested)
|
||||||
}
|
}
|
||||||
|
|
||||||
function eff_t0_c(ch, data) { // set volume
|
function eff_t0_c(ch, data) { // set volume
|
||||||
ch.vol = data & 0x3f;
|
ch.vol = Math.min(64, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function eff_t0_d(ch, data) { // pattern jump
|
function eff_t0_d(ch, data) { // pattern jump
|
||||||
|
|
@ -1085,12 +1085,14 @@ function playXM(arrayBuf) {
|
||||||
if (env_vol_type) {
|
if (env_vol_type) {
|
||||||
// insert an automatic fadeout to 0 at the end of the envelope
|
// insert an automatic fadeout to 0 at the end of the envelope
|
||||||
var env_end_tick = env_vol[env_vol.length-2];
|
var env_end_tick = env_vol[env_vol.length-2];
|
||||||
var fadeout_ticks = 65536.0 / inst.fadeout;
|
|
||||||
if (!(env_vol_type & 2)) { // if there's no sustain point, create one
|
if (!(env_vol_type & 2)) { // if there's no sustain point, create one
|
||||||
env_vol_sustain = env_vol.length / 2;
|
env_vol_sustain = env_vol.length / 2;
|
||||||
}
|
}
|
||||||
env_vol.push(env_end_tick + fadeout_ticks);
|
if (inst.fadeout > 0) {
|
||||||
env_vol.push(0);
|
var fadeout_ticks = 65536.0 / inst.fadeout;
|
||||||
|
env_vol.push(env_end_tick + fadeout_ticks);
|
||||||
|
env_vol.push(0);
|
||||||
|
}
|
||||||
inst.env_vol = new Envelope(
|
inst.env_vol = new Envelope(
|
||||||
env_vol,
|
env_vol,
|
||||||
env_vol_type,
|
env_vol_type,
|
||||||
|
|
@ -1098,8 +1100,9 @@ function playXM(arrayBuf) {
|
||||||
env_vol_loop_start,
|
env_vol_loop_start,
|
||||||
env_vol_loop_end);
|
env_vol_loop_end);
|
||||||
} else {
|
} else {
|
||||||
// create a default envelope w/ fadeout
|
// no envelope, then just make a default full-volume envelope.
|
||||||
inst.env_vol = new Envelope([0, 64, fadeout_ticks, 0], 2, 0, 0, 0);
|
// i thought this would use fadeout, but apparently it doesn't.
|
||||||
|
inst.env_vol = new Envelope([0, 64, 1, 0], 2, 0, 0, 0);
|
||||||
}
|
}
|
||||||
if (env_pan_type) {
|
if (env_pan_type) {
|
||||||
if (!(env_pan_type & 2)) { // if there's no sustain point, create one
|
if (!(env_pan_type & 2)) { // if there's no sustain point, create one
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue