Darrell Walisser - Sun Aug 19 00:47:22 PDT 2001
authorSam Lantinga
Sun, 19 Aug 2001 19:49:48 +0000
changeset 967d996a0c9353
parent 95 871a7c1b93fb
child 97 2bf733171d56
Darrell Walisser - Sun Aug 19 00:47:22 PDT 2001
* Fixed compilation problems with mikmod under MacOS
CHANGES
mikmod/load_it.c
mikmod/load_xm.c
mikmod/virtch2.c
     1.1 --- a/CHANGES	Sun Aug 19 19:13:09 2001 +0000
     1.2 +++ b/CHANGES	Sun Aug 19 19:49:48 2001 +0000
     1.3 @@ -1,5 +1,7 @@
     1.4  
     1.5  1.2.1:
     1.6 +Darrell Walisser - Sun Aug 19 00:47:22 PDT 2001
     1.7 + * Fixed compilation problems with mikmod under MacOS X
     1.8  Torbjörn Andersson - Sun, 19 Aug 2001 16:03:30
     1.9   * Fixed AIFF music playing support
    1.10  Sam Lantinga - Sat Aug 18 04:14:13 PDT 2001
     2.1 --- a/mikmod/load_it.c	Sun Aug 19 19:13:09 2001 +0000
     2.2 +++ b/mikmod/load_it.c	Sun Aug 19 19:49:48 2001 +0000
     2.3 @@ -709,38 +709,41 @@
     2.4  				}
     2.5  			} else {
     2.6  				/* load IT 2xx volume, pan and pitch envelopes */
     2.7 -#ifdef __STDC__
     2.8 -#define IT_LoadEnvelope(name,type) 											\
     2.9 -				ih.##name##flg   =_mm_read_UBYTE(modreader);				\
    2.10 -				ih.##name##pts   =_mm_read_UBYTE(modreader);				\
    2.11 -				ih.##name##beg   =_mm_read_UBYTE(modreader);				\
    2.12 -				ih.##name##end   =_mm_read_UBYTE(modreader);				\
    2.13 -				ih.##name##susbeg=_mm_read_UBYTE(modreader);				\
    2.14 -				ih.##name##susend=_mm_read_UBYTE(modreader);				\
    2.15 -				for(lp=0;lp<ITENVCNT;lp++) {								\
    2.16 -					ih.##name##node[lp]=_mm_read_##type##(modreader);		\
    2.17 -					ih.##name##tick[lp]=_mm_read_I_UWORD(modreader);		\
    2.18 -				}															\
    2.19 -				_mm_read_UBYTE(modreader);
    2.20 -#else
    2.21 -#define IT_LoadEnvelope(name,type) 											\
    2.22 -				ih./**/name/**/flg   =_mm_read_UBYTE(modreader);			\
    2.23 -				ih./**/name/**/pts   =_mm_read_UBYTE(modreader);			\
    2.24 -				ih./**/name/**/beg   =_mm_read_UBYTE(modreader);			\
    2.25 -				ih./**/name/**/end   =_mm_read_UBYTE(modreader);			\
    2.26 -				ih./**/name/**/susbeg=_mm_read_UBYTE(modreader);			\
    2.27 -				ih./**/name/**/susend=_mm_read_UBYTE(modreader);			\
    2.28 -				for(lp=0;lp<ITENVCNT;lp++) {								\
    2.29 -					ih./**/name/**/node[lp]=_mm_read_/**/type/**/(modreader);\
    2.30 -					ih./**/name/**/tick[lp]=_mm_read_I_UWORD(modreader);	\
    2.31 -				}															\
    2.32 -				_mm_read_UBYTE(modreader);
    2.33 -#endif
    2.34  
    2.35 -				IT_LoadEnvelope(vol,UBYTE);
    2.36 -				IT_LoadEnvelope(pan,SBYTE);
    2.37 -				IT_LoadEnvelope(pit,SBYTE);
    2.38 -#undef IT_LoadEnvelope
    2.39 + ih.volflg   =_mm_read_UBYTE(modreader);             
    2.40 + ih.volpts   =_mm_read_UBYTE(modreader);             
    2.41 + ih.volbeg   =_mm_read_UBYTE(modreader);             
    2.42 + ih.volend   =_mm_read_UBYTE(modreader);             
    2.43 + ih.volsusbeg=_mm_read_UBYTE(modreader);             
    2.44 + ih.volsusend=_mm_read_UBYTE(modreader);             
    2.45 + for(lp=0;lp<ITENVCNT;lp++) {
    2.46 + ih.volnode[lp]=_mm_read_UBYTE(modreader);
    2.47 + ih.voltick[lp]=_mm_read_I_UWORD(modreader); 
    2.48 + }                                                            
    2.49 + _mm_read_UBYTE(modreader);
    2.50 + ih.panflg   =_mm_read_UBYTE(modreader);             
    2.51 + ih.panpts   =_mm_read_UBYTE(modreader);             
    2.52 + ih.panbeg   =_mm_read_UBYTE(modreader);             
    2.53 + ih.panend   =_mm_read_UBYTE(modreader);             
    2.54 + ih.pansusbeg=_mm_read_UBYTE(modreader);             
    2.55 + ih.pansusend=_mm_read_UBYTE(modreader);             
    2.56 + for(lp=0;lp<ITENVCNT;lp++) {
    2.57 + ih.pannode[lp]=_mm_read_SBYTE(modreader);
    2.58 + ih.pantick[lp]=_mm_read_I_UWORD(modreader); 
    2.59 + }                                                            
    2.60 + _mm_read_UBYTE(modreader);
    2.61 + ih.pitflg   =_mm_read_UBYTE(modreader);             
    2.62 + ih.pitpts   =_mm_read_UBYTE(modreader);             
    2.63 + ih.pitbeg   =_mm_read_UBYTE(modreader);             
    2.64 + ih.pitend   =_mm_read_UBYTE(modreader);             
    2.65 + ih.pitsusbeg=_mm_read_UBYTE(modreader);             
    2.66 + ih.pitsusend=_mm_read_UBYTE(modreader);             
    2.67 + for(lp=0;lp < ITENVCNT; lp++) {
    2.68 + ih.pitnode[lp]=_mm_read_SBYTE(modreader);
    2.69 + ih.pittick[lp]=_mm_read_I_UWORD(modreader); 
    2.70 + }                                                            
    2.71 + _mm_read_UBYTE(modreader);
    2.72 +
    2.73  			}
    2.74  
    2.75  			if(_mm_eof(modreader)) {
    2.76 @@ -797,53 +800,49 @@
    2.77  					d->rpanvar = ih.rpanvar;
    2.78  				}
    2.79  
    2.80 -#ifdef __STDC__
    2.81 -#define IT_ProcessEnvelope(name) 											\
    2.82 -				if(ih.##name##flg&1) d->##name##flg|=EF_ON;					\
    2.83 -				if(ih.##name##flg&2) d->##name##flg|=EF_LOOP;				\
    2.84 -				if(ih.##name##flg&4) d->##name##flg|=EF_SUSTAIN;			\
    2.85 -				d->##name##pts=ih.##name##pts;								\
    2.86 -				d->##name##beg=ih.##name##beg;								\
    2.87 -				d->##name##end=ih.##name##end;								\
    2.88 -				d->##name##susbeg=ih.##name##susbeg;						\
    2.89 -				d->##name##susend=ih.##name##susend;						\
    2.90 -																			\
    2.91 -				for(u=0;u<ih.##name##pts;u++)								\
    2.92 -					d->##name##env[u].pos=ih.##name##tick[u];				\
    2.93 -																			\
    2.94 -				if((d->##name##flg&EF_ON)&&(d->##name##pts<2))				\
    2.95 -					d->##name##flg&=~EF_ON;
    2.96 -#else
    2.97 -#define IT_ProcessEnvelope(name) 											\
    2.98 -				if(ih./**/name/**/flg&1) d->/**/name/**/flg|=EF_ON;			\
    2.99 -				if(ih./**/name/**/flg&2) d->/**/name/**/flg|=EF_LOOP;		\
   2.100 -				if(ih./**/name/**/flg&4) d->/**/name/**/flg|=EF_SUSTAIN;	\
   2.101 -				d->/**/name/**/pts=ih./**/name/**/pts;						\
   2.102 -				d->/**/name/**/beg=ih./**/name/**/beg;						\
   2.103 -				d->/**/name/**/end=ih./**/name/**/end;						\
   2.104 -				d->/**/name/**/susbeg=ih./**/name/**/susbeg;				\
   2.105 -				d->/**/name/**/susend=ih./**/name/**/susend;				\
   2.106 -																			\
   2.107 -				for(u=0;u<ih./**/name/**/pts;u++)							\
   2.108 -					d->/**/name/**/env[u].pos=ih./**/name/**/tick[u];		\
   2.109 -																			\
   2.110 -				if((d->/**/name/**/flg&EF_ON)&&(d->/**/name/**/pts<2))		\
   2.111 -					d->/**/name/**/flg&=~EF_ON;
   2.112 -#endif
   2.113 +if(ih.volflg&1) d->volflg|=EF_ON;
   2.114 +if(ih.volflg&2) d->volflg|=EF_LOOP;
   2.115 +if(ih.volflg&4) d->volflg|=EF_SUSTAIN;
   2.116 +d->volpts=ih.volpts;
   2.117 +d->volbeg=ih.volbeg;
   2.118 +d->volend=ih.volend;
   2.119 +d->volsusbeg=ih.volsusbeg;
   2.120 +d->volsusend=ih.volsusend;
   2.121 +for(u=0;u<ih.volpts;u++)
   2.122 + d->volenv[u].pos=ih.voltick[u];                               if((d->volflg&EF_ON)&&(d->volpts<2))                          
   2.123 + d->volflg&=~EF_ON;
   2.124 +for(u=0;u<ih.volpts;u++)
   2.125 + d->volenv[u].val=(ih.volnode[u]<<2);
   2.126 +                               
   2.127 +if(ih.panflg&1) d->panflg|=EF_ON;
   2.128 +if(ih.panflg&2) d->panflg|=EF_LOOP;
   2.129 +if(ih.panflg&4) d->panflg|=EF_SUSTAIN;
   2.130 +d->panpts=ih.panpts;
   2.131 +d->panbeg=ih.panbeg;
   2.132 +d->panend=ih.panend;                                                   
   2.133 +d->pansusbeg=ih.pansusbeg;
   2.134 +d->pansusend=ih.pansusend;
   2.135 +for(u=0;u<ih.panpts;u++)
   2.136 + d->panenv[u].pos=ih.pantick[u];                               
   2.137 +if((d->panflg&EF_ON)&&(d->panpts<2))         
   2.138 +d->panflg&=~EF_ON;                 
   2.139 + for(u=0;u<ih.panpts;u++)
   2.140 +  d->panenv[u].val=ih.pannode[u]==32?255:(ih.pannode[u]+32)<<2;
   2.141  
   2.142 -				IT_ProcessEnvelope(vol);
   2.143 -				for(u=0;u<ih.volpts;u++)
   2.144 -					d->volenv[u].val=(ih.volnode[u]<<2);
   2.145 -
   2.146 -				IT_ProcessEnvelope(pan);
   2.147 -				for(u=0;u<ih.panpts;u++)
   2.148 -					d->panenv[u].val=
   2.149 -					  ih.pannode[u]==32?255:(ih.pannode[u]+32)<<2;
   2.150 -
   2.151 -				IT_ProcessEnvelope(pit);
   2.152 -				for(u=0;u<ih.pitpts;u++)
   2.153 -					d->pitenv[u].val=ih.pitnode[u]+32;
   2.154 -#undef IT_ProcessEnvelope
   2.155 +if(ih.pitflg&1) d->pitflg|=EF_ON;
   2.156 +if(ih.pitflg&2) d->pitflg|=EF_LOOP;
   2.157 +if(ih.pitflg&4) d->pitflg|=EF_SUSTAIN;
   2.158 +d->pitpts=ih.pitpts;
   2.159 +d->pitbeg=ih.pitbeg;
   2.160 +d->pitend=ih.pitend;                                                   
   2.161 +d->pitsusbeg=ih.pitsusbeg;                                            
   2.162 +d->pitsusend=ih.pitsusend;                                            
   2.163 +for(u=0;u<ih.pitpts;u++)                                                    
   2.164 +d->pitenv[u].pos=ih.pittick[u];                               
   2.165 +if((d->pitflg&EF_ON)&&(d->pitpts<2))
   2.166 +d->pitflg&=~EF_ON;
   2.167 + for(u=0;u<ih.pitpts;u++)
   2.168 +  d->pitenv[u].val=ih.pitnode[u]+32;
   2.169  
   2.170  				if(ih.pitflg&0x80) {
   2.171  					/* filter envelopes not supported yet */
     3.1 --- a/mikmod/load_xm.c	Sun Aug 19 19:13:09 2001 +0000
     3.2 +++ b/mikmod/load_xm.c	Sun Aug 19 19:49:48 2001 +0000
     3.3 @@ -456,47 +456,32 @@
     3.4  					d->samplenumber[u]=pth.what[u]+of.numsmp;
     3.5  				d->volfade = pth.volfade;
     3.6  
     3.7 -#ifdef __STDC__
     3.8 -#define XM_ProcessEnvelope(name) 											\
     3.9 -				memcpy(d->##name##env,pth.##name##env,XMENVCNT);			\
    3.10 -				if (pth.##name##flg&1) d->##name##flg|=EF_ON;				\
    3.11 -				if (pth.##name##flg&2) d->##name##flg|=EF_SUSTAIN;			\
    3.12 -				if (pth.##name##flg&4) d->##name##flg|=EF_LOOP;				\
    3.13 -				d->##name##susbeg=d->##name##susend=pth.##name##sus;		\
    3.14 -				d->##name##beg=pth.##name##beg;								\
    3.15 -				d->##name##end=pth.##name##end;								\
    3.16 -				d->##name##pts=pth.##name##pts;								\
    3.17 -																			\
    3.18 -				/* scale envelope */										\
    3.19 -				for (p=0;p<XMENVCNT/2;p++)									\
    3.20 -					d->##name##env[p].val<<=2;								\
    3.21 -																			\
    3.22 -				if ((d->##name##flg&EF_ON)&&(d->##name##pts<2))				\
    3.23 -					d->##name##flg&=~EF_ON;
    3.24 -#else
    3.25 -#define XM_ProcessEnvelope(name) 											\
    3.26 -				memcpy(d->/**/name/**/env,pth./**/name/**/env,XMENVCNT);	\
    3.27 -				if (pth./**/name/**/flg&1) d->/**/name/**/flg|=EF_ON;		\
    3.28 -				if (pth./**/name/**/flg&2) d->/**/name/**/flg|=EF_SUSTAIN;	\
    3.29 -				if (pth./**/name/**/flg&4) d->/**/name/**/flg|=EF_LOOP;		\
    3.30 -				d->/**/name/**/susbeg=d->/**/name/**/susend=				\
    3.31 -				                      pth./**/name/**/sus;					\
    3.32 -				d->/**/name/**/beg=pth./**/name/**/beg;						\
    3.33 -				d->/**/name/**/end=pth./**/name/**/end;						\
    3.34 -				d->/**/name/**/pts=pth./**/name/**/pts;						\
    3.35 -																			\
    3.36 -				/* scale envelope */										\
    3.37 -				for (p=0;p<XMENVCNT/2;p++)									\
    3.38 -					d->/**/name/**/env[p].val<<=2;							\
    3.39 -																			\
    3.40 -				if ((d->/**/name/**/flg&EF_ON)&&(d->/**/name/**/pts<2))		\
    3.41 -					d->/**/name/**/flg&=~EF_ON;
    3.42 -#endif
    3.43 -
    3.44 -				XM_ProcessEnvelope(vol);
    3.45 -				XM_ProcessEnvelope(pan);
    3.46 -#undef XM_ProcessEnvelope
    3.47 -
    3.48 +memcpy(d->volenv,pth.volenv,XMENVCNT);
    3.49 +if (pth.volflg&1) d->volflg|=EF_ON;
    3.50 +if (pth.volflg&2) d->volflg|=EF_SUSTAIN;
    3.51 +if (pth.volflg&4) d->volflg|=EF_LOOP;
    3.52 +d->volsusbeg=d->volsusend=pth.volsus;                                      
    3.53 +d->volbeg=pth.volbeg;
    3.54 +d->volend=pth.volend;
    3.55 +d->volpts=pth.volpts;
    3.56 +/* scale envelope */
    3.57 +for (p=0;p<XMENVCNT/2;p++)                                                       
    3.58 + d->volenv[p].val<<=2;
    3.59 +if ((d->volflg&EF_ON)&&(d->volpts<2))
    3.60 + d->volflg&=~EF_ON;
    3.61 +memcpy(d->panenv,pth.panenv,XMENVCNT);
    3.62 +if (pth.panflg&1) d->panflg|=EF_ON;
    3.63 +if (pth.panflg&2) d->panflg|=EF_SUSTAIN;
    3.64 +if (pth.panflg&4) d->panflg|=EF_LOOP;
    3.65 +d->pansusbeg=d->pansusend=pth.pansus;                                      
    3.66 +d->panbeg=pth.panbeg;
    3.67 +d->panend=pth.panend;
    3.68 +d->panpts=pth.panpts;
    3.69 +/* scale envelope */
    3.70 +for (p=0;p<XMENVCNT/2;p++)                                                       
    3.71 + d->panenv[p].val<<=2;
    3.72 +if ((d->panflg&EF_ON)&&(d->panpts<2))
    3.73 + d->panflg&=~EF_ON;
    3.74  				/* Samples are stored outside the instrument struct now, so we
    3.75  				   have to load them all into a temp area, count the of.numsmp
    3.76  				   along the way and then do an AllocSamples() and move
     4.1 --- a/mikmod/virtch2.c	Sun Aug 19 19:13:09 2001 +0000
     4.2 +++ b/mikmod/virtch2.c	Sun Aug 19 19:49:48 2001 +0000
     4.3 @@ -44,7 +44,7 @@
     4.4  
     4.5  #include "mikmod_internals.h"
     4.6  
     4.7 -#ifdef macintosh
     4.8 +#if defined(macintosh) || defined(__APPLE__)
     4.9  #define NO_64BIT_MIXER
    4.10  #endif
    4.11  /*