Skip to content
Permalink
Browse files
Darrell Walisser - Sun Aug 19 00:47:22 PDT 2001
 * Fixed compilation problems with mikmod under MacOS
  • Loading branch information
slouken committed Aug 19, 2001
1 parent e53f8d6 commit d7c14a6ee13d33db2d52bd896e23d6a538f38dc1
Showing with 106 additions and 120 deletions.
  1. +2 −0 CHANGES
  2. +77 −78 mikmod/load_it.c
  3. +26 −41 mikmod/load_xm.c
  4. +1 −1 mikmod/virtch2.c
@@ -1,5 +1,7 @@

1.2.1:
Darrell Walisser - Sun Aug 19 00:47:22 PDT 2001
* Fixed compilation problems with mikmod under MacOS X
Torbj�rn Andersson - Sun, 19 Aug 2001 16:03:30
* Fixed AIFF music playing support
Sam Lantinga - Sat Aug 18 04:14:13 PDT 2001
@@ -709,38 +709,41 @@ BOOL IT_Load(BOOL curious)
}
} else {
/* load IT 2xx volume, pan and pitch envelopes */
#ifdef __STDC__
#define IT_LoadEnvelope(name,type) \
ih.##name##flg =_mm_read_UBYTE(modreader); \
ih.##name##pts =_mm_read_UBYTE(modreader); \
ih.##name##beg =_mm_read_UBYTE(modreader); \
ih.##name##end =_mm_read_UBYTE(modreader); \
ih.##name##susbeg=_mm_read_UBYTE(modreader); \
ih.##name##susend=_mm_read_UBYTE(modreader); \
for(lp=0;lp<ITENVCNT;lp++) { \
ih.##name##node[lp]=_mm_read_##type##(modreader); \
ih.##name##tick[lp]=_mm_read_I_UWORD(modreader); \
} \
_mm_read_UBYTE(modreader);
#else
#define IT_LoadEnvelope(name,type) \
ih./**/name/**/flg =_mm_read_UBYTE(modreader); \
ih./**/name/**/pts =_mm_read_UBYTE(modreader); \
ih./**/name/**/beg =_mm_read_UBYTE(modreader); \
ih./**/name/**/end =_mm_read_UBYTE(modreader); \
ih./**/name/**/susbeg=_mm_read_UBYTE(modreader); \
ih./**/name/**/susend=_mm_read_UBYTE(modreader); \
for(lp=0;lp<ITENVCNT;lp++) { \
ih./**/name/**/node[lp]=_mm_read_/**/type/**/(modreader);\
ih./**/name/**/tick[lp]=_mm_read_I_UWORD(modreader); \
} \
_mm_read_UBYTE(modreader);
#endif

IT_LoadEnvelope(vol,UBYTE);
IT_LoadEnvelope(pan,SBYTE);
IT_LoadEnvelope(pit,SBYTE);
#undef IT_LoadEnvelope
ih.volflg =_mm_read_UBYTE(modreader);
ih.volpts =_mm_read_UBYTE(modreader);
ih.volbeg =_mm_read_UBYTE(modreader);
ih.volend =_mm_read_UBYTE(modreader);
ih.volsusbeg=_mm_read_UBYTE(modreader);
ih.volsusend=_mm_read_UBYTE(modreader);
for(lp=0;lp<ITENVCNT;lp++) {
ih.volnode[lp]=_mm_read_UBYTE(modreader);
ih.voltick[lp]=_mm_read_I_UWORD(modreader);
}
_mm_read_UBYTE(modreader);
ih.panflg =_mm_read_UBYTE(modreader);
ih.panpts =_mm_read_UBYTE(modreader);
ih.panbeg =_mm_read_UBYTE(modreader);
ih.panend =_mm_read_UBYTE(modreader);
ih.pansusbeg=_mm_read_UBYTE(modreader);
ih.pansusend=_mm_read_UBYTE(modreader);
for(lp=0;lp<ITENVCNT;lp++) {
ih.pannode[lp]=_mm_read_SBYTE(modreader);
ih.pantick[lp]=_mm_read_I_UWORD(modreader);
}
_mm_read_UBYTE(modreader);
ih.pitflg =_mm_read_UBYTE(modreader);
ih.pitpts =_mm_read_UBYTE(modreader);
ih.pitbeg =_mm_read_UBYTE(modreader);
ih.pitend =_mm_read_UBYTE(modreader);
ih.pitsusbeg=_mm_read_UBYTE(modreader);
ih.pitsusend=_mm_read_UBYTE(modreader);
for(lp=0;lp < ITENVCNT; lp++) {
ih.pitnode[lp]=_mm_read_SBYTE(modreader);
ih.pittick[lp]=_mm_read_I_UWORD(modreader);
}
_mm_read_UBYTE(modreader);

}

