Skip to content

Commit 9675916

Browse files
neumathosezero
authored andcommitted
Envelope fixes [2/2]:
Updated the envelopes, so there are two separate handlers. One for XM/IMF and one for IT. Almost totally rewrote the envelope handling, so it behaves like FastTracker II does, specially when used together with XM effect L. These two fixes make Ebony Owl Netsuke.xm to play correctly.
1 parent a0a722b commit 9675916

3 files changed

Lines changed: 212 additions & 144 deletions

File tree

libmikmod/include/mikmod_internals.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ typedef struct FILTER {
424424
#define EF_SUSTAIN 2
425425
#define EF_LOOP 4
426426
#define EF_VOLENV 8
427+
#define EF_ITMODE 16
427428

428429
/* New Note Action Flags */
429430
#define NNA_CUT 0
@@ -461,17 +462,17 @@ typedef struct FILTER {
461462
#define LAST_PATTERN (UWORD)(-1) /* special ``end of song'' pattern */
462463

463464
typedef struct ENVPR {
464-
UBYTE flg; /* envelope flag */
465-
UBYTE pts; /* number of envelope points */
466-
UBYTE susbeg; /* envelope sustain index begin */
467-
UBYTE susend; /* envelope sustain index end */
468-
BOOL susactive;/* Indicate if sustain is active (no interpolation) */
469-
UBYTE beg; /* envelope loop begin */
470-
UBYTE end; /* envelope loop end */
471-
SWORD p; /* current envelope counter */
472-
UWORD index; /* envelope index for the point after the current one */
473-
SWORD lastvalue;/* the last calculated value */
474-
ENVPT* env; /* envelope points */
465+
UBYTE flg; /* envelope flag */
466+
UBYTE pts; /* number of envelope points */
467+
UBYTE susbeg; /* envelope sustain index begin */
468+
UBYTE susend; /* envelope sustain index end */
469+
UBYTE loopbeg; /* envelope loop begin */
470+
UBYTE loopend; /* envelope loop end */
471+
SWORD tick; /* current envelope counter */
472+
UWORD index; /* envelope index for the point after the current one */
473+
BOOL interpolate; /* Indicate if interpolation should be done */
474+
SWORD lastvalue; /* the last calculated value */
475+
ENVPT* env; /* envelope points */
475476
} ENVPR;
476477

477478
typedef struct MP_CHANNEL {

libmikmod/loaders/load_it.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,9 @@ static BOOL IT_Load(BOOL curious)
827827
return 0;
828828
}
829829

830-
d->volflg|=EF_VOLENV;
830+
d->volflg|=(EF_VOLENV | EF_ITMODE);
831+
d->panflg|=EF_ITMODE;
832+
d->pitflg|=EF_ITMODE;
831833
d->insname = DupStr(ih.name,26,0);
832834
d->nnatype = ih.nna & NNA_MASK;
833835

0 commit comments

Comments
 (0)