Skip to content

Envelope fix #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions libmikmod/include/mikmod_internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ typedef struct FILTER {
#define EF_SUSTAIN 2
#define EF_LOOP 4
#define EF_VOLENV 8
#define EF_ITMODE 16

/* New Note Action Flags */
#define NNA_CUT 0
Expand Down Expand Up @@ -461,22 +462,23 @@ typedef struct FILTER {
#define LAST_PATTERN (UWORD)(-1) /* special ``end of song'' pattern */

typedef struct ENVPR {
UBYTE flg; /* envelope flag */
UBYTE pts; /* number of envelope points */
UBYTE susbeg; /* envelope sustain index begin */
UBYTE susend; /* envelope sustain index end */
UBYTE beg; /* envelope loop begin */
UBYTE end; /* envelope loop end */
SWORD p; /* current envelope counter */
UWORD a; /* envelope index a */
UWORD b; /* envelope index b */
ENVPT* env; /* envelope points */
UBYTE flg; /* envelope flag */
UBYTE pts; /* number of envelope points */
UBYTE susbeg; /* envelope sustain index begin */
UBYTE susend; /* envelope sustain index end */
UBYTE loopbeg; /* envelope loop begin */
UBYTE loopend; /* envelope loop end */
SWORD tick; /* current envelope counter */
UWORD index; /* envelope index for the point after the current one */
BOOL interpolate; /* Indicate if interpolation should be done */
SWORD lastvalue; /* the last calculated value */
ENVPT* env; /* envelope points */
} ENVPR;

typedef struct MP_CHANNEL {
INSTRUMENT* i;
SAMPLE *s;
UBYTE sample; /* which sample number */
SBYTE sample; /* which sample number, -1 if illegal instrument has been set */
UBYTE note; /* the audible note as heard, direct rep of period */
SWORD outvolume; /* output volume (vol + sampcol + instvol) */
SBYTE chanvol; /* channel's "global" volume */
Expand Down Expand Up @@ -590,6 +592,8 @@ typedef struct MP_VOICE {
ENVPR penv;
ENVPR cenv;

SWORD envstartpos;/* Start position for envelopes set by XM effect L */

UWORD avibpos; /* autovibrato pos */
UWORD aswppos; /* autovibrato sweep pos */

Expand Down
4 changes: 3 additions & 1 deletion libmikmod/loaders/load_it.c
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,9 @@ static BOOL IT_Load(BOOL curious)
return 0;
}

d->volflg|=EF_VOLENV;
d->volflg|=(EF_VOLENV | EF_ITMODE);
d->panflg|=EF_ITMODE;
d->pitflg|=EF_ITMODE;
d->insname = DupStr(ih.name,26,0);
d->nnatype = ih.nna & NNA_MASK;

Expand Down
Loading