if(_mm_eof(modreader)) {
@@ -797,53 +800,49 @@ BOOL IT_Load(BOOL curious)
d->rpanvar = ih.rpanvar;
}

#ifdef __STDC__
#define IT_ProcessEnvelope(name) \
if(ih.##name##flg&1) d->##name##flg|=EF_ON; \
if(ih.##name##flg&2) d->##name##flg|=EF_LOOP; \
if(ih.##name##flg&4) d->##name##flg|=EF_SUSTAIN; \
d->##name##pts=ih.##name##pts; \
d->##name##beg=ih.##name##beg; \
d->##name##end=ih.##name##end; \
d->##name##susbeg=ih.##name##susbeg; \
d->##name##susend=ih.##name##susend; \
\
for(u=0;u<ih.##name##pts;u++) \
d->##name##env[u].pos=ih.##name##tick[u]; \
\
if((d->##name##flg&EF_ON)&&(d->##name##pts<2)) \
d->##name##flg&=~EF_ON;
#else
#define IT_ProcessEnvelope(name) \
if(ih./**/name/**/flg&1) d->/**/name/**/flg|=EF_ON; \
if(ih./**/name/**/flg&2) d->/**/name/**/flg|=EF_LOOP; \
if(ih./**/name/**/flg&4) d->/**/name/**/flg|=EF_SUSTAIN; \
d->/**/name/**/pts=ih./**/name/**/pts; \
d->/**/name/**/beg=ih./**/name/**/beg; \
d->/**/name/**/end=ih./**/name/**/end; \
d->/**/name/**/susbeg=ih./**/name/**/susbeg; \
d->/**/name/**/susend=ih./**/name/**/susend; \
\
for(u=0;u<ih./**/name/**/pts;u++) \
d->/**/name/**/env[u].pos=ih./**/name/**/tick[u]; \
\
if((d->/**/name/**/flg&EF_ON)&&(d->/**/name/**/pts<2)) \
d->/**/name/**/flg&=~EF_ON;
#endif

IT_ProcessEnvelope(vol);
for(u=0;u<ih.volpts;u++)
d->volenv[u].val=(ih.volnode[u]<<2);

IT_ProcessEnvelope(pan);
for(u=0;u<ih.panpts;u++)
d->panenv[u].val=
ih.pannode[u]==32?255:(ih.pannode[u]+32)<<2;

IT_ProcessEnvelope(pit);
for(u=0;u<ih.pitpts;u++)
d->pitenv[u].val=ih.pitnode[u]+32;
#undef IT_ProcessEnvelope
if(ih.volflg&1) d->volflg|=EF_ON;
if(ih.volflg&2) d->volflg|=EF_LOOP;
if(ih.volflg&4) d->volflg|=EF_SUSTAIN;
d->volpts=ih.volpts;
d->volbeg=ih.volbeg;
d->volend=ih.volend;
d->volsusbeg=ih.volsusbeg;
d->volsusend=ih.volsusend;
for(u=0;u<ih.volpts;u++)
d->volenv[u].pos=ih.voltick[u]; if((d->volflg&EF_ON)&&(d->volpts<2))
d->volflg&=~EF_ON;
for(u=0;u<ih.volpts;u++)
d->volenv[u].val=(ih.volnode[u]<<2);

if(ih.panflg&1) d->panflg|=EF_ON;
if(ih.panflg&2) d->panflg|=EF_LOOP;
if(ih.panflg&4) d->panflg|=EF_SUSTAIN;
d->panpts=ih.panpts;
d->panbeg=ih.panbeg;
d->panend=ih.panend;
d->pansusbeg=ih.pansusbeg;
d->pansusend=ih.pansusend;
for(u=0;u<ih.panpts;u++)
d->panenv[u].pos=ih.pantick[u];
if((d->panflg&EF_ON)&&(d->panpts<2))
d->panflg&=~EF_ON;
for(u=0;u<ih.panpts;u++)
d->panenv[u].val=ih.pannode[u]==32?255:(ih.pannode[u]+32)<<2;

if(ih.pitflg&1) d->pitflg|=EF_ON;
if(ih.pitflg&2) d->pitflg|=EF_LOOP;
if(ih.pitflg&4) d->pitflg|=EF_SUSTAIN;
d->pitpts=ih.pitpts;
d->pitbeg=ih.pitbeg;
d->pitend=ih.pitend;
d->pitsusbeg=ih.pitsusbeg;
d->pitsusend=ih.pitsusend;
for(u=0;u<ih.pitpts;u++)
d->pitenv[u].pos=ih.pittick[u];
if((d->pitflg&EF_ON)&&(d->pitpts<2))
d->pitflg&=~EF_ON;
for(u=0;u<ih.pitpts;u++)
d->pitenv[u].val=ih.pitnode[u]+32;

if(ih.pitflg&0x80) {
/* filter envelopes not supported yet */
@@ -456,47 +456,32 @@ static BOOL LoadInstruments(void)
d->samplenumber[u]=pth.what[u]+of.numsmp;
d->volfade = pth.volfade;

#ifdef __STDC__
#define XM_ProcessEnvelope(name) \
memcpy(d->##name##env,pth.##name##env,XMENVCNT); \
if (pth.##name##flg&1) d->##name##flg|=EF_ON; \
if (pth.##name##flg&2) d->##name##flg|=EF_SUSTAIN; \
if (pth.##name##flg&4) d->##name##flg|=EF_LOOP; \
d->##name##susbeg=d->##name##susend=pth.##name##sus; \
d->##name##beg=pth.##name##beg; \
d->##name##end=pth.##name##end; \
d->##name##pts=pth.##name##pts; \
\
/* scale envelope */ \
for (p=0;p<XMENVCNT/2;p++) \
d->##name##env[p].val<<=2; \
\
if ((d->##name##flg&EF_ON)&&(d->##name##pts<2)) \
d->##name##flg&=~EF_ON;
#else
#define XM_ProcessEnvelope(name) \
memcpy(d->/**/name/**/env,pth./**/name/**/env,XMENVCNT); \
if (pth./**/name/**/flg&1) d->/**/name/**/flg|=EF_ON; \
if (pth./**/name/**/flg&2) d->/**/name/**/flg|=EF_SUSTAIN; \
if (pth./**/name/**/flg&4) d->/**/name/**/flg|=EF_LOOP; \
d->/**/name/**/susbeg=d->/**/name/**/susend= \
pth./**/name/**/sus; \
d->/**/name/**/beg=pth./**/name/**/beg; \
d->/**/name/**/end=pth./**/name/**/end; \
d->/**/name/**/pts=pth./**/name/**/pts; \
\
/* scale envelope */ \
for (p=0;p<XMENVCNT/2;p++) \
d->/**/name/**/env[p].val<<=2; \
\
if ((d->/**/name/**/flg&EF_ON)&&(d->/**/name/**/pts<2)) \
d->/**/name/**/flg&=~EF_ON;
#endif

XM_ProcessEnvelope(vol);
XM_ProcessEnvelope(pan);
#undef XM_ProcessEnvelope

memcpy(d->volenv,pth.volenv,XMENVCNT);
if (pth.volflg&1) d->volflg|=EF_ON;
if (pth.volflg&2) d->volflg|=EF_SUSTAIN;
if (pth.volflg&4) d->volflg|=EF_LOOP;
d->volsusbeg=d->volsusend=pth.volsus;
d->volbeg=pth.volbeg;
d->volend=pth.volend;
d->volpts=pth.volpts;
/* scale envelope */
for (p=0;p<XMENVCNT/2;p++)
d->volenv[p].val<<=2;
if ((d->volflg&EF_ON)&&(d->volpts<2))
d->volflg&=~EF_ON;
memcpy(d->panenv,pth.panenv,XMENVCNT);
if (pth.panflg&1) d->panflg|=EF_ON;
if (pth.panflg&2) d->panflg|=EF_SUSTAIN;
if (pth.panflg&4) d->panflg|=EF_LOOP;
d->pansusbeg=d->pansusend=pth.pansus;
d->panbeg=pth.panbeg;
d->panend=pth.panend;
d->panpts=pth.panpts;
/* scale envelope */
for (p=0;p<XMENVCNT/2;p++)
d->panenv[p].val<<=2;
if ((d->panflg&EF_ON)&&(d->panpts<2))
d->panflg&=~EF_ON;
/* Samples are stored outside the instrument struct now, so we
have to load them all into a temp area, count the of.numsmp
along the way and then do an AllocSamples() and move
@@ -44,7 +44,7 @@

#include "mikmod_internals.h"

#ifdef macintosh
#if defined(macintosh) || defined(__APPLE__)
#define NO_64BIT_MIXER
#endif
/*

0 comments on commit d7c14a6

Please sign in to comment.