diff options
author | Torbjörn Andersson | 2004-10-22 15:39:28 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2004-10-22 15:39:28 +0000 |
commit | a4eb97da4c00efb14987bb3cc7e2823f0dc7776f (patch) | |
tree | 4f34f2277bc8f4649a5004d3871cea1b7db12cef /backends | |
parent | dc02e95cd7dcd3e17b8763f14deee6d14cebb3ec (diff) | |
download | scummvm-rg350-a4eb97da4c00efb14987bb3cc7e2823f0dc7776f.tar.gz scummvm-rg350-a4eb97da4c00efb14987bb3cc7e2823f0dc7776f.tar.bz2 scummvm-rg350-a4eb97da4c00efb14987bb3cc7e2823f0dc7776f.zip |
Replaced the Bit* data types with ScummVM's int* and uint* types. The
64-bit type has been renamed int64 and uint64. As a consequence, bug
#1051999 (the MinGW compilation problems) is now fixed.
svn-id: r15650
Diffstat (limited to 'backends')
-rw-r--r-- | backends/midi/mt32/mt32.cpp | 2 | ||||
-rw-r--r-- | backends/midi/mt32/partial.cpp | 54 | ||||
-rw-r--r-- | backends/midi/mt32/partial.h | 18 | ||||
-rw-r--r-- | backends/midi/mt32/structures.h | 115 | ||||
-rw-r--r-- | backends/midi/mt32/synth.cpp | 300 | ||||
-rw-r--r-- | backends/midi/mt32/synth.h | 48 |
6 files changed, 264 insertions, 273 deletions
diff --git a/backends/midi/mt32/mt32.cpp b/backends/midi/mt32/mt32.cpp index cb32b6e5e9..c8037e8ca5 100644 --- a/backends/midi/mt32/mt32.cpp +++ b/backends/midi/mt32/mt32.cpp @@ -120,7 +120,7 @@ void MidiDriver_MT32::close() { } void MidiDriver_MT32::generate_samples(int16 *data, int len) { - _synth->MT32_CallBack((Bit8u *)data, len, _mixer->getMusicVolume()); + _synth->MT32_CallBack((uint8 *)data, len, _mixer->getMusicVolume()); } diff --git a/backends/midi/mt32/partial.cpp b/backends/midi/mt32/partial.cpp index fc0cb3997c..97d6813a21 100644 --- a/backends/midi/mt32/partial.cpp +++ b/backends/midi/mt32/partial.cpp @@ -25,7 +25,7 @@ #include "backends/midi/mt32/synth.h" #include "backends/midi/mt32/partial.h" -INLINE void CPartialMT32::generateSamples(Bit16s * partialBuf, long length) { +INLINE void CPartialMT32::generateSamples(int16 * partialBuf, long length) { if (!isActive) return; if (alreadyOutputed) return; @@ -36,11 +36,11 @@ INLINE void CPartialMT32::generateSamples(Bit16s * partialBuf, long length) { int r; int i; - Bit32s envval, ampval, filtval; + int32 envval, ampval, filtval; soundaddr *pOff = &partCache->partialOff; int noteval = partCache->keyedval; for(i=0;i<length;i++) { - Bit32s ptemp = 0; + int32 ptemp = 0; if(partCache->envs[AMPENV].sustaining) { ampval = partCache->ampEnvCache; @@ -135,7 +135,7 @@ INLINE void CPartialMT32::generateSamples(Bit16s * partialBuf, long length) { rb = romfile[taddr+1]; dist = rb-ra; - r = (ra + ((dist * (Bit32s)(pOff->pcmoffs.pcmoffset>>8)) >>8)); + r = (ra + ((dist * (int32)(pOff->pcmoffs.pcmoffset>>8)) >>8)); } else { @@ -189,7 +189,7 @@ INLINE void CPartialMT32::generateSamples(Bit16s * partialBuf, long length) { divis = divtable[noteval]>>15; - if(pOff->pcmoffs.pcmplace>=divis) pOff->pcmoffs.pcmplace = (Bit16u)(pOff->pcmoffs.pcmplace-divis); + if(pOff->pcmoffs.pcmplace>=divis) pOff->pcmoffs.pcmplace = (uint16)(pOff->pcmoffs.pcmplace-divis); toff = pOff->pcmoffs.pcmplace; minorplace = pOff->pcmoffs.pcmoffset >> 14; @@ -198,7 +198,7 @@ INLINE void CPartialMT32::generateSamples(Bit16s * partialBuf, long length) { if(ampval>0) { - filtval = getFiltEnvelope((Bit16s)ptemp,partCache,tmppoly); + filtval = getFiltEnvelope((int16)ptemp,partCache,tmppoly); //LOG_MSG("Filtval: %d", filtval); @@ -282,7 +282,7 @@ INLINE void CPartialMT32::generateSamples(Bit16s * partialBuf, long length) { //Very exact filter //ptemp[t] = (int)iir_filter((float)ptemp[t],&partCache->history[t],filtcoeff[filtval][tcache->filtEnv.resonance]); if(filtval>((FILTERGRAN*15)/16)) filtval = ((FILTERGRAN*15)/16); - ptemp = (Bit32s)(usefilter)((float)ptemp,&partCache->history[0],filtcoeff[filtval][(int)tcache->filtEnv.resonance], tcache->filtEnv.resonance); + ptemp = (int32)(usefilter)((float)ptemp,&partCache->history[0],filtcoeff[filtval][(int)tcache->filtEnv.resonance], tcache->filtEnv.resonance); } else ptemp = 0; //ptemp[t] = Moog1(ptemp[t],&partCache->history[t],(float)filtval/8192.0,tcache->filtEnv.resonance); @@ -304,7 +304,7 @@ INLINE void CPartialMT32::generateSamples(Bit16s * partialBuf, long length) { */ // Fix delta code - __int64 tdelta = (__int64)delta; + int64 tdelta = (int64)delta; tdelta = (tdelta * tcache->fineshift)>>12; tdelta = (tdelta * pdep)>>12; tdelta = (tdelta * lfoat)>>12; @@ -321,23 +321,23 @@ INLINE void CPartialMT32::generateSamples(Bit16s * partialBuf, long length) { partCache->envs[PITCHENV].envpos++; partCache->envs[FILTENV].envpos++; - *partialBuf++ = (Bit16s)ptemp; + *partialBuf++ = (int16)ptemp; } } -INLINE void CPartialMT32::mixBuffers(Bit16s * buf1, Bit16s *buf2, int len) { +INLINE void CPartialMT32::mixBuffers(int16 * buf1, int16 *buf2, int len) { // Early exit if no need to mix if(tibrePair==NULL) return; #if USE_MMX == 0 int i; for(i=0;i<len;i++) { - Bit32s tmp1 = buf1[i]; - Bit32s tmp2 = buf2[i]; + int32 tmp1 = buf1[i]; + int32 tmp2 = buf2[i]; tmp1 += tmp2; - buf1[i] = (Bit16s)tmp1; + buf1[i] = (int16)tmp1; } #else len = (len>>2)+4; @@ -366,7 +366,7 @@ mixloop1: #endif } -INLINE void CPartialMT32::mixBuffersRingMix(Bit16s * buf1, Bit16s *buf2, int len) { +INLINE void CPartialMT32::mixBuffersRingMix(int16 * buf1, int16 *buf2, int len) { #if USE_MMX != 2 int i; for(i=0;i<len;i++) { @@ -376,9 +376,9 @@ INLINE void CPartialMT32::mixBuffersRingMix(Bit16s * buf1, Bit16s *buf2, int len a = (a * b) + a; if(a>1.0) a = 1.0; if(a<-1.0) a = -1.0; - buf1[i] = (Bit16s)(a * 8192.0); + buf1[i] = (int16)(a * 8192.0); - //buf1[i] = (Bit16s)(((Bit32s)buf1[i] * (Bit32s)buf2[i]) >> 10) + buf1[i]; + //buf1[i] = (int16)(((int32)buf1[i] * (int32)buf2[i]) >> 10) + buf1[i]; } #else len = (len>>2)+4; @@ -409,7 +409,7 @@ mixloop2: #endif } -INLINE void CPartialMT32::mixBuffersRing(Bit16s * buf1, Bit16s *buf2, int len) { +INLINE void CPartialMT32::mixBuffersRing(int16 * buf1, int16 *buf2, int len) { #if USE_MMX != 2 int i; for(i=0;i<len;i++) { @@ -419,8 +419,8 @@ INLINE void CPartialMT32::mixBuffersRing(Bit16s * buf1, Bit16s *buf2, int len) { a *= b; if(a>1.0) a = 1.0; if(a<-1.0) a = -1.0; - buf1[i] = (Bit16s)(a * 8192.0); - //buf1[i] = (Bit16s)(((Bit32s)buf1[i] * (Bit32s)buf2[i]) >> 10); + buf1[i] = (int16)(a * 8192.0); + //buf1[i] = (int16)(((int32)buf1[i] * (int32)buf2[i]) >> 10); } #else len = (len>>2)+4; @@ -449,7 +449,7 @@ mixloop3: #endif } -INLINE void CPartialMT32::mixBuffersStereo(Bit16s *buf1, Bit16s *buf2, Bit16s *outBuf, int len) { +INLINE void CPartialMT32::mixBuffersStereo(int16 *buf1, int16 *buf2, int16 *outBuf, int len) { int i,m; m=0; for(i=0;i<len;i++) { @@ -461,7 +461,7 @@ INLINE void CPartialMT32::mixBuffersStereo(Bit16s *buf1, Bit16s *buf2, Bit16s *o } -bool CPartialMT32::produceOutput(Bit16s * partialBuf, long length) { +bool CPartialMT32::produceOutput(int16 * partialBuf, long length) { if (!isActive) return false; if (alreadyOutputed) return false; int i; @@ -488,7 +488,7 @@ bool CPartialMT32::produceOutput(Bit16s * partialBuf, long length) { fwrite(myBuffer + i, 1, 2, fo); fclose(fo); */ - Bit16s * p1buf, * p2buf; + int16 * p1buf, * p2buf; if((partNum==0) || ((partNum==1) && (tibrePair==NULL))) { p1buf = &myBuffer[0]; @@ -526,20 +526,20 @@ bool CPartialMT32::produceOutput(Bit16s * partialBuf, long length) { int m; m = 0; - Bit16s leftvol, rightvol; + int16 leftvol, rightvol; if (!tmppoly->isRy) { leftvol = tmppoly->pansetptr->leftvol; rightvol = tmppoly->pansetptr->rightvol; } else { - leftvol = (Bit16s)drumPan[tmppoly->pcmnum][0]; - rightvol = (Bit16s)drumPan[tmppoly->pcmnum][1]; + leftvol = (int16)drumPan[tmppoly->pcmnum][0]; + rightvol = (int16)drumPan[tmppoly->pcmnum][1]; } #if USE_MMX == 0 for(i=0;i<length;i++) { - partialBuf[m] = (Bit16s)(((Bit32s)p1buf[i] * (Bit32s)leftvol) >> 16); + partialBuf[m] = (int16)(((int32)p1buf[i] * (int32)leftvol) >> 16); m++; - partialBuf[m] = (Bit16s)(((Bit32s)p1buf[i] * (Bit32s)rightvol) >> 16); + partialBuf[m] = (int16)(((int32)p1buf[i] * (int32)rightvol) >> 16); m++; } #else diff --git a/backends/midi/mt32/partial.h b/backends/midi/mt32/partial.h index 769284abf0..8f9014713f 100644 --- a/backends/midi/mt32/partial.h +++ b/backends/midi/mt32/partial.h @@ -36,14 +36,14 @@ private: - Bit16s myBuffer[2048]; + int16 myBuffer[2048]; // For temporary output of paired buffer - Bit16s pairBuffer[2048]; + int16 pairBuffer[2048]; - void mixBuffers(Bit16s * buf1, Bit16s * buf2, int len); - void mixBuffersRingMix(Bit16s * buf1, Bit16s * buf2, int len); - void mixBuffersRing(Bit16s * buf1, Bit16s * buf2, int len); - void mixBuffersStereo(Bit16s * buf1, Bit16s * buf2, Bit16s * outBuf, int len); + void mixBuffers(int16 * buf1, int16 * buf2, int len); + void mixBuffersRingMix(int16 * buf1, int16 * buf2, int len); + void mixBuffersRing(int16 * buf1, int16 * buf2, int len); + void mixBuffersStereo(int16 * buf1, int16 * buf2, int16 * outBuf, int len); public: @@ -59,7 +59,7 @@ public: bool isActive; bool alreadyOutputed; int ownerChan; - Bit64s age; + int64 age; int timbreNum; dpoly *tmppoly; @@ -103,10 +103,10 @@ public: // Returns true only if data written to buffer // This function (unline the one below it) returns processed stereo samples // made from combining this single partial with its pair, if it has one. - bool produceOutput(Bit16s * partialBuf, long length); + bool produceOutput(int16 * partialBuf, long length); // This function produces mono sample output of the specific partial - void generateSamples(Bit16s * partialBuf, long length); + void generateSamples(int16 * partialBuf, long length); }; diff --git a/backends/midi/mt32/structures.h b/backends/midi/mt32/structures.h index 78cf5c1d13..712143ecf7 100644 --- a/backends/midi/mt32/structures.h +++ b/backends/midi/mt32/structures.h @@ -27,21 +27,12 @@ #include "common/scummsys.h" #if defined(_MSC_VER) -typedef unsigned __int64 Bit64u; -typedef signed __int64 Bit64s; +typedef unsigned __int64 uint64; +typedef signed __int64 int64; #else -typedef unsigned long long Bit64u; -typedef signed long long Bit64s; +typedef unsigned long long uint64; +typedef signed long long int64; #endif -typedef unsigned int Bit32u; -typedef signed int Bit32s; -typedef unsigned short int Bit16u; -typedef signed short int Bit16s; -typedef unsigned char Bit8u; -typedef signed char Bit8s; - -// The occurences of __int64 should be changed to Bit64s -#define __int64 Bit64u #define INLINE @@ -266,7 +257,7 @@ static inline float atti386_iir_filter_3dnow(float input,float *hist1_ptr, float return 0; } -static inline void atti386_produceOutput1(int tmplen, Bit16s myvolume, Bit16s *useBuf, Bit16s *snd) +static inline void atti386_produceOutput1(int tmplen, int16 myvolume, int16 *useBuf, int16 *snd) { __asm__ __volatile__( "movl %0, %%ecx \n" \ @@ -298,7 +289,7 @@ static inline void atti386_produceOutput1(int tmplen, Bit16s myvolume, Bit16s *u } // FIXME: This is buggy -static inline void atti386_produceOutput2(Bit32u len, Bit16s *snd, float *sndbufl, float *sndbufr, float *multFactor) +static inline void atti386_produceOutput2(uint32 len, int16 *snd, float *sndbufl, float *sndbufr, float *multFactor) { __asm__ __volatile__( "movl %4, %%ecx \n" \ @@ -339,7 +330,7 @@ static inline void atti386_produceOutput2(Bit32u len, Bit16s *snd, float *sndbuf : "eax", "ecx", "edi", "esi", "mm1", "mm2", "xmm1", "memory"); } -static inline void atti386_mixBuffers(Bit16s * buf1, Bit16s *buf2, int len) +static inline void atti386_mixBuffers(int16 * buf1, int16 *buf2, int len) { __asm__ __volatile__( "movl %0, %%ecx \n" \ @@ -360,7 +351,7 @@ static inline void atti386_mixBuffers(Bit16s * buf1, Bit16s *buf2, int len) : "ecx", "edi", "esi", "mm1", "mm2", "memory"); } -static inline void atti386_mixBuffersRingMix(Bit16s * buf1, Bit16s *buf2, int len) +static inline void atti386_mixBuffersRingMix(int16 * buf1, int16 *buf2, int len) { __asm__ __volatile__( "movl %0, %%ecx \n" \ @@ -383,7 +374,7 @@ static inline void atti386_mixBuffersRingMix(Bit16s * buf1, Bit16s *buf2, int le : "ecx", "edi", "esi", "mm1", "mm2", "mm3", "memory"); } -static inline void atti386_mixBuffersRing(Bit16s * buf1, Bit16s *buf2, int len) +static inline void atti386_mixBuffersRing(int16 * buf1, int16 *buf2, int len) { __asm__ __volatile__( "movl %0, %%ecx \n" \ @@ -404,8 +395,8 @@ static inline void atti386_mixBuffersRing(Bit16s * buf1, Bit16s *buf2, int len) : "ecx", "edi", "esi", "mm1", "mm2", "memory"); } -static inline void atti386_PartProductOutput(int quadlen, Bit16s leftvol, Bit16s rightvol, - Bit16s *partialBuf, Bit16s *p1buf) +static inline void atti386_PartProductOutput(int quadlen, int16 leftvol, int16 rightvol, + int16 *partialBuf, int16 *p1buf) { __asm__ __volatile__( "movl %0, %%ecx \n" \ @@ -583,43 +574,43 @@ struct memAbsolute { #pragma pack() struct partialFormat { - Bit32u addr; - Bit16u len; + uint32 addr; + uint16 len; bool loop; float tune; - Bit32s ampval; + int32 ampval; }; struct partialTable { - Bit32u addr; - Bit32u len; - Bit32u pcmnum; - Bit32s ampval; + uint32 addr; + uint32 len; + uint32 pcmnum; + int32 ampval; bool loop; - Bit32s aggSound; // This variable is for the last 9 PCM samples, which are actually loop combinations + int32 aggSound; // This variable is for the last 9 PCM samples, which are actually loop combinations }; union soundaddr { - Bit32u pcmabs; + uint32 pcmabs; struct offsets { #if defined(SCUMM_LITTLE_ENDIAN) - Bit16u pcmoffset; - Bit16u pcmplace; + uint16 pcmoffset; + uint16 pcmplace; #else - Bit16u pcmplace; - Bit16u pcmoffset; + uint16 pcmplace; + uint16 pcmoffset; #endif } pcmoffs; }; struct volset { - Bit16s leftvol; - Bit16s rightvol; - Bit16s leftvol2; - Bit16s rightvol2; + int16 leftvol; + int16 rightvol; + int16 leftvol2; + int16 rightvol2; }; struct patchCache { @@ -638,7 +629,7 @@ struct patchCache { int lfodepth; int lforate; - Bit32u lfoperiod; + uint32 lfoperiod; int modsense; int keydir; @@ -668,13 +659,13 @@ struct patchCache { timbreParam::partialParam::tvaParam ampEnv; timbreParam::partialParam::tvfParam filtEnv; - Bit32s ampsustain; - Bit32s pitchsustain; - Bit32s filtsustain; + int32 ampsustain; + int32 pitchsustain; + int32 filtsustain; - Bit32u partCount; + uint32 partCount; - Bit8u padding[64]; //Used to pad the patch cache to 4096 bytes. This replaces an imul with a shl 12 + uint8 padding[64]; //Used to pad the patch cache to 4096 bytes. This replaces an imul with a shl 12 }; @@ -686,9 +677,9 @@ struct dpoly { bool partActive[4]; bool isRy; - Bit32u *bendptr; - Bit32u drumbend; - Bit32s *volumeptr; + uint32 *bendptr; + uint32 drumbend; + int32 *volumeptr; volset *pansetptr; int pcmnum; @@ -696,10 +687,10 @@ struct dpoly { int freqnum; int vel; - Bit32u partCount; + uint32 partCount; soundaddr pcmoff; - Bit32u pcmdelta; + uint32 pcmdelta; struct partialStatus { @@ -716,29 +707,29 @@ struct dpoly { int pulsewidth; struct envstatus { - Bit32s envpos; - Bit32s envstat; - Bit32s envbase; - Bit32s envdist; - Bit32s envsize; + int32 envpos; + int32 envstat; + int32 envbase; + int32 envdist; + int32 envsize; bool sustaining; bool decaying; bool notdecayed; - Bit32u decay; - Bit32s prevlevel; + uint32 decay; + int32 prevlevel; - Bit32s counter; - Bit32s count; + int32 counter; + int32 count; } envs[4]; - Bit32u lfopos; + uint32 lfopos; soundaddr partialOff; soundaddr wgOff; - Bit32u ampEnvCache; - Bit32u pitchEnvCache; + uint32 ampEnvCache; + uint32 pitchEnvCache; bool isDecayed; bool PCMDone; @@ -772,8 +763,8 @@ struct dpoly { bool pedalhold; bool firstsamp; - Bit32u P1Mix; - Bit32u P2Mix; + uint32 P1Mix; + uint32 P2Mix; bool sustain; }; diff --git a/backends/midi/mt32/synth.cpp b/backends/midi/mt32/synth.cpp index 3fa2181bd6..dca5c68b07 100644 --- a/backends/midi/mt32/synth.cpp +++ b/backends/midi/mt32/synth.cpp @@ -372,7 +372,7 @@ bool Detect3DNow() #define SYSEX_SIZE 512 // These are all the filters I tried without much success -Bit16s Moog1(Bit16s wg, float *hist, float usefilt, float res) { +int16 Moog1(int16 wg, float *hist, float usefilt, float res) { float f, p, q; //filter coefficients float t1, t2; //temporary buffers @@ -404,10 +404,10 @@ Bit16s Moog1(Bit16s wg, float *hist, float usefilt, float res) { hist[4] = hist[4] - hist[4] * hist[4] * hist[4] * 0.166667f; //clipping hist[0] = in; //LOG_MSG("In %d Hist: %f", wg, hist[4]*32767); - return (Bit16s)(hist[4]*32767.0); + return (int16)(hist[4]*32767.0); } -Bit16s Moog2(Bit16s wg, float *hist, float usefilt, float resonance) { +int16 Moog2(int16 wg, float *hist, float usefilt, float resonance) { float res = resonance / 30.0; double f = usefilt; @@ -424,10 +424,10 @@ Bit16s Moog2(Bit16s wg, float *hist, float usefilt, float resonance) { hist[7] = hist[2]; hist[4] = hist[3] + 0.3 * hist[0] + (invf) * hist[4]; // Pole 4 hist[0] = hist[3]; - return (Bit16s)(hist[4]*32767.0); + return (int16)(hist[4]*32767.0); } -Bit16s simpleLowpass(Bit16s wg, float *hist, float usefilt, float resonance) { +int16 simpleLowpass(int16 wg, float *hist, float usefilt, float resonance) { float in = (float)wg/32767.0; float res_lp = resonance / 31.0; @@ -1012,11 +1012,11 @@ float iir_filter_normal(float input,float *hist1_ptr, float *coef_ptr, int revLe #if FILTER_64BIT == 1 // 64-bit version -long iir_filter(long input, __int64 *hist1_ptr, __int64 *coef_ptr) +long iir_filter(long input, int64 *hist1_ptr, int64 *coef_ptr) { unsigned int i; - __int64 *hist2_ptr; - __int64 output,new_hist,history1,history2; + int64 *hist2_ptr; + int64 output,new_hist,history1,history2; hist2_ptr = hist1_ptr + 1; // next history @@ -1084,17 +1084,17 @@ long iir_filter(long input, signed long *hist1_ptr, signed long *coef_ptr) partialFormat PCM[54]; partialTable PCMList[128]; -Bit32u PCMReassign[55]; -Bit32s PCMLoopTable[55]; +uint32 PCMReassign[55]; +int32 PCMLoopTable[55]; timbreParam drums[30]; -Bit16s romfile[PCMSIZE+GRAN]; // 256K -static Bit16s chantable[32]; // 64 bytes -static Bit16s miditable[9]; // 18 bytes +int16 romfile[PCMSIZE+GRAN]; // 256K +static int16 chantable[32]; // 64 bytes +static int16 miditable[9]; // 18 bytes static CPartialMT32 *partTable[MAXPARTIALS]; -static Bit32s PartialReserveTable[32]; +static int32 PartialReserveTable[32]; // For debuging partial allocation //static FILE *pInfo; @@ -1105,89 +1105,89 @@ struct partUsage { int status[32]; }; -static Bit32s activeChannels; +static int32 activeChannels; // Some optimization stuff -Bit32s divtable[256]; // 1K -Bit32s smalldivtable[256]; // 1K -static Bit16s freqtable[256]; // 512 bytes -static Bit32u sqrtable[101]; // 404 bytes -static Bit32s keytable[256]; // 1K -static Bit32u wavtable[256]; // 1K -Bit32u wavtabler[64][256]; // 64K -Bit32u looptabler[16][16][256]; // 256K -static Bit32u drumdelta[256]; // 1K -Bit16s sintable[65536]; // 128K -static Bit32s ptable[101]; // 404 bytes -static Bit32s lfotable[101]; // 404 bytes -Bit32s penvtable[16][128]; // 8K -static Bit32s fildeptable[5][128]; // 3K -static Bit32s timekeytable[5][128]; // 3K -static Bit32s filveltable[128][128]; // 64K -static Bit32s veltkeytable[5][128]; // 3K -Bit32s pulsetable[101]; // 400 bytes -Bit32s pulseoffset[101]; // 400 bytes -Bit32s sawtable[128][128]; // 64K -static Bit32s restable[201]; // 804 bytes -//static Bit32s biastable[13]; // 56 bytes -static Bit32s ampbiastable[16][128]; // 8K -static Bit32s fbiastable[16][128]; // 8K +int32 divtable[256]; // 1K +int32 smalldivtable[256]; // 1K +static int16 freqtable[256]; // 512 bytes +static uint32 sqrtable[101]; // 404 bytes +static int32 keytable[256]; // 1K +static uint32 wavtable[256]; // 1K +uint32 wavtabler[64][256]; // 64K +uint32 looptabler[16][16][256]; // 256K +static uint32 drumdelta[256]; // 1K +int16 sintable[65536]; // 128K +static int32 ptable[101]; // 404 bytes +static int32 lfotable[101]; // 404 bytes +int32 penvtable[16][128]; // 8K +static int32 fildeptable[5][128]; // 3K +static int32 timekeytable[5][128]; // 3K +static int32 filveltable[128][128]; // 64K +static int32 veltkeytable[5][128]; // 3K +int32 pulsetable[101]; // 400 bytes +int32 pulseoffset[101]; // 400 bytes +int32 sawtable[128][128]; // 64K +static int32 restable[201]; // 804 bytes +//static int32 biastable[13]; // 56 bytes +static int32 ampbiastable[16][128]; // 8K +static int32 fbiastable[16][128]; // 8K static int filttable[2][128][256]; // 256K static int nfilttable[128][128][128]; // 64K float filtcoeff[FILTERGRAN][32][16]; // 512K - hmmm #if FILTER_64BIT == 1 -static __int64 filtcoefffix[FILTERGRAN][32][16]; +static int64 filtcoefffix[FILTERGRAN][32][16]; #endif #if FILTER_INT == 1 -static Bit32s filtcoefffix[FILTERGRAN][32][16]; +static int32 filtcoefffix[FILTERGRAN][32][16]; #endif static float revtable[8]; // 16 bytes -static Bit32s finetable[201]; // 804 bytes -Bit32u lfoptable[101][128]; // 32K -Bit32s ampveltable[128][64]; // 32K -Bit32s pwveltable[15][128]; -static Bit32s envtimetable[101]; // 404 bytes -static Bit32s decaytimetable[101]; // 404 bytes -static Bit32s lasttimetable[101]; // 404 bytes -Bit32s amptable[129]; // 516 bytes -static Bit32s voltable[129]; // 516 bytes +static int32 finetable[201]; // 804 bytes +uint32 lfoptable[101][128]; // 32K +int32 ampveltable[128][64]; // 32K +int32 pwveltable[15][128]; +static int32 envtimetable[101]; // 404 bytes +static int32 decaytimetable[101]; // 404 bytes +static int32 lasttimetable[101]; // 404 bytes +int32 amptable[129]; // 516 bytes +static int32 voltable[129]; // 516 bytes static float padjtable[51]; // 204 bytes -static Bit32s bendtable[49]; // 195 bytes +static int32 bendtable[49]; // 195 bytes float ResonFactor[32]; float ResonInv[32]; -Bit16s smallnoise[441]; // 4410 bytes at 44Khz -Bit32s samplepos = 0; +int16 smallnoise[441]; // 4410 bytes at 44Khz +int32 samplepos = 0; -Bit16s* waveforms[4][256]; // 2K -Bit32u waveformsize[4][256]; -Bit16s tmpforms[4][65536]; // 128K -Bit16s finalforms[4][8192]; // 64K +int16* waveforms[4][256]; // 2K +uint32 waveformsize[4][256]; +int16 tmpforms[4][65536]; // 128K +int16 finalforms[4][8192]; // 64K // Corresponding drum patches as matched to keyboard -Bit8s DrumTable[42] = { +int8 DrumTable[42] = { 0, 0, 10, 1, 11, 5, 4, 6, 4, 29, 3, 7, 3, 2, 8, 2, 9, -1, -1, 22, -1, 12, -1, -1, -1, 18, 19, 13, 14, 15, 16, 17, 20, 21, 27, 24, 26, 25, 28, -1, 23, -1 }; // Pan-pot position of drums -Bit16s drmPanTable[42] = { +int16 drmPanTable[42] = { 64, 64, 72, 64, 48, 72, 24, 72, 24, 72, 48, 72, 48, 96, 72, 96, 48, 1, 1, 40, 1, 64, 1, 1, 1, 104, 88, 48, 40, 32, 64, 80, 104 , 104, 40, 88, 40, 40, 32, 1, 16, 1 }; -Bit8u PartialStruct[13] = { +uint8 PartialStruct[13] = { 0, 0, 2, 2, 1, 3, 3, 0, 3, 0, 2, 1, 3 }; -Bit8u PartMixStruct[13] = { +uint8 PartMixStruct[13] = { 0, 1, 0, 1, 1, 0, 1, 3, 3, 2, 2, 2, 2 }; -Bit8u InitInstr[8] = { +uint8 InitInstr[8] = { 68, 48, 95, 78, 41, 3, 110, 122}; -Bit8s LoopPatterns[16][16] = { +int8 LoopPatterns[16][16] = { { 2,3,4,5,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 8,9,10,11,12,13,14,15,16,-1,-1,-1,-1,-1,-1,-1 }, { 17,18,19,20,21,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, @@ -1207,7 +1207,7 @@ Bit8s LoopPatterns[16][16] = { }; -Bit32s LoopPatternTuning[16][16] = { +int32 LoopPatternTuning[16][16] = { { 0x1294A,0x1294A,0x1294A,0x1294A,0x1294A,0x1294A,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 0x1294A,0x1294A,0x1294A,0x1294A,0x1294A,0x1294A,0x1294A,0x1294A, 0x1294A,-1,-1,-1,-1,-1,-1,-1 }, { 0x1294A,0x1294A,0x1294A,0x1294A,0x1294A,0x1294A,0x1294A,0x1294A, 0x1294A,-1,-1,-1,-1,-1,-1,-1 }, @@ -1229,7 +1229,7 @@ Bit32s LoopPatternTuning[16][16] = { // These are division constants for the TVF depth key follow -Bit32u depexp[5] = {3000,950,485,255,138}; +uint32 depexp[5] = {3000,950,485,255,138}; //Amplitude time velocity follow exponential coefficients double tvcatconst[5] = {0.0, 0.002791309, 0.005942882, 0.012652792, 0.026938637}; @@ -1250,18 +1250,18 @@ Reverb *myReverb; revmodel *newReverb; bool usingSIMD; -Bit16s mastervolume; +int16 mastervolume; -Bit32u curRevMode; -Bit32u curRevTime; -Bit32u curRevLevel; +uint32 curRevMode; +uint32 curRevTime; +uint32 curRevLevel; -Bit32u partialsPlayed; // Variable containing the whole count of partials played -Bit32u avgPartials; // Tally of average number of partials a second -Bit32s partialChan[9]; // The count of partials played per channel +uint32 partialsPlayed; // Variable containing the whole count of partials played +uint32 avgPartials; // Tally of average number of partials a second +int32 partialChan[9]; // The count of partials played per channel #if SAVECUSTOM == 1 -Bit32u filenum = 0; +uint32 filenum = 0; #endif /* @@ -1280,7 +1280,7 @@ revstate = running values for event reverb -void InitReverb(Bit32u newRevMode, Bit32u newRevTime, Bit32u sampRate) { +void InitReverb(uint32 newRevMode, uint32 newRevTime, uint32 sampRate) { if(newReverb != NULL) delete newReverb; newReverb = new revmodel(); @@ -1352,8 +1352,8 @@ public: patchCache pcache[4]; - Bit32u bend; - Bit32s volume; + uint32 bend; + int32 volume; dpoly polyTable[MAXPOLY]; @@ -1378,8 +1378,8 @@ private: bool sustain; bool init; - Bit32u P1Mix; - Bit32u P2Mix; + uint32 P1Mix; + uint32 P2Mix; bool holdpedal; @@ -1406,11 +1406,11 @@ public: int FixKeyfollow(int srckey, int *dir); int FixBiaslevel(int srcpnt, int *dir); - //Bit32s getPitchEnvelope(dpoly::partialStatus *pStat, dpoly *poly, bool inDecay); - //Bit32s getAmpEnvelope(dpoly::partialStatus *pStat, dpoly *poly, bool inDecay); - //Bit32s getFiltEnvelope(Bit16s wg, dpoly::partialStatus *pStat, dpoly *poly, bool inDecay); + //int32 getPitchEnvelope(dpoly::partialStatus *pStat, dpoly *poly, bool inDecay); + //int32 getAmpEnvelope(dpoly::partialStatus *pStat, dpoly *poly, bool inDecay); + //int32 getFiltEnvelope(int16 wg, dpoly::partialStatus *pStat, dpoly *poly, bool inDecay); - //void StartDecay(int envnum, Bit32s startval, dpoly::partialStatus *pStat, dpoly *poly); + //void StartDecay(int envnum, int32 startval, dpoly::partialStatus *pStat, dpoly *poly); }; @@ -1441,7 +1441,7 @@ void MidiChannel::SetModulation(int vol) { } -INLINE void StartDecay(int envnum, Bit32s startval, dpoly::partialStatus *pStat, dpoly *poly) { +INLINE void StartDecay(int envnum, int32 startval, dpoly::partialStatus *pStat, dpoly *poly) { patchCache *tcache = pStat->tcache; dpoly::partialStatus::envstatus *tStat = &pStat->envs[envnum]; @@ -1476,8 +1476,8 @@ INLINE void StartDecay(int envnum, Bit32s startval, dpoly::partialStatus *pStat, -INLINE Bit32s getAmpEnvelope(dpoly::partialStatus *pStat, dpoly *poly) { - Bit32s tc; +INLINE int32 getAmpEnvelope(dpoly::partialStatus *pStat, dpoly *poly) { + int32 tc; patchCache *tcache = pStat->tcache; dpoly::partialStatus::envstatus *tStat = &pStat->envs[AMPENV]; @@ -1563,7 +1563,7 @@ INLINE Bit32s getAmpEnvelope(dpoly::partialStatus *pStat, dpoly *poly) { PastCalc: - tc = (tc * (Bit32s)tcache->amplevel) >> 7; + tc = (tc * (int32)tcache->amplevel) >> 7; } @@ -1619,11 +1619,11 @@ PastCalc: } -INLINE Bit32s getPitchEnvelope(dpoly::partialStatus *pStat, dpoly *poly) { +INLINE int32 getPitchEnvelope(dpoly::partialStatus *pStat, dpoly *poly) { patchCache *tcache = pStat->tcache; dpoly::partialStatus::envstatus *tStat = &pStat->envs[PITCHENV]; - Bit32s tc; + int32 tc; pStat->pitchsustain = false; if(tStat->decaying) { @@ -1671,12 +1671,12 @@ INLINE Bit32s getPitchEnvelope(dpoly::partialStatus *pStat, dpoly *poly) { } -INLINE Bit32s getFiltEnvelope(Bit16s wg, dpoly::partialStatus *pStat, dpoly *poly) { +INLINE int32 getFiltEnvelope(int16 wg, dpoly::partialStatus *pStat, dpoly *poly) { int reshigh; //float *hist = pStat->history; - //__int64 *hist = pStat->history; + //int64 *hist = pStat->history; //long *hist = pStat->history; int filt,cutoff,depth,keyfollow, realfollow; @@ -1767,7 +1767,7 @@ INLINE Bit32s getFiltEnvelope(Bit16s wg, dpoly::partialStatus *pStat, dpoly *pol reshigh = (reshigh * depth) >> 7; - Bit32s tmp; + int32 tmp; cutoff *= keyfollow; cutoff /= realfollow; @@ -1980,9 +1980,9 @@ void MidiChannel::SetPatch(int patchnum,int drumNum) { // Calculate and cache pitch stuff pcache[t].pitchshift = (timSrc.partial[t].wg.coarse+mt32ram.params.pSettings[patchnum].keyShift); - Bit32s pFine, tFine, fShift; - pFine = (Bit32s)timSrc.partial[t].wg.fine; - tFine = (Bit32s)mt32ram.params.pSettings[patchnum].fineTune; + int32 pFine, tFine, fShift; + pFine = (int32)timSrc.partial[t].wg.fine; + tFine = (int32)mt32ram.params.pSettings[patchnum].fineTune; fShift = ((pFine - 50) + (tFine - 50)) + 100; pcache[t].fineshift = finetable[fShift]; @@ -2067,16 +2067,16 @@ void MidiChannel::SetPan(int pan) { //LOG(LOG_ERROR|LOG_MISC,"Pan %d",panpot); } -INLINE Bit16s RingMod(Bit16s p1, Bit16s p2, bool useFirst) { +INLINE int16 RingMod(int16 p1, int16 p2, bool useFirst) { if(useFirst) { - //return (Bit16s)( ( ((float)p1/32767.0) * ((float)p2/32767.0) ) * 32767); - return (Bit16s)( ((Bit32s)p1 * (Bit32s)p2) >> 15); + //return (int16)( ( ((float)p1/32767.0) * ((float)p2/32767.0) ) * 32767); + return (int16)( ((int32)p1 * (int32)p2) >> 15); } else { // An interesting undocumented feature of the MT-32 // Putting ring mod on a muted partial introduces noise to the ring modulator // Dune 2 makes use of this - return (Bit16s)( ((Bit32s)smallnoise[samplepos/100] * (Bit32s)p2) >> 15); + return (int16)( ((int32)smallnoise[samplepos/100] * (int32)p2) >> 15); } } @@ -2522,7 +2522,7 @@ bool FreePartials(int needed, int chanNum) { }*/ // Then kill those with the lowest channel priority --- oldest at the moment bool found; - Bit64s prior, priornum; + int64 prior, priornum; dpoly *killPoly; found = true; while(found) { @@ -2562,7 +2562,7 @@ bool FreePartials(int needed, int chanNum) { // Kill off the oldest partials within this channel - Bit64s oldest, oldlist; + int64 oldest, oldlist; while(needed>0) { oldest = -1; @@ -2945,7 +2945,7 @@ bool CSynthMT32::InitTables(const char *baseDir ) { square=0; saw = 0; bool odd = true; - for(Bit32s sinus=1;(sinus*freq)<(SETRATE);sinus++) { + for(int32 sinus=1;(sinus*freq)<(SETRATE);sinus++) { float sinusval = (((1.0/((float)sinus))*(sin(((float)sinus)*sa)))); saw=saw + sinusval; } @@ -2977,7 +2977,7 @@ bool CSynthMT32::InitTables(const char *baseDir ) { waveformsize[3][f] = fa*4; for (int i = 0; i < 4; ++i) { - waveforms[i][f] = (Bit16s *)malloc(waveformsize[i][f]); + waveforms[i][f] = (int16 *)malloc(waveformsize[i][f]); memcpy(waveforms[i][f], &tmpforms[i][0],waveformsize[i][f]); // TODO / FIXME: The following code is not endian safe! out = fp.write(waveforms[i][f],waveformsize[i][f]); @@ -2987,7 +2987,7 @@ bool CSynthMT32::InitTables(const char *baseDir ) { waveformsize[3][f] = divtable[f]>>12; for (int i = 0; i < 4; ++i) { - waveforms[i][f] = (Bit16s *)malloc(waveformsize[i][f]); + waveforms[i][f] = (int16 *)malloc(waveformsize[i][f]); for (uint j = 0; j < waveformsize[i][f]/2; ++j) waveforms[i][f][j] = fp.readSint16LE(); } @@ -3086,7 +3086,7 @@ bool CSynthMT32::InitTables(const char *baseDir ) { // 64-bit variant #if FILTER_64BIT == 1 for(int co=0;co<9;co++) { - filtcoefffix[j][res][co] = (__int64)(filtcoeff[j][res][co] * pow(2,20)); + filtcoefffix[j][res][co] = (int64)(filtcoeff[j][res][co] * pow(2,20)); } #endif @@ -3136,7 +3136,7 @@ bool CSynthMT32::InitTables(const char *baseDir ) { float fldep = fabs((float)dep) / 7.0; fldep = pow((float)fldep,(float)2.5); if(dep<0) fldep = fldep * -1.0; - pwveltable[dep+7][velt] = Bit32s((fldep * (float)velt * 100) / 128.0); + pwveltable[dep+7][velt] = int32((fldep * (float)velt * 100) / 128.0); } } @@ -3238,7 +3238,7 @@ bool CSynthMT32::InitTables(const char *baseDir ) { int myRand; myRand = rand(); myRand = ((myRand - 16383) * WGAMP) >> 18; - smallnoise[lf] = (Bit16s)myRand; + smallnoise[lf] = (int16)myRand; } for(lf=0;lf<=100;lf++) { @@ -3284,7 +3284,7 @@ bool CSynthMT32::InitTables(const char *baseDir ) { /* // I am certain of this: Verified by hand LFO log */ - lfotable[lf] = (Bit32s)(((float)SETRATE) / (pow((float)1.088883372,(float)lf) * 0.021236044)); + lfotable[lf] = (int32)(((float)SETRATE) / (pow((float)1.088883372,(float)lf) * 0.021236044)); //LOG_MSG("lf %d = lfo %d pulsetable %d", lf, lfotable[lf], pulsetable[lf]); } @@ -3392,7 +3392,7 @@ bool CSynthMT32::InitTables(const char *baseDir ) { // Benchmark 3DNow, Floating point, and SSE filters /* - Bit32u bench; + uint32 bench; __time64_t start, end; float histval[50]; @@ -3481,11 +3481,11 @@ BOOL RecalcWaveforms(char * baseDir, int sampRate, recalcStatusCallback callBack dumbfire = sa /2 ; //This works pretty good - tmpforms[2][fa>>4] += (Bit16s)(cos(dumbfire) * -ampsize); - tmpforms[3][fa>>3] += (Bit16s)(cos(sa-PI) * -ampsize); + tmpforms[2][fa>>4] += (int16)(cos(dumbfire) * -ampsize); + tmpforms[3][fa>>3] += (int16)(cos(sa-PI) * -ampsize); - tmpforms[0][fa>>4] += (Bit16s)(saw * -ampsize); - tmpforms[1][fa>>4] += (Bit16s)(saw * ampsize); + tmpforms[0][fa>>4] += (int16)(saw * -ampsize); + tmpforms[1][fa>>4] += (int16)(saw * ampsize); fa++; sa+=sd; @@ -3526,13 +3526,13 @@ bool CSynthMT32::ClassicOpen(const char *baseDir, SynthProperties useProp) { if (isOpen) return false; int i; // Initalize patch information - Bit8u sysexBuf[SYSEX_SIZE]; - Bit16u syslen = 0; + uint8 sysexBuf[SYSEX_SIZE]; + uint16 syslen = 0; bool inSys = false; File fp; - Bit8u c; + uint8 c; myProp = useProp; @@ -3692,10 +3692,10 @@ bool CSynthMT32::ClassicOpen(const char *baseDir, SynthProperties useProp) { char tbuf[512]; char *cp; fPatch.gets(tbuf,sizeof(tbuf)); - Bit32u patchstart = 0; //axtoi(tbuf); - Bit32u patchend = 0; - Bit32u patchcount = 0; - //Bit16s *romaddr = &romfile[0]; + uint32 patchstart = 0; //axtoi(tbuf); + uint32 patchend = 0; + uint32 patchcount = 0; + //int16 *romaddr = &romfile[0]; while (!fPatch.eof()) { fPatch.gets(tbuf,sizeof(tbuf)); cp = strtok(tbuf," \n\r"); @@ -3836,9 +3836,9 @@ bool CSynthMT32::ClassicOpen(const char *baseDir, SynthProperties useProp) { //exit(0); } i=0; - //Bit32s maxamp = 0; + //int32 maxamp = 0; while (!fIn.eof()) { - Bit16s s, c1; + int16 s, c1; s = fIn.readByte(); c1 = fIn.readByte(); @@ -3865,7 +3865,7 @@ bool CSynthMT32::ClassicOpen(const char *baseDir, SynthProperties useProp) { } //if( (e & 0x1) != 0) printf("Last bit = %d\n", e & 0x1); - //Bit16s e = ( ((s & 0x7f) << 4) | ((c1 & 0x40) << 6) | ((s & 0x80) << 6) | ((c1 & 0x3f))) << 2; + //int16 e = ( ((s & 0x7f) << 4) | ((c1 & 0x40) << 6) | ((s & 0x80) << 6) | ((c1 & 0x3f))) << 2; if(e<0) e = -32767 - e; int ut = abs(e); int dif = 0x7fff - ut; @@ -3911,11 +3911,11 @@ bool CSynthMT32::ClassicOpen(const char *baseDir, SynthProperties useProp) { if (e>0) vol = -vol; - romfile[i] = (Bit16s)vol; + romfile[i] = (int16)vol; #ifdef MT32OUT - tmpc = (Bit16s)vol & 0xff; fOutb.write(&tmpc, 1); - tmpc = (Bit16s)vol >> 8; fOutb.write(&tmpc, 1); + tmpc = (int16)vol & 0xff; fOutb.write(&tmpc, 1); + tmpc = (int16)vol >> 8; fOutb.write(&tmpc, 1); #endif i++; @@ -4005,7 +4005,7 @@ void CSynthMT32::Close(void) { } -void CSynthMT32::PlayMsg(Bit32u msg) { +void CSynthMT32::PlayMsg(uint32 msg) { #ifdef NOMANSLAND @@ -4038,7 +4038,7 @@ void CSynthMT32::PlayMsg(Bit32u msg) { int patch; - Bit32u bend; + uint32 bend; //LOG_MSG("Midi code: 0x%x",msg); switch (code) { @@ -4125,23 +4125,23 @@ void CSynthMT32::PlayMsg(Bit32u msg) { //midiOutShortMsg(m_out, msg); } -void CSynthMT32::PlaySysex(Bit8u * sysex,Bit32u len) { +void CSynthMT32::PlaySysex(uint8 * sysex,uint32 len) { #ifdef NOMANSLAND - Bit32u addr; - Bit32u *header; + uint32 addr; + uint32 *header; unsigned int off; int m; - header = (Bit32u *)(sysex+1); + header = (uint32 *)(sysex+1); //int dummy = 0; - Bit32s lens = len; + int32 lens = len; // For some reason commands in IMuseInternal::initMT32 do not have prefix byte if(READ_LE_UINT32(header) != 0x12161041) { if(READ_LE_UINT32(sysex) == 0x12161041) { - header = (Bit32u *)sysex; + header = (uint32 *)sysex; sysex--; // We don't access sysex[0], so it's safe } } @@ -4250,7 +4250,7 @@ void CSynthMT32::PlaySysex(Bit8u * sysex,Bit32u len) { //LOG_MSG("Reverb time: %d", mt32ram.params.system.reverbTime); //LOG_MSG("Reverb level: %d", mt32ram.params.system.reverbLevel); - if(((Bit32u)mt32ram.params.system.reverbMode != curRevMode) || ((Bit32u)mt32ram.params.system.reverbTime!=curRevTime)) { + if(((uint32)mt32ram.params.system.reverbMode != curRevMode) || ((uint32)mt32ram.params.system.reverbTime!=curRevTime)) { if(myProp.UseDefault) { InitReverb(mt32ram.params.system.reverbMode, mt32ram.params.system.reverbTime,SETRATE); curRevLevel = mt32ram.params.system.reverbLevel; @@ -4275,7 +4275,7 @@ void CSynthMT32::PlaySysex(Bit8u * sysex,Bit32u len) { rset = mt32ram.params.system.chanAssign; //LOG_MSG("Chan assign: 1=%d 2=%d 3=%d 4=%d 5=%d 6=%d 7=%d 8=%d 9=%d", rset[0], rset[1], rset[2], rset[3], rset[4], rset[5], rset[6], rset[7], rset[8]); //LOG_MSG("Master volume: %d",mt32ram.params.system.masterVol); - Bit16s tv = (Bit16s)((float)mt32ram.params.system.masterVol * 327.0); + int16 tv = (int16)((float)mt32ram.params.system.masterVol * 327.0); mastervolume = tv; } @@ -4288,7 +4288,7 @@ void CSynthMT32::PlaySysex(Bit8u * sysex,Bit32u len) { } if ((addr & 0xff0000) == 0x7f0000) { //LOG_MSG("MT-32 Reset"); - for (Bit32u m1=0;m1<MAXPARTIALS;m1++) partTable[m1]->isActive = false; + for (uint32 m1=0;m1<MAXPARTIALS;m1++) partTable[m1]->isActive = false; memcpy(&mt32ram, &mt32default, sizeof(mt32ram)); isEnabled = false; @@ -4356,7 +4356,7 @@ int CSynthMT32::DumpSysex(char *filename) { -static Bit16s tmpBuffer[4096]; +static int16 tmpBuffer[4096]; static float sndbufl[4096]; static float sndbufr[4096]; static float outbufl[4096]; @@ -4366,13 +4366,13 @@ static float outbufr[4096]; static float multFactor[4] = { 32767.0, 32767.0, 32767.0, 32767.0 }; #endif -void CSynthMT32::MT32_CallBack(Bit8u * stream,Bit32u len, int volume) { +void CSynthMT32::MT32_CallBack(uint8 * stream,uint32 len, int volume) { #ifdef NOMANSLAND - Bit32s i,m; - Bit16s *snd, *useBuf; - Bit32u outlen; - snd = (Bit16s *)stream; + int32 i,m; + int16 *snd, *useBuf; + uint32 outlen; + snd = (int16 *)stream; memset(stream,0,len*4); if(!isEnabled) return; useBuf = snd; @@ -4399,12 +4399,12 @@ void CSynthMT32::MT32_CallBack(Bit8u * stream,Bit32u len, int volume) { if(partTable[i]->produceOutput(tmpBuffer,outlen)==true) { #if USE_MMX == 0 - Bit16s *tmpoff = snd; + int16 *tmpoff = snd; int q = 0; - for(m=0;m<(Bit32s)outlen;m++) { - tmpoff[q] += (Bit16s)(((Bit32s)tmpBuffer[q] * (Bit32s)mastervolume)>>15); + for(m=0;m<(int32)outlen;m++) { + tmpoff[q] += (int16)(((int32)tmpBuffer[q] * (int32)mastervolume)>>15); q++; - tmpoff[q] += (Bit16s)(((Bit32s)tmpBuffer[q] * (Bit32s)mastervolume)>>15); + tmpoff[q] += (int16)(((int32)tmpBuffer[q] * (int32)mastervolume)>>15); q++; } @@ -4449,7 +4449,7 @@ mixloop4: if(!usingSIMD) { #endif m=0; - for(i=0;i<(Bit32s)len;i++) { + for(i=0;i<(int32)len;i++) { sndbufl[i] = (float)snd[m] / 32767.0; m++; sndbufr[i] = (float)snd[m] / 32767.0; @@ -4457,10 +4457,10 @@ mixloop4: } newReverb->processreplace(sndbufl, sndbufr, outbufl, outbufr, len, 1); m=0; - for(i=0;i<(Bit32s)len;i++) { - snd[m] = (Bit16s)(outbufl[i] * 32767.0); + for(i=0;i<(int32)len;i++) { + snd[m] = (int16)(outbufl[i] * 32767.0); m++; - snd[m] = (Bit16s)(outbufr[i] * 32767.0); + snd[m] = (int16)(outbufr[i] * 32767.0); m++; } #if USE_MMX == 3 diff --git a/backends/midi/mt32/synth.h b/backends/midi/mt32/synth.h index 1978a17a2f..b16308a795 100644 --- a/backends/midi/mt32/synth.h +++ b/backends/midi/mt32/synth.h @@ -103,32 +103,32 @@ typedef float (*iir_filter_type)(float input,float *hist1_ptr, float *coef_ptr, extern iir_filter_type usefilter; extern partialFormat PCM[54]; -extern Bit16s romfile[262656]; -extern Bit32s divtable[256]; -extern Bit32s smalldivtable[256]; -extern Bit32u wavtabler[64][256]; -extern Bit32u looptabler[16][16][256]; -extern Bit16s sintable[65536]; -extern Bit32s penvtable[16][128]; -extern Bit32s pulsetable[101]; -extern Bit32s pulseoffset[101]; -extern Bit32s sawtable[128][128]; +extern int16 romfile[262656]; +extern int32 divtable[256]; +extern int32 smalldivtable[256]; +extern uint32 wavtabler[64][256]; +extern uint32 looptabler[16][16][256]; +extern int16 sintable[65536]; +extern int32 penvtable[16][128]; +extern int32 pulsetable[101]; +extern int32 pulseoffset[101]; +extern int32 sawtable[128][128]; extern float filtcoeff[FILTERGRAN][32][16]; -extern Bit32u lfoptable[101][128]; -extern Bit32s ampveltable[128][64]; -extern Bit32s amptable[129]; -extern Bit16s smallnoise[441]; -extern Bit32s samplepos; -extern Bit16s* waveforms[4][256]; -extern Bit32u waveformsize[4][256]; -extern Bit8s LoopPatterns[16][16]; +extern uint32 lfoptable[101][128]; +extern int32 ampveltable[128][64]; +extern int32 amptable[129]; +extern int16 smallnoise[441]; +extern int32 samplepos; +extern int16* waveforms[4][256]; +extern uint32 waveformsize[4][256]; +extern int8 LoopPatterns[16][16]; extern int drumPan[30][2]; extern float ResonFactor[32]; extern float ResonInv[32]; -extern Bit32s getPitchEnvelope(dpoly::partialStatus *pStat, dpoly *poly); -extern Bit32s getAmpEnvelope(dpoly::partialStatus *pStat, dpoly *poly); -extern Bit32s getFiltEnvelope(Bit16s wg, dpoly::partialStatus *pStat, dpoly *poly); +extern int32 getPitchEnvelope(dpoly::partialStatus *pStat, dpoly *poly); +extern int32 getAmpEnvelope(dpoly::partialStatus *pStat, dpoly *poly); +extern int32 getFiltEnvelope(int16 wg, dpoly::partialStatus *pStat, dpoly *poly); class CSynthMT32 { private: @@ -152,10 +152,10 @@ public: void Close(void); // Sends a 4-byte MIDI message to the MT-32 for immediate playback - void PlayMsg(Bit32u msg); + void PlayMsg(uint32 msg); // Sends a string of Sysex commands to the MT-32 for immediate interpretation - void PlaySysex(Bit8u * sysex, Bit32u len); + void PlaySysex(uint8 * sysex, uint32 len); // Save the system state to a sysex file specified by filename int DumpSysex(char *filename); @@ -163,7 +163,7 @@ public: // This callback routine is used to have the MT-32 generate samples to the specified // output stream. The length is in whole samples, not bytes. (I.E. in 16-bit stereo, // one sample is 4 bytes) - void MT32_CallBack(Bit8u * stream, Bit32u len, int volume); + void MT32_CallBack(uint8 * stream, uint32 len, int volume); }; |