#ifndef GAUSS_H\r
#define GAUSS_H\r
\r
-const int gauss[]={\r
+static const short gauss[]={\r
0x172, 0x519, 0x176, 0x000, 0x16E, 0x519, 0x17A, 0x000, \r
0x16A, 0x518, 0x17D, 0x000, 0x166, 0x518, 0x181, 0x000, \r
0x162, 0x518, 0x185, 0x000, 0x15F, 0x518, 0x189, 0x000, \r
#include "externals.h"\r
#include "registers.h"\r
\r
-/*\r
-// adsr time values (in ms) by James Higgs ... see the end of\r
-// the adsr.c source for details\r
-\r
-#define ATTACK_MS 514L\r
-#define DECAYHALF_MS 292L\r
-#define DECAY_MS 584L\r
-#define SUSTAIN_MS 450L\r
-#define RELEASE_MS 446L\r
-*/\r
-\r
-// we have a timebase of 1.020408f ms, not 1 ms... so adjust adsr defines\r
-#define ATTACK_MS 494L\r
-#define DECAYHALF_MS 286L\r
-#define DECAY_MS 572L\r
-#define SUSTAIN_MS 441L\r
-#define RELEASE_MS 437L\r
-\r
static void SoundOn(int start,int end,unsigned short val);\r
static void SoundOff(int start,int end,unsigned short val);\r
static void FModOn(int start,int end,unsigned short val);\r
s_chan[ch].ADSRX.DecayRate=(lval>>4) & 0x000f;\r
s_chan[ch].ADSRX.SustainLevel=lval & 0x000f;\r
//---------------------------------------------//\r
-#if 0\r
- if(!iDebugMode) break;\r
- //---------------------------------------------// stuff below is only for debug mode\r
-\r
- s_chan[ch].ADSR.AttackModeExp=(lval&0x8000)?1:0; //0x007f\r
-\r
- lx=(((lval>>8) & 0x007f)>>2); // attack time to run from 0 to 100% volume\r
- lx=min(31,lx); // no overflow on shift!\r
- if(lx) \r
- { \r
- lx = (1<<lx);\r
- if(lx<2147483) lx=(lx*ATTACK_MS)/10000L; // another overflow check\r
- else lx=(lx/10000L)*ATTACK_MS;\r
- if(!lx) lx=1;\r
- }\r
- s_chan[ch].ADSR.AttackTime=lx; \r
-\r
- s_chan[ch].ADSR.SustainLevel= // our adsr vol runs from 0 to 1024, so scale the sustain level\r
- (1024*((lval) & 0x000f))/15;\r
-\r
- lx=(lval>>4) & 0x000f; // decay:\r
- if(lx) // our const decay value is time it takes from 100% to 0% of volume\r
- {\r
- lx = ((1<<(lx))*DECAY_MS)/10000L;\r
- if(!lx) lx=1;\r
- }\r
- s_chan[ch].ADSR.DecayTime = // so calc how long does it take to run from 100% to the wanted sus level\r
- (lx*(1024-s_chan[ch].ADSR.SustainLevel))/1024;\r
-#endif\r
}\r
break;\r
//------------------------------------------------// adsr times with pre-calcs\r
s_chan[ch].ADSRX.ReleaseModeExp = (lval&0x0020)?1:0;\r
s_chan[ch].ADSRX.ReleaseRate = lval & 0x001f;\r
//----------------------------------------------//\r
-#if 0\r
- if(!iDebugMode) break;\r
- //----------------------------------------------// stuff below is only for debug mode\r
-\r
- s_chan[ch].ADSR.SustainModeExp = (lval&0x8000)?1:0;\r
- s_chan[ch].ADSR.ReleaseModeExp = (lval&0x0020)?1:0;\r
- \r
- lx=((((lval>>6) & 0x007f)>>2)); // sustain time... often very high\r
- lx=min(31,lx); // values are used to hold the volume\r
- if(lx) // until a sound stop occurs\r
- { // the highest value we reach (due to \r
- lx = (1<<lx); // overflow checking) is: \r
- if(lx<2147483) lx=(lx*SUSTAIN_MS)/10000L; // 94704 seconds = 1578 minutes = 26 hours... \r
- else lx=(lx/10000L)*SUSTAIN_MS; // should be enuff... if the stop doesn't \r
- if(!lx) lx=1; // come in this time span, I don't care :)\r
- }\r
- s_chan[ch].ADSR.SustainTime = lx;\r
-\r
- lx=(lval & 0x001f);\r
- s_chan[ch].ADSR.ReleaseVal =lx;\r
- if(lx) // release time from 100% to 0%\r
- { // note: the release time will be\r
- lx = (1<<lx); // adjusted when a stop is coming,\r
- if(lx<2147483) lx=(lx*RELEASE_MS)/10000L; // so at this time the adsr vol will \r
- else lx=(lx/10000L)*RELEASE_MS; // run from (current volume) to 0%\r
- if(!lx) lx=1;\r
- }\r
- s_chan[ch].ADSR.ReleaseTime=lx;\r
-\r
- if(lval & 0x4000) // add/dec flag\r
- s_chan[ch].ADSR.SustainModeDec=-1;\r
- else s_chan[ch].ADSR.SustainModeDec=1;\r
-#endif\r
}\r
break;\r
//------------------------------------------------// adsr volume... mmm have to investigate this\r