summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/fmopl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/sound/fmopl.cpp')
-rw-r--r--src/devices/sound/fmopl.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/devices/sound/fmopl.cpp b/src/devices/sound/fmopl.cpp
index e368e3a077d..920d65e59ed 100644
--- a/src/devices/sound/fmopl.cpp
+++ b/src/devices/sound/fmopl.cpp
@@ -1,5 +1,5 @@
// license:???
-// copyright-holders:Jarek Burczynski
+// copyright-holders:Jarek Burczynski,Tatsuyuki Satoh
/*
**
** File: fmopl.c - software implementation of FM sound generator
@@ -129,7 +129,7 @@ Revision History:
/*#define SAVE_SAMPLE*/
#ifdef SAVE_SAMPLE
-INLINE signed int acc_calc(signed int value)
+static inline signed int acc_calc(signed int value)
{
if (value>=0)
{
@@ -184,7 +184,7 @@ static FILE *sample[1];
#endif
#define LOG_CYM_FILE 0
-static FILE * cymfile = NULL;
+static FILE * cymfile = nullptr;
@@ -344,7 +344,7 @@ static const int slot_array[32]=
/* table is 3dB/octave , DV converts this into 6dB/octave */
/* 0.1875 is bit 0 weight of the envelope counter (volume) expressed in the 'decibel' scale */
#define DV (0.1875/2.0)
-static const UINT32 ksl_tab[8*16]=
+static const double ksl_tab[8*16]=
{
/* OCT 0 */
0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV,
@@ -651,7 +651,7 @@ static int num_lock = 0;
-INLINE int limit( int val, int max, int min ) {
+static inline int limit( int val, int max, int min ) {
if ( val > max )
val = max;
else if ( val < min )
@@ -662,7 +662,7 @@ INLINE int limit( int val, int max, int min ) {
/* status set and IRQ handling */
-INLINE void OPL_STATUS_SET(FM_OPL *OPL,int flag)
+static inline void OPL_STATUS_SET(FM_OPL *OPL,int flag)
{
/* set status flag */
OPL->status |= flag;
@@ -678,7 +678,7 @@ INLINE void OPL_STATUS_SET(FM_OPL *OPL,int flag)
}
/* status reset and IRQ handling */
-INLINE void OPL_STATUS_RESET(FM_OPL *OPL,int flag)
+static inline void OPL_STATUS_RESET(FM_OPL *OPL,int flag)
{
/* reset status flag */
OPL->status &=~flag;
@@ -694,7 +694,7 @@ INLINE void OPL_STATUS_RESET(FM_OPL *OPL,int flag)
}
/* IRQ mask set */
-INLINE void OPL_STATUSMASK_SET(FM_OPL *OPL,int flag)
+static inline void OPL_STATUSMASK_SET(FM_OPL *OPL,int flag)
{
OPL->statusmask = flag;
/* IRQ handling check */
@@ -704,7 +704,7 @@ INLINE void OPL_STATUSMASK_SET(FM_OPL *OPL,int flag)
/* advance LFO to next sample */
-INLINE void advance_lfo(FM_OPL *OPL)
+static inline void advance_lfo(FM_OPL *OPL)
{
UINT8 tmp;
@@ -725,7 +725,7 @@ INLINE void advance_lfo(FM_OPL *OPL)
}
/* advance to next sample */
-INLINE void advance(FM_OPL *OPL)
+static inline void advance(FM_OPL *OPL)
{
OPL_CH *CH;
OPL_SLOT *op;
@@ -888,7 +888,7 @@ INLINE void advance(FM_OPL *OPL)
}
-INLINE signed int op_calc(UINT32 phase, unsigned int env, signed int pm, unsigned int wave_tab)
+static inline signed int op_calc(UINT32 phase, unsigned int env, signed int pm, unsigned int wave_tab)
{
UINT32 p;
@@ -899,7 +899,7 @@ INLINE signed int op_calc(UINT32 phase, unsigned int env, signed int pm, unsigne
return tl_tab[p];
}
-INLINE signed int op_calc1(UINT32 phase, unsigned int env, signed int pm, unsigned int wave_tab)
+static inline signed int op_calc1(UINT32 phase, unsigned int env, signed int pm, unsigned int wave_tab)
{
UINT32 p;
@@ -914,7 +914,7 @@ INLINE signed int op_calc1(UINT32 phase, unsigned int env, signed int pm, unsign
#define volume_calc(OP) ((OP)->TLL + ((UINT32)(OP)->volume) + (OPL->LFO_AM & (OP)->AMmask))
/* calculate output */
-INLINE void OPL_CALC_CH( FM_OPL *OPL, OPL_CH *CH )
+static inline void OPL_CALC_CH( FM_OPL *OPL, OPL_CH *CH )
{
OPL_SLOT *SLOT;
unsigned int env;
@@ -980,7 +980,7 @@ number number BLK/FNUM2 FNUM Drum Hat Drum Tom Cymbal
/* calculate rhythm */
-INLINE void OPL_CALC_RH( FM_OPL *OPL, OPL_CH *CH, unsigned int noise )
+static inline void OPL_CALC_RH( FM_OPL *OPL, OPL_CH *CH, unsigned int noise )
{
OPL_SLOT *SLOT;
signed int out;
@@ -1299,7 +1299,7 @@ static void OPL_initalize(FM_OPL *OPL)
logerror("FMOPL.C: ksl_tab[oct=%2i] =",i);
for (j=0; j<16; j++)
{
- logerror("%08x ", ksl_tab[i*16+j] );
+ logerror("%08x ", static_cast<UINT32>(ksl_tab[i*16+j]) );
}
logerror("\n");
}
@@ -1324,7 +1324,7 @@ static void OPL_initalize(FM_OPL *OPL)
}
-INLINE void FM_KEYON(OPL_SLOT *SLOT, UINT32 key_set)
+static inline void FM_KEYON(OPL_SLOT *SLOT, UINT32 key_set)
{
if( !SLOT->key )
{
@@ -1336,7 +1336,7 @@ INLINE void FM_KEYON(OPL_SLOT *SLOT, UINT32 key_set)
SLOT->key |= key_set;
}
-INLINE void FM_KEYOFF(OPL_SLOT *SLOT, UINT32 key_clr)
+static inline void FM_KEYOFF(OPL_SLOT *SLOT, UINT32 key_clr)
{
if( SLOT->key )
{
@@ -1352,7 +1352,7 @@ INLINE void FM_KEYOFF(OPL_SLOT *SLOT, UINT32 key_clr)
}
/* update phase increment counter of operator (also update the EG rates if necessary) */
-INLINE void CALC_FCSLOT(OPL_CH *CH,OPL_SLOT *SLOT)
+static inline void CALC_FCSLOT(OPL_CH *CH,OPL_SLOT *SLOT)
{
int ksr;
@@ -1383,7 +1383,7 @@ INLINE void CALC_FCSLOT(OPL_CH *CH,OPL_SLOT *SLOT)
}
/* set multi,am,vib,EG-TYP,KSR,mul */
-INLINE void set_mul(FM_OPL *OPL,int slot,int v)
+static inline void set_mul(FM_OPL *OPL,int slot,int v)
{
OPL_CH *CH = &OPL->P_CH[slot/2];
OPL_SLOT *SLOT = &CH->SLOT[slot&1];
@@ -1397,7 +1397,7 @@ INLINE void set_mul(FM_OPL *OPL,int slot,int v)
}
/* set ksl & tl */
-INLINE void set_ksl_tl(FM_OPL *OPL,int slot,int v)
+static inline void set_ksl_tl(FM_OPL *OPL,int slot,int v)
{
OPL_CH *CH = &OPL->P_CH[slot/2];
OPL_SLOT *SLOT = &CH->SLOT[slot&1];
@@ -1409,7 +1409,7 @@ INLINE void set_ksl_tl(FM_OPL *OPL,int slot,int v)
}
/* set attack rate & decay rate */
-INLINE void set_ar_dr(FM_OPL *OPL,int slot,int v)
+static inline void set_ar_dr(FM_OPL *OPL,int slot,int v)
{
OPL_CH *CH = &OPL->P_CH[slot/2];
OPL_SLOT *SLOT = &CH->SLOT[slot&1];
@@ -1433,7 +1433,7 @@ INLINE void set_ar_dr(FM_OPL *OPL,int slot,int v)
}
/* set sustain level & release rate */
-INLINE void set_sl_rr(FM_OPL *OPL,int slot,int v)
+static inline void set_sl_rr(FM_OPL *OPL,int slot,int v)
{
OPL_CH *CH = &OPL->P_CH[slot/2];
OPL_SLOT *SLOT = &CH->SLOT[slot&1];
@@ -1674,7 +1674,7 @@ static void OPLWriteReg(FM_OPL *OPL, int r, int v)
CH->block_fnum = block_fnum;
- CH->ksl_base = ksl_tab[block_fnum>>6];
+ CH->ksl_base = static_cast<UINT32>(ksl_tab[block_fnum>>6]);
CH->fc = OPL->fn_tab[block_fnum&0x03ff] >> (7-block);
/* BLK 2,1,0 bits -> bits 3,2,1 of kcode */
@@ -1765,7 +1765,7 @@ static void OPL_UnLockTable(void)
if (cymfile)
fclose (cymfile);
- cymfile = NULL;
+ cymfile = nullptr;
}
static void OPLResetChip(FM_OPL *OPL)
@@ -1824,7 +1824,7 @@ static void OPL_postload(FM_OPL *OPL)
/* Look up key scale level */
UINT32 block_fnum = CH->block_fnum;
- CH->ksl_base = ksl_tab[block_fnum >> 6];
+ CH->ksl_base = static_cast<UINT32>(ksl_tab[block_fnum >> 6]);
CH->fc = OPL->fn_tab[block_fnum & 0x03ff] >> (7 - (block_fnum >> 10));
for( slot=0 ; slot < 2 ; slot++ )
@@ -1971,7 +1971,7 @@ static FM_OPL *OPLCreate(device_t *device, UINT32 clock, UINT32 rate, int type)
FM_OPL *OPL;
int state_size;
- if (OPL_LockTable(device) == -1) return NULL;
+ if (OPL_LockTable(device) == -1) return nullptr;
/* calculate OPL state size */
state_size = sizeof(FM_OPL);
@@ -2112,7 +2112,7 @@ static unsigned char OPLRead(FM_OPL *OPL,int a)
}
/* CSM Key Controll */
-INLINE void CSMKeyControll(OPL_CH *CH)
+static inline void CSMKeyControll(OPL_CH *CH)
{
FM_KEYON (&CH->SLOT[SLOT1], 4);
FM_KEYON (&CH->SLOT[SLOT2], 4);