fix envelopes some more
whoops, was checking wrong envelope bits for sustain/loop
This commit is contained in:
parent
c3499eedaa
commit
156cca80d3
1 changed files with 3 additions and 3 deletions
6
xm.js
6
xm.js
|
|
@ -221,7 +221,7 @@ function EnvelopeFollower(env) {
|
||||||
|
|
||||||
EnvelopeFollower.prototype.Tick = function(release) {
|
EnvelopeFollower.prototype.Tick = function(release) {
|
||||||
var value = this.env.Get(this.tick);
|
var value = this.env.Get(this.tick);
|
||||||
if (this.env.type & 1) { // sustain?
|
if (this.env.type & 2) { // sustain?
|
||||||
// if we're sustaining a note, stop advancing the tick counter
|
// if we're sustaining a note, stop advancing the tick counter
|
||||||
if (!release &&
|
if (!release &&
|
||||||
this.tick >= this.env.points[this.env.sustain*2]) {
|
this.tick >= this.env.points[this.env.sustain*2]) {
|
||||||
|
|
@ -229,7 +229,7 @@ EnvelopeFollower.prototype.Tick = function(release) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.tick++;
|
this.tick++;
|
||||||
if (this.env.type & 2) { // envelope loop?
|
if (this.env.type & 4) { // envelope loop?
|
||||||
if (!release &&
|
if (!release &&
|
||||||
this.tick > this.env.loopend) {
|
this.tick > this.env.loopend) {
|
||||||
this.tick -= this.env.loopend - this.env.loopstart;
|
this.tick -= this.env.loopend - this.env.loopstart;
|
||||||
|
|
@ -948,7 +948,7 @@ function playXM(arrayBuf) {
|
||||||
env_vol_loop_end);
|
env_vol_loop_end);
|
||||||
} else {
|
} else {
|
||||||
// create a default envelope w/ fadeout
|
// create a default envelope w/ fadeout
|
||||||
inst.env_vol = new Envelope([0, 64, fadeout_ticks, 0], 1, 0, 0, 0);
|
inst.env_vol = new Envelope([0, 64, fadeout_ticks, 0], 2, 0, 0, 0);
|
||||||
}
|
}
|
||||||
if (env_pan_type) {
|
if (env_pan_type) {
|
||||||
inst.env_pan = new Envelope(
|
inst.env_pan = new Envelope(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue