diff options
Diffstat (limited to 'src/emu/sound')
33 files changed, 119 insertions, 86 deletions
diff --git a/src/emu/sound/c140.c b/src/emu/sound/c140.c index 180a34b2bab..9cc4922a1e2 100644 --- a/src/emu/sound/c140.c +++ b/src/emu/sound/c140.c @@ -138,7 +138,7 @@ static long find_sample(struct c140_info *info, long adrs, long bank, int voice) { long newadr = 0; - static INT16 asic219banks[4] = { 0x1f7, 0x1f1, 0x1f3, 0x1f5 }; + static const INT16 asic219banks[4] = { 0x1f7, 0x1f1, 0x1f3, 0x1f5 }; adrs=(bank<<16)+adrs; diff --git a/src/emu/sound/c6280.c b/src/emu/sound/c6280.c index e2e01f30ddd..49dbfa011b6 100644 --- a/src/emu/sound/c6280.c +++ b/src/emu/sound/c6280.c @@ -214,7 +214,7 @@ static void c6280_write(c6280_t *p, int offset, int data) static void c6280_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length) { - static int scale_tab[] = { + static const int scale_tab[] = { 0x00, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 0x10, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F }; diff --git a/src/emu/sound/discrete.c b/src/emu/sound/discrete.c index 25b3e03024b..bc6d43f979f 100644 --- a/src/emu/sound/discrete.c +++ b/src/emu/sound/discrete.c @@ -162,7 +162,7 @@ static void CLIB_DECL discrete_log(const char *text, ...) * *************************************/ -static discrete_module module_list[] = +static const discrete_module module_list[] = { { DSO_OUTPUT ,"DSO_OUTPUT" ,0 ,NULL ,NULL }, { DSO_CSVLOG ,"DSO_CSVLOG" ,0 ,NULL ,NULL }, diff --git a/src/emu/sound/es5503.c b/src/emu/sound/es5503.c index 86bb1a5a5f2..c804d7fab73 100644 --- a/src/emu/sound/es5503.c +++ b/src/emu/sound/es5503.c @@ -79,10 +79,10 @@ typedef struct UINT32 output_rate; } ES5503Chip; -static UINT16 wavesizes[8] = { 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 }; -static UINT32 wavemasks[8] = { 0x1ff00, 0x1fe00, 0x1fc00, 0x1f800, 0x1f000, 0x1e000, 0x1c000, 0x18000 }; -static UINT32 accmasks[8] = { 0xff, 0x1ff, 0x3ff, 0x7ff, 0xfff, 0x1fff, 0x3fff, 0x7fff }; -static int resshifts[8] = { 9, 10, 11, 12, 13, 14, 15, 16 }; +static const UINT16 wavesizes[8] = { 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 }; +static const UINT32 wavemasks[8] = { 0x1ff00, 0x1fe00, 0x1fc00, 0x1f800, 0x1f000, 0x1e000, 0x1c000, 0x18000 }; +static const UINT32 accmasks[8] = { 0xff, 0x1ff, 0x3ff, 0x7ff, 0xfff, 0x1fff, 0x3fff, 0x7fff }; +static const int resshifts[8] = { 9, 10, 11, 12, 13, 14, 15, 16 }; enum { diff --git a/src/emu/sound/flt_rc.c b/src/emu/sound/flt_rc.c index 0a6c864a746..5e68cbb5b1b 100644 --- a/src/emu/sound/flt_rc.c +++ b/src/emu/sound/flt_rc.c @@ -11,7 +11,7 @@ struct filter_rc_info int type; }; -flt_rc_config flt_rc_ac_default = {FLT_RC_AC, 10000, 0, 0, CAP_U(1)}; +const flt_rc_config flt_rc_ac_default = {FLT_RC_AC, 10000, 0, 0, CAP_U(1)}; static void filter_rc_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples) diff --git a/src/emu/sound/flt_rc.h b/src/emu/sound/flt_rc.h index 189d98c3651..c8b16324df8 100644 --- a/src/emu/sound/flt_rc.h +++ b/src/emu/sound/flt_rc.h @@ -52,7 +52,7 @@ struct _flt_rc_config double C; }; -extern flt_rc_config flt_rc_ac_default; +extern const flt_rc_config flt_rc_ac_default; void filter_rc_set_RC(int num, int type, double R1, double R2, double R3, double C); diff --git a/src/emu/sound/fm.c b/src/emu/sound/fm.c index aca7d18584e..fd1e4a34ecc 100644 --- a/src/emu/sound/fm.c +++ b/src/emu/sound/fm.c @@ -2333,7 +2333,7 @@ typedef struct UINT8 addr_A1; /* address line A1 */ /* ADPCM-A unit */ - UINT8 *pcmbuf; /* pcm rom buffer */ + const UINT8 *pcmbuf; /* pcm rom buffer */ UINT32 pcm_size; /* size of pcm rom */ UINT8 adpcmTL; /* adpcmA total level */ ADPCM_CH adpcm[6]; /* adpcm channels */ @@ -2353,14 +2353,14 @@ typedef YM2610 YM2608; #define ADPCM_SHIFT (16) /* frequency step rate */ #define ADPCMA_ADDRESS_SHIFT 8 /* adpcm A address shift */ -static UINT8 *pcmbufA; +static const UINT8 *pcmbufA; static UINT32 pcmsizeA; /* Algorithm and tables verified on real YM2608 and YM2610 */ /* usual ADPCM table (16 * 1.1^N) */ -static int steps[49] = +static const int steps[49] = { 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55, @@ -2372,7 +2372,7 @@ static int steps[49] = }; /* different from the usual ADPCM table */ -static int step_inc[8] = { -1*16, -1*16, -1*16, -1*16, 2*16, 5*16, 7*16, 9*16 }; +static const int step_inc[8] = { -1*16, -1*16, -1*16, -1*16, 2*16, 5*16, 7*16, 9*16 }; /* speedup purposes only */ static int jedi_table[ 49*16 ]; @@ -2599,7 +2599,7 @@ static void FMsave_state_adpcma(const char *name,int num,ADPCM_CH *adpcm) -static unsigned int YM2608_ADPCM_ROM_addr[2*6] = { +static const unsigned int YM2608_ADPCM_ROM_addr[2*6] = { 0x0000, 0x01bf, /* bass drum */ 0x01c0, 0x043f, /* snare drum */ 0x0440, 0x1b7f, /* top cymbal */ @@ -2614,7 +2614,7 @@ static unsigned int YM2608_ADPCM_ROM_addr[2*6] = { It was verified, using real YM2608, that this ADPCM stream produces 100% correct output signal. */ -static unsigned char YM2608_ADPCM_ROM[0x2000] = { +static const unsigned char YM2608_ADPCM_ROM[0x2000] = { /* Source: 01BD.ROM */ /* Length: 448 / 0x000001C0 */ @@ -4119,7 +4119,7 @@ void *YM2610Init(void *param, int index, int clock, int rate, F2610->OPN.ST.IRQ_Handler = IRQHandler; F2610->OPN.ST.SSG = ssg; /* ADPCM */ - F2610->pcmbuf = (UINT8 *)pcmroma; + F2610->pcmbuf = (const UINT8 *)pcmroma; F2610->pcm_size = pcmsizea; /* DELTA-T */ F2610->deltaT.memory = (UINT8 *)pcmromb; diff --git a/src/emu/sound/k007232.c b/src/emu/sound/k007232.c index 53c33c346e7..3e4f609bfee 100644 --- a/src/emu/sound/k007232.c +++ b/src/emu/sound/k007232.c @@ -58,7 +58,7 @@ typedef struct kdacApcm #if 0 -static int kdac_note[] = { +static const int kdac_note[] = { 261.63/8, 277.18/8, 293.67/8, 311.13/8, 329.63/8, @@ -70,7 +70,7 @@ static int kdac_note[] = { 523.25/8, }; -static float kdaca_fn[][2] = { +static const float kdaca_fn[][2] = { /* B */ { 0x03f, 493.88/8 }, /* ?? */ { 0x11f, 493.88/4 }, /* ?? */ diff --git a/src/emu/sound/k053260.c b/src/emu/sound/k053260.c index 6a6b6fc1d1a..054e281d6c6 100644 --- a/src/emu/sound/k053260.c +++ b/src/emu/sound/k053260.c @@ -95,7 +95,7 @@ INLINE int limit( int val, int max, int min ) { #define MINOUT -0x8000 static void K053260_update( void * param, stream_sample_t **inputs, stream_sample_t **buffer, int length ) { - static long dpcmcnv[] = { 0,1,2,4,8,16,32,64, -128, -64, -32, -16, -8, -4, -2, -1}; + static const long dpcmcnv[] = { 0,1,2,4,8,16,32,64, -128, -64, -32, -16, -8, -4, -2, -1}; int i, j, lvol[4], rvol[4], play[4], loop[4], ppcm_data[4], ppcm[4]; unsigned char *rom[4]; diff --git a/src/emu/sound/k054539.c b/src/emu/sound/k054539.c index 1d5c13a4ab9..1677ed3085b 100644 --- a/src/emu/sound/k054539.c +++ b/src/emu/sound/k054539.c @@ -123,7 +123,7 @@ static void K054539_update(void *param, stream_sample_t **inputs, stream_sample_ struct k054539_info *info = param; #define VOL_CAP 1.80 - static INT16 dpcm[16] = { + static const INT16 dpcm[16] = { 0<<8, 1<<8, 4<<8, 9<<8, 16<<8, 25<<8, 36<<8, 49<<8, -64<<8, -49<<8, -36<<8, -25<<8, -16<<8, -9<<8, -4<<8, -1<<8 }; @@ -368,7 +368,7 @@ else #if CHANNEL_DEBUG { - static char gc_msg[32] = "chip : "; + static const char gc_msg[32] = "chip : "; static int gc_active=0, gc_chip=0, gc_pos[2]={0,0}; double *gc_fptr; char *gc_cptr; diff --git a/src/emu/sound/msm5232.c b/src/emu/sound/msm5232.c index 0853d38acb2..ef065e1f5ec 100644 --- a/src/emu/sound/msm5232.c +++ b/src/emu/sound/msm5232.c @@ -179,8 +179,8 @@ static void msm5232_init_tables( MSM5232 *chip ) #if 0 { /* rate tables (in miliseconds) */ - static int ATBL[8] = { 2,4,8,16, 32,64, 32,64}; - static int DTBL[16]= { 40,80,160,320, 640,1280, 640,1280, + static const int ATBL[8] = { 2,4,8,16, 32,64, 32,64}; + static const int DTBL[16]= { 40,80,160,320, 640,1280, 640,1280, 333,500,1000,2000, 4000,8000, 4000,8000}; for (i=0; i<8; i++) { diff --git a/src/emu/sound/multipcm.c b/src/emu/sound/multipcm.c index 414d7681a0f..8310235d0a9 100644 --- a/src/emu/sound/multipcm.c +++ b/src/emu/sound/multipcm.c @@ -35,7 +35,7 @@ #define MULTIPCM_CLOCKDIV (360.0) #define MULTIPCM_ONE (18) -static int ctbl[] = +static const int ctbl[] = { 0, 1, 2, 3, 4, 5, 6 , -1, // voice number mapping 7, 8, 9, 10,11,12,13, -1, @@ -43,7 +43,7 @@ static int ctbl[] = 21,22,23,24,25,26,27, -1, }; -static int decaytbl[16] = // decay times +static const int decaytbl[16] = // decay times { 0, 300, 800, 1400, 2100, 3000, 4000, 5200, diff --git a/src/emu/sound/okim6295.c b/src/emu/sound/okim6295.c index 6b42a68e020..119897c6409 100644 --- a/src/emu/sound/okim6295.c +++ b/src/emu/sound/okim6295.c @@ -86,7 +86,7 @@ const struct OKIM6295interface okim6295_interface_region_4_pin7low = { REGION_SO static void compute_tables(void) { /* nibble to bit map */ - static int nbl2bit[16][4] = + static const int nbl2bit[16][4] = { { 1, 0, 0, 0}, { 1, 0, 0, 1}, { 1, 0, 1, 0}, { 1, 0, 1, 1}, { 1, 1, 0, 0}, { 1, 1, 0, 1}, { 1, 1, 1, 0}, { 1, 1, 1, 1}, diff --git a/src/emu/sound/s14001a.c b/src/emu/sound/s14001a.c index 306b537db8d..7e50a5b5d1b 100644 --- a/src/emu/sound/s14001a.c +++ b/src/emu/sound/s14001a.c @@ -172,7 +172,7 @@ typedef struct #define REPEATCOUNT ((chip->PlayParams<<1)&0x6) // remember: its 3 bits and the bottom bit is always zero! #define LOCALSILENCESTATE ((chip->OutputCounter & 0x2) && (MIRRORMODE)) // 1 when silent output, 0 when DAC output. -static INT8 DeltaTable[4][4] = +static const INT8 DeltaTable[4][4] = { { 0xCD, 0xCD, 0xEF, 0xEF, }, { 0xEF, 0xEF, 0x00, 0x00, }, diff --git a/src/emu/sound/scsp.c b/src/emu/sound/scsp.c index a24ed931946..542c53a448a 100644 --- a/src/emu/sound/scsp.c +++ b/src/emu/sound/scsp.c @@ -411,6 +411,8 @@ static int EG_Update(struct _SLOT *slot) break; case DECAY1: slot->EG.volume-=slot->EG.D1R; + if(slot->EG.volume<=0) + slot->EG.volume=0; if(slot->EG.volume>>(EG_SHIFT+5)<slot->EG.DL) slot->EG.state=DECAY2; break; @@ -1063,7 +1065,7 @@ SCSPTMPL(1,1,1,3) typedef void (*_SCSPUpdateModes)(struct _SCSP *,struct _SLOT *,unsigned int,unsigned int); -static _SCSPUpdateModes SCSPUpdateModes[]= +static const _SCSPUpdateModes SCSPUpdateModes[]= { SCSPTMPL(0,0,0,0) SCSPTMPL(0,0,0,1) @@ -1225,18 +1227,18 @@ INLINE INT32 SCSP_UpdateSlot(struct _SCSP *SCSP, struct _SLOT *slot) switch(LPCTL(slot)) { case 0: //no loop - if(addr>LEA(slot)) + if(addr>=LEA(slot)) { //slot->active=0; SCSP_StopSlot(slot,0); } break; case 1: //normal loop - if(addr>LEA(slot)) + if(addr>=LEA(slot)) slot->cur_addr=LSA(slot)<<SHIFT; break; case 2: //reverse loop - if(addr>LEA(slot)) + if(addr>=LEA(slot)) { slot->cur_addr=LEA(slot)<<SHIFT; slot->Backwards=1; @@ -1245,7 +1247,7 @@ INLINE INT32 SCSP_UpdateSlot(struct _SCSP *SCSP, struct _SLOT *slot) slot->cur_addr=LEA(slot)<<SHIFT; break; case 3: //ping-pong - if(addr>LEA(slot)) //reached end, reverse till start + if(addr>=LEA(slot)) //reached end, reverse till start { slot->cur_addr=LEA(slot)<<SHIFT; slot->Backwards=1; @@ -1302,12 +1304,13 @@ static void SCSP_DoMasterSamples(struct _SCSP *SCSP, int nsamples) ++SCSP->BUFPTR; SCSP->BUFPTR&=63; #ifdef USEDSP - SCSPDSP_SetSample(&SCSP->DSP,sample>>SHIFT,ISEL(slot),IMXL(slot)); + Enc=((TL(slot))<<0x0)|((IMXL(slot))<<0xd); + SCSPDSP_SetSample(&SCSP->DSP,(sample*SCSP->LPANTABLE[Enc])>>SHIFT,ISEL(slot),IMXL(slot)); #endif Enc=((TL(slot))<<0x0)|((DIPAN(slot))<<0x8)|((DISDL(slot))<<0xd); { - smpl+=(sample*SCSP->LPANTABLE[Enc])>>SHIFT; - smpr+=(sample*SCSP->RPANTABLE[Enc])>>SHIFT; + smpl+=(sample*SCSP->LPANTABLE[Enc])>>SHIFT; + smpr+=(sample*SCSP->RPANTABLE[Enc])>>SHIFT; } } @@ -1320,14 +1323,14 @@ static void SCSP_DoMasterSamples(struct _SCSP *SCSP, int nsamples) struct _SLOT *slot=SCSP->Slots+i; if(EFSDL(slot)) { - unsigned short Enc=(TL(slot))|((EFPAN(slot))<<0x8)|((EFSDL(slot))<<0xd); - smpl+=(SCSP->DSP.EFREG[i]*SCSP->LPANTABLE[Enc])>>(SHIFT-4); - smpr+=(SCSP->DSP.EFREG[i]*SCSP->RPANTABLE[Enc])>>(SHIFT-4); + unsigned short Enc=((EFPAN(slot))<<0x8)|((EFSDL(slot))<<0xd); + smpl+=(SCSP->DSP.EFREG[i]*SCSP->LPANTABLE[Enc])>>SHIFT; + smpr+=(SCSP->DSP.EFREG[i]*SCSP->RPANTABLE[Enc])>>SHIFT; } } - *bufl++ = ICLIP16(smpl>>4); - *bufr++ = ICLIP16(smpr>>4); + *bufl++ = ICLIP16(smpl>>2); + *bufr++ = ICLIP16(smpr>>2); } } #endif diff --git a/src/emu/sound/scspdsp.c b/src/emu/sound/scspdsp.c index 9a417c47443..bb30dd376be 100644 --- a/src/emu/sound/scspdsp.c +++ b/src/emu/sound/scspdsp.c @@ -6,19 +6,49 @@ static UINT16 PACK(INT32 val) { - //cut to 16 bits - INT32 f=((UINT32 ) val)>>8; - return f; + UINT32 temp; + int sign,exponent,k; + + sign = (val >> 23) & 0x1; + temp = (val ^ (val << 1)) & 0xFFFFFF; + exponent = 0; + for (k=0; k<12; k++) + { + if (temp & 0x800000) + break; + temp <<= 1; + exponent += 1; + } + if (exponent < 12) + val = (val << exponent) & 0x3FFFFF; + else + val <<= 11; + val >>= 11; + val |= sign << 15; + val |= exponent << 11; + + return (UINT16)val; } static INT32 UNPACK(UINT16 val) { - INT32 r=val<<8; - r<<=8; - r>>=8; - //if(r&0x00800000) - // r|=0xFF000000; - return r; + int sign,exponent,mantissa; + INT32 uval; + + sign = (val >> 15) & 0x1; + exponent = (val >> 11) & 0xF; + mantissa = val & 0x7FF; + uval = mantissa << 11; + if (exponent > 11) + exponent = 11; + else + uval |= (sign ^ 1) << 22; + uval |= sign << 23; + uval <<= 8; + uval >>= 8; + uval >>= exponent; + + return uval; } void SCSPDSP_Init(struct _SCSPDSP *DSP) @@ -125,7 +155,7 @@ void SCSPDSP_Step(struct _SCSPDSP *DSP) if(IRA<=0x1f) INPUTS=DSP->MEMS[IRA]; else if(IRA<=0x2F) - INPUTS=DSP->MIXS[IRA-0x20]<<8; //MIXS is 16 bit + INPUTS=DSP->MIXS[IRA-0x20]<<4; //MIXS is 20 bit else if(IRA<=0x31) INPUTS=0; @@ -298,7 +328,7 @@ void SCSPDSP_Step(struct _SCSPDSP *DSP) void SCSPDSP_SetSample(struct _SCSPDSP *DSP,INT32 sample,int SEL,int MXL) { //DSP->MIXS[SEL]+=sample<<(MXL+1)/*7*/; - DSP->MIXS[SEL]+=sample<<7; + DSP->MIXS[SEL]+=sample; // if(MXL) // int a=1; } diff --git a/src/emu/sound/scsplfo.c b/src/emu/sound/scsplfo.c index dc9dcca674c..01023a4ba82 100644 --- a/src/emu/sound/scsplfo.c +++ b/src/emu/sound/scsplfo.c @@ -28,10 +28,10 @@ struct _LFO static int PLFO_TRI[256],PLFO_SQR[256],PLFO_SAW[256],PLFO_NOI[256]; static int ALFO_TRI[256],ALFO_SQR[256],ALFO_SAW[256],ALFO_NOI[256]; -static float LFOFreq[32]={0.17,0.19,0.23,0.27,0.34,0.39,0.45,0.55,0.68,0.78,0.92,1.10,1.39,1.60,1.87,2.27, +static const float LFOFreq[32]={0.17,0.19,0.23,0.27,0.34,0.39,0.45,0.55,0.68,0.78,0.92,1.10,1.39,1.60,1.87,2.27, 2.87,3.31,3.92,4.79,6.15,7.18,8.60,10.8,14.4,17.2,21.5,28.7,43.1,57.4,86.1,172.3}; -static float ASCALE[8]={0.0,0.4,0.8,1.5,3.0,6.0,12.0,24.0}; -static float PSCALE[8]={0.0,7.0,13.5,27.0,55.0,112.0,230.0,494}; +static const float ASCALE[8]={0.0,0.4,0.8,1.5,3.0,6.0,12.0,24.0}; +static const float PSCALE[8]={0.0,7.0,13.5,27.0,55.0,112.0,230.0,494}; static int PSCALES[8][256]; static int ASCALES[8][256]; @@ -47,7 +47,7 @@ static void LFO_Init(void) if(i<128) p=i; else - p=255-i; + p=i-256; ALFO_SAW[i]=a; PLFO_SAW[i]=p; diff --git a/src/emu/sound/side6581.h b/src/emu/sound/side6581.h index 8e2a5b8e829..149f5e24edf 100644 --- a/src/emu/sound/side6581.h +++ b/src/emu/sound/side6581.h @@ -11,7 +11,7 @@ // C64 C PAL, MOS 6581R4 1686 S // -static UINT8 releaseTab[] = +static const UINT8 releaseTab[] = { 255, 255, 254, 254, 253, 253, 252, 252, 251, 251, 250, 250, 249, 249, 248, 248, 247, 247, 246, 246, 245, 245, 244, 244, 243, 243, 242, 242, 241, 241, diff --git a/src/emu/sound/sidenvel.c b/src/emu/sound/sidenvel.c index 2958b8a9b24..a042f303baa 100644 --- a/src/emu/sound/sidenvel.c +++ b/src/emu/sound/sidenvel.c @@ -46,7 +46,7 @@ const UINT8 masterVolumeLevels[16] = static UINT16 masterAmplModTable[16*256]; -static float attackTimes[16] = +static const float attackTimes[16] = { /* milliseconds */ #if defined(SID_REFTIMES) @@ -60,7 +60,7 @@ static float attackTimes[16] = #endif }; -static float decayReleaseTimes[16] = +static const float decayReleaseTimes[16] = { /* milliseconds */ #if defined(SID_REFTIMES) diff --git a/src/emu/sound/sidw6581.h b/src/emu/sound/sidw6581.h index c18445a3f10..d66bf58d85c 100644 --- a/src/emu/sound/sidw6581.h +++ b/src/emu/sound/sidw6581.h @@ -8,7 +8,7 @@ * Copyright (C) 1998 Dag Lem <resid@nimrod.no> */ -static UINT8 waveform30_6581[4096] = +static const UINT8 waveform30_6581[4096] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, @@ -268,7 +268,7 @@ static UINT8 waveform30_6581[4096] = 0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3e,0x3e,0x3f,0x3f,0x7f,0x7f,0x7f,0x7f }; -static UINT8 waveform50_6581[4096+4096] = +static const UINT8 waveform50_6581[4096+4096] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, @@ -528,7 +528,7 @@ static UINT8 waveform50_6581[4096+4096] = 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }; -static UINT8 waveform60_6581[4096+4096] = +static const UINT8 waveform60_6581[4096+4096] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, @@ -788,7 +788,7 @@ static UINT8 waveform60_6581[4096+4096] = 0x70,0x7c,0x7c,0x7f,0x7c,0x7f,0x7f,0x7f,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f }; -static UINT8 waveform70_6581[4096+4096] = +static const UINT8 waveform70_6581[4096+4096] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, diff --git a/src/emu/sound/sidw8580.h b/src/emu/sound/sidw8580.h index 226d2e18b34..033d550c228 100644 --- a/src/emu/sound/sidw8580.h +++ b/src/emu/sound/sidw8580.h @@ -7,7 +7,7 @@ * Created with Deadman's Raw Data to C Header converter */ -static UINT8 waveform30_8580[4096] = +static const UINT8 waveform30_8580[4096] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -353,7 +353,7 @@ static UINT8 waveform30_8580[4096] = 0xff,0xff,0xff,0xff }; -static UINT8 waveform50_8580[4096+4096] = +static const UINT8 waveform50_8580[4096+4096] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -699,7 +699,7 @@ static UINT8 waveform50_8580[4096+4096] = 0x00,0x00,0x00,0x00 }; -static UINT8 waveform60_8580[4096+4096] = +static const UINT8 waveform60_8580[4096+4096] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -1045,7 +1045,7 @@ static UINT8 waveform60_8580[4096+4096] = 0xff,0xff,0xff,0xff }; -static UINT8 waveform70_8580[4096+4096] = +static const UINT8 waveform70_8580[4096+4096] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, diff --git a/src/emu/sound/sn76477.c b/src/emu/sound/sn76477.c index 34db6ea018e..a9a25eac9f3 100644 --- a/src/emu/sound/sn76477.c +++ b/src/emu/sound/sn76477.c @@ -643,7 +643,7 @@ static double compute_center_to_peak_voltage_out(struct SN76477 *sn) static void log_enable_line(struct SN76477 *sn) { #if VERBOSE - static const char *desc[] = + static const char *const desc[] = { "Enabled", "Inhibited" }; diff --git a/src/emu/sound/sp0256.c b/src/emu/sound/sp0256.c index 67b34e621f7..22762080ba2 100644 --- a/src/emu/sound/sp0256.c +++ b/src/emu/sound/sp0256.c @@ -283,7 +283,7 @@ static int lpc12_update(struct lpc12_t *f, int num_samp, INT16 *out, UINT32 *opt return i; } -static int stage_map[6] = { 0, 1, 2, 3, 4, 5 }; +static const int stage_map[6] = { 0, 1, 2, 3, 4, 5 }; /* ======================================================================== */ /* LPC12_REGDEC -- Decode the register set in the filter bank. */ diff --git a/src/emu/sound/speaker.c b/src/emu/sound/speaker.c index 4fba85bb5e3..fe5277cb56e 100644 --- a/src/emu/sound/speaker.c +++ b/src/emu/sound/speaker.c @@ -11,12 +11,12 @@ #include "streams.h" #include "speaker.h" -static INT16 default_levels[2] = {0,32767}; +static const INT16 default_levels[2] = {0,32767}; struct speaker { sound_stream *channel; - INT16 *levels; + const INT16 *levels; int num_levels; int level; }; diff --git a/src/emu/sound/tms3615.c b/src/emu/sound/tms3615.c index 46225348ccd..1b3212627e6 100644 --- a/src/emu/sound/tms3615.c +++ b/src/emu/sound/tms3615.c @@ -7,7 +7,7 @@ #define TONES 13 -static int divisor[TONES] = { 478, 451, 426, 402, 379, 358, 338, 319, 301, 284, 268, 253, 239 }; +static const int divisor[TONES] = { 478, 451, 426, 402, 379, 358, 338, 319, 301, 284, 268, 253, 239 }; struct TMS3615 { sound_stream *channel; /* returned by stream_create() */ diff --git a/src/emu/sound/tms36xx.c b/src/emu/sound/tms36xx.c index 911e929e08b..250634bb826 100644 --- a/src/emu/sound/tms36xx.c +++ b/src/emu/sound/tms36xx.c @@ -301,7 +301,7 @@ static const int tune4[13*6] = { B(1), B(2), Dx(3), B(3), Dx(4), B(4) }; -static const int *tunes[] = {NULL,tune1,tune2,tune3,tune4}; +static const int *const tunes[] = {NULL,tune1,tune2,tune3,tune4}; #define DECAY(voice) \ if( tms->vol[voice] > VMIN ) \ diff --git a/src/emu/sound/tms5110.c b/src/emu/sound/tms5110.c index a1e3ee5131c..96ceea772b7 100644 --- a/src/emu/sound/tms5110.c +++ b/src/emu/sound/tms5110.c @@ -709,7 +709,7 @@ static void parse_frame(struct tms5110 *tms) #if 0 /*This is an example word TEN taken from the TMS5110A datasheet*/ -static unsigned int example_word_TEN[619]={ +static const unsigned int example_word_TEN[619]={ /* 1*/1,0,0,0, 0, 0,0,0,0,0, 1,1,0,0,0, 0,0,0,1,0, 0,1,1,1, 0,1,0,1, /* 2*/1,0,0,0, 0, 0,0,0,0,0, 1,0,0,1,0, 0,0,1,1,0, 0,0,1,1, 0,1,0,1, /* 3*/1,1,0,0, 0, 1,0,0,0,0, 1,0,1,0,0, 0,1,0,1,0, 0,1,0,0, 1,0,1,0, 1,0,0,0, 1,0,0,1, 0,1,0,1, 0,0,1, 0,1,0, 0,1,1, diff --git a/src/emu/sound/tms5220r.c b/src/emu/sound/tms5220r.c index e373dd045ec..c3d47f04e21 100644 --- a/src/emu/sound/tms5220r.c +++ b/src/emu/sound/tms5220r.c @@ -83,7 +83,7 @@ const static short k10table [0x08]={ /* chirp table */ -static char chirptable[51]={ +static const char chirptable[51]={ 0x00, 0x2a, (char)0xd4, 0x32, (char)0xb2, 0x12, 0x25, 0x14, 0x02, (char)0xe1, (char)0xc5, 0x02, @@ -101,7 +101,7 @@ static char chirptable[51]={ /* interpolation coefficients (in rightshifts, as in actual chip) */ -static char interp_coeff[8] = { +static const char interp_coeff[8] = { 3, 3, 3, 2, 2, 1, 1, 0 }; diff --git a/src/emu/sound/vlm5030.c b/src/emu/sound/vlm5030.c index 9d1ea3eef1e..303c2dda0da 100644 --- a/src/emu/sound/vlm5030.c +++ b/src/emu/sound/vlm5030.c @@ -174,7 +174,7 @@ static const char VLM_NAME[] = "VLM5030"; /* This is the energy lookup table */ /* sampled from real chip */ -static unsigned short energytable[0x20] = +static const unsigned short energytable[0x20] = { 0, 2, 4, 6, 10, 12, 14, 18, /* 0-7 */ 22, 26, 30, 34, 38, 44, 48, 54, /* 8-15 */ diff --git a/src/emu/sound/ym2151.c b/src/emu/sound/ym2151.c index 063cfcc7477..5180db44620 100644 --- a/src/emu/sound/ym2151.c +++ b/src/emu/sound/ym2151.c @@ -229,7 +229,7 @@ static UINT32 d1l_tab[16]; #define RATE_STEPS (8) -static UINT8 eg_inc[19*RATE_STEPS]={ +static const UINT8 eg_inc[19*RATE_STEPS]={ /*cycle:0 1 2 3 4 5 6 7*/ @@ -262,7 +262,7 @@ static UINT8 eg_inc[19*RATE_STEPS]={ #define O(a) (a*RATE_STEPS) /*note that there is no O(17) in this table - it's directly in the code */ -static UINT8 eg_rate_select[32+64+32]={ /* Envelope Generator rates (32 + 64 rates + 32 RKS) */ +static const UINT8 eg_rate_select[32+64+32]={ /* Envelope Generator rates (32 + 64 rates + 32 RKS) */ /* 32 dummy (infinite time) rates */ O(18),O(18),O(18),O(18),O(18),O(18),O(18),O(18), O(18),O(18),O(18),O(18),O(18),O(18),O(18),O(18), @@ -309,7 +309,7 @@ O(16),O(16),O(16),O(16),O(16),O(16),O(16),O(16) /*mask 2047, 1023, 511, 255, 127, 63, 31, 15, 7, 3, 1, 0, 0, 0, 0, 0 */ #define O(a) (a*1) -static UINT8 eg_rate_shift[32+64+32]={ /* Envelope Generator counter shifts (32 + 64 rates + 32 RKS) */ +static const UINT8 eg_rate_shift[32+64+32]={ /* Envelope Generator counter shifts (32 + 64 rates + 32 RKS) */ /* 32 infinite time rates */ O(0),O(0),O(0),O(0),O(0),O(0),O(0),O(0), O(0),O(0),O(0),O(0),O(0),O(0),O(0),O(0), @@ -362,14 +362,14 @@ O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0) * DT2=0 DT2=1 DT2=2 DT2=3 * 0 600 781 950 */ -static UINT32 dt2_tab[4] = { 0, 384, 500, 608 }; +static const UINT32 dt2_tab[4] = { 0, 384, 500, 608 }; /* DT1 defines offset in Hertz from base note * This table is converted while initialization... * Detune table shown in YM2151 User's Manual is wrong (verified on the real chip) */ -static UINT8 dt1_tab[4*32] = { /* 4*32 DT1 values */ +static const UINT8 dt1_tab[4*32] = { /* 4*32 DT1 values */ /* DT1=0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -387,7 +387,7 @@ static UINT8 dt1_tab[4*32] = { /* 4*32 DT1 values */ 8, 8, 9,10,11,12,13,14,16,17,19,20,22,22,22,22 }; -static UINT16 phaseinc_rom[768]={ +static const UINT16 phaseinc_rom[768]={ 1299,1300,1301,1302,1303,1304,1305,1306,1308,1309,1310,1311,1313,1314,1315,1316, 1318,1319,1320,1321,1322,1323,1324,1325,1327,1328,1329,1330,1332,1333,1334,1335, 1337,1338,1339,1340,1341,1342,1343,1344,1346,1347,1348,1349,1351,1352,1353,1354, @@ -457,7 +457,7 @@ static UINT16 phaseinc_rom[768]={ some 0x80 could be 0x81 as well as some 0x00 could be 0x01. */ -static UINT8 lfo_noise_waveform[256] = { +static const UINT8 lfo_noise_waveform[256] = { 0xFF,0xEE,0xD3,0x80,0x58,0xDA,0x7F,0x94,0x9E,0xE3,0xFA,0x00,0x4D,0xFA,0xFF,0x6A, 0x7A,0xDE,0x49,0xF6,0x00,0x33,0xBB,0x63,0x91,0x60,0x51,0xFF,0x00,0xD8,0x7F,0xDE, 0xDC,0x73,0x21,0x85,0xB2,0x9C,0x5D,0x24,0xCD,0x91,0x9E,0x76,0x7F,0x20,0xFB,0xF3, diff --git a/src/emu/sound/ym2413.c b/src/emu/sound/ym2413.c index f4d65b2263a..d688829c2c0 100644 --- a/src/emu/sound/ym2413.c +++ b/src/emu/sound/ym2413.c @@ -557,7 +557,7 @@ static const INT8 lfo_pm_table[8*8] = { - waveform DC and DM select are 100% correct */ -static unsigned char table[19][8] = { +static const unsigned char table[19][8] = { /* MULT MULT modTL DcDmFb AR/DR AR/DR SL/RR SL/RR */ /* 0 1 2 3 4 5 6 7 */ {0x49, 0x4c, 0x4c, 0x12, 0x00, 0x00, 0x00, 0x00 }, //0 diff --git a/src/emu/sound/ymdeltat.c b/src/emu/sound/ymdeltat.c index 2c91a0ca066..f37a6cacaf5 100644 --- a/src/emu/sound/ymdeltat.c +++ b/src/emu/sound/ymdeltat.c @@ -151,7 +151,7 @@ UINT8 YM_DELTAT_ADPCM_Read(YM_DELTAT *DELTAT) /* 0-DRAM x1, 1-ROM, 2-DRAM x8, 3-ROM (3 is bad setting - not allowed by the manual) */ -static UINT8 dram_rightshift[4]={3,0,0,0}; +static const UINT8 dram_rightshift[4]={3,0,0,0}; /* DELTA-T ADPCM write register */ void YM_DELTAT_ADPCM_Write(YM_DELTAT *DELTAT,int r,int v) diff --git a/src/emu/sound/ymz280b.c b/src/emu/sound/ymz280b.c index 3af8405b342..ddd9acb3376 100644 --- a/src/emu/sound/ymz280b.c +++ b/src/emu/sound/ymz280b.c @@ -117,7 +117,7 @@ static TIMER_CALLBACK( update_irq_state_timer_5 ); static TIMER_CALLBACK( update_irq_state_timer_6 ); static TIMER_CALLBACK( update_irq_state_timer_7 ); -static timer_callback update_irq_state_cb[] = +static const timer_callback update_irq_state_cb[] = { update_irq_state_timer_0, update_irq_state_timer_1, |
