Remove come c++11 stuff and hope I don't break anything
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/branches/mamesound@4036
This commit is contained in:
parent
06b5f723b0
commit
c4da3879ac
8 changed files with 77 additions and 32 deletions
|
@ -1766,10 +1766,15 @@ void FM_OPL::ResetChip()
|
|||
for(int i = 0xff ; i >= 0x20 ; i-- ) WriteReg(i,0);
|
||||
|
||||
/* reset operator parameters */
|
||||
for(OPL_CH &CH : P_CH)
|
||||
// for(OPL_CH &CH : P_CH)
|
||||
for(int ch = 0; ch < sizeof( P_CH )/ sizeof(P_CH[0]); ch++)
|
||||
{
|
||||
for(OPL_SLOT &SLOT : CH.SLOT)
|
||||
OPL_CH &CH = P_CH[ch];
|
||||
// for(OPL_SLOT &SLOT : CH.SLOT)
|
||||
for(int slot = 0; slot < sizeof( CH.SLOT ) / sizeof( CH.SLOT[0]); slot++)
|
||||
{
|
||||
|
||||
OPL_SLOT &SLOT = CH.SLOT[slot];
|
||||
/* wave table */
|
||||
SLOT.wavetable = 0;
|
||||
SLOT.state = EG_OFF;
|
||||
|
@ -1793,15 +1798,17 @@ void FM_OPL::ResetChip()
|
|||
|
||||
void FM_OPL::postload()
|
||||
{
|
||||
for(OPL_CH &CH : P_CH)
|
||||
for(int ch = 0; ch < sizeof( P_CH )/ sizeof(P_CH[0]); ch++)
|
||||
{
|
||||
OPL_CH &CH = P_CH[ch];
|
||||
/* Look up key scale level */
|
||||
uint32_t const block_fnum = CH.block_fnum;
|
||||
CH.ksl_base = static_cast<uint32_t>(ksl_tab[block_fnum >> 6]);
|
||||
CH.fc = fn_tab[block_fnum & 0x03ff] >> (7 - (block_fnum >> 10));
|
||||
|
||||
for(OPL_SLOT &SLOT : CH.SLOT)
|
||||
for(int slot = 0; slot < sizeof( CH.SLOT ) / sizeof( CH.SLOT[0]); slot++)
|
||||
{
|
||||
OPL_SLOT &SLOT = CH.SLOT[slot];
|
||||
/* Calculate key scale rate */
|
||||
SLOT.ksr = CH.kcode >> SLOT.KSR;
|
||||
|
||||
|
@ -1955,7 +1962,7 @@ static FM_OPL *OPLCreate(device_t *device, uint32_t clock, uint32_t rate, int ty
|
|||
FM_OPL *OPL;
|
||||
int state_size;
|
||||
|
||||
if (FM_OPL::LockTable(device) == -1) return nullptr;
|
||||
if (FM_OPL::LockTable(device) == -1) return 0;
|
||||
|
||||
/* calculate OPL state size */
|
||||
state_size = sizeof(FM_OPL);
|
||||
|
|
|
@ -73,14 +73,14 @@
|
|||
#define LEFT 0x00
|
||||
#define RIGHT 0x01
|
||||
|
||||
static constexpr int amplitude_lookup[16] = {
|
||||
static const int amplitude_lookup[16] = {
|
||||
0*32767/16, 1*32767/16, 2*32767/16, 3*32767/16,
|
||||
4*32767/16, 5*32767/16, 6*32767/16, 7*32767/16,
|
||||
8*32767/16, 9*32767/16, 10*32767/16, 11*32767/16,
|
||||
12*32767/16, 13*32767/16, 14*32767/16, 15*32767/16
|
||||
};
|
||||
|
||||
static constexpr uint8_t envelope[8][64] = {
|
||||
static const uint8_t envelope[8][64] = {
|
||||
/* zero amplitude */
|
||||
{ 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,
|
||||
|
@ -136,10 +136,13 @@ static constexpr uint8_t envelope[8][64] = {
|
|||
// saa1099_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
#define FILL_ARRAY( _FILL_ ) memset( _FILL_, 0, sizeof( _FILL_ ) )
|
||||
|
||||
saa1099_device::saa1099_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, SAA1099, tag, owner, clock)
|
||||
, device_sound_interface(mconfig, *this)
|
||||
, m_stream(nullptr)
|
||||
, m_stream(0)
|
||||
#if 0
|
||||
, m_noise_params{ 0, 0 }
|
||||
, m_env_enable{ 0, 0 }
|
||||
, m_env_reverse_right{ 0, 0 }
|
||||
|
@ -147,11 +150,20 @@ saa1099_device::saa1099_device(const machine_config &mconfig, const char *tag, d
|
|||
, m_env_bits{ 0, 0 }
|
||||
, m_env_clock{ 0, 0 }
|
||||
, m_env_step{ 0, 0 }
|
||||
#endif
|
||||
, m_all_ch_enable(0)
|
||||
, m_sync_state(0)
|
||||
, m_selected_reg(0)
|
||||
, m_sample_rate(0.0)
|
||||
{
|
||||
FILL_ARRAY( m_noise_params );
|
||||
FILL_ARRAY( m_env_enable );
|
||||
FILL_ARRAY( m_env_reverse_right );
|
||||
FILL_ARRAY( m_env_mode );
|
||||
FILL_ARRAY( m_env_bits );
|
||||
FILL_ARRAY( m_env_clock );
|
||||
FILL_ARRAY( m_env_step );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -23,6 +23,22 @@
|
|||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
//Container class for int that just initalizes to 0
|
||||
class NullInt {
|
||||
int value;
|
||||
public:
|
||||
operator int& () {
|
||||
return value;
|
||||
}
|
||||
|
||||
int& operator= ( int set ) {
|
||||
value = set;
|
||||
return value;
|
||||
}
|
||||
|
||||
NullInt( int set = 0 ) : value( set ) {
|
||||
}
|
||||
};
|
||||
|
||||
// ======================> saa1099_device
|
||||
|
||||
|
@ -39,37 +55,45 @@ public:
|
|||
|
||||
//protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_start();
|
||||
|
||||
// sound stream update overrides
|
||||
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
|
||||
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
|
||||
|
||||
private:
|
||||
struct saa1099_channel
|
||||
{
|
||||
saa1099_channel() : amplitude{ 0, 0 }, envelope{ 0, 0 } { }
|
||||
saa1099_channel() {
|
||||
//Quite hacky, but let's see how it goes
|
||||
memset( this, 0, sizeof( *this ) );
|
||||
}
|
||||
|
||||
int frequency = 0; /* frequency (0x00..0xff) */
|
||||
int freq_enable = 0; /* frequency enable */
|
||||
int noise_enable = 0; /* noise enable */
|
||||
int octave = 0; /* octave (0x00..0x07) */
|
||||
int frequency ; /* frequency (0x00..0xff) */
|
||||
int freq_enable ; /* frequency enable */
|
||||
int noise_enable ; /* noise enable */
|
||||
int octave ; /* octave (0x00..0x07) */
|
||||
int amplitude[2]; /* amplitude (0x00..0x0f) */
|
||||
int envelope[2]; /* envelope (0x00..0x0f or 0x10 == off) */
|
||||
|
||||
/* vars to simulate the square wave */
|
||||
double counter = 0.0;
|
||||
double freq = 0.0;
|
||||
int level = 0;
|
||||
double counter ;
|
||||
double freq ;
|
||||
int level ;
|
||||
|
||||
};
|
||||
|
||||
struct saa1099_noise
|
||||
{
|
||||
saa1099_noise() { }
|
||||
saa1099_noise() {
|
||||
counter = 0;
|
||||
freq = 0;
|
||||
level = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
/* vars to simulate the noise generator output */
|
||||
double counter = 0.0;
|
||||
double freq = 0.0;
|
||||
uint32_t level = 0xFFFFFFFF; /* noise polynomial shifter */
|
||||
double counter;
|
||||
double freq;
|
||||
uint32_t level; /* noise polynomial shifter */
|
||||
};
|
||||
|
||||
void envelope_w(int ch);
|
||||
|
|
|
@ -365,7 +365,7 @@ void sn76496_base_device::sound_stream_update(sound_stream &stream, stream_sampl
|
|||
{
|
||||
int i;
|
||||
stream_sample_t *lbuffer = outputs[0];
|
||||
stream_sample_t *rbuffer = (m_stereo)? outputs[1] : nullptr;
|
||||
stream_sample_t *rbuffer = (m_stereo)? outputs[1] : 0;
|
||||
|
||||
int16_t out;
|
||||
int16_t out2 = 0;
|
||||
|
|
|
@ -52,8 +52,8 @@ protected:
|
|||
device_t *owner,
|
||||
uint32_t clock);
|
||||
|
||||
virtual void device_start() override;
|
||||
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
|
||||
virtual void device_start();
|
||||
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
|
||||
|
||||
private:
|
||||
inline bool in_noise_mode();
|
||||
|
|
|
@ -80,13 +80,13 @@
|
|||
|
||||
/* Forecast to next Forecast (rate = *8) */
|
||||
/* 1/8 , 3/8 , 5/8 , 7/8 , 9/8 , 11/8 , 13/8 , 15/8 */
|
||||
static constexpr int32_t ym_deltat_decode_tableB1[16] = {
|
||||
static const int32_t ym_deltat_decode_tableB1[16] = {
|
||||
1, 3, 5, 7, 9, 11, 13, 15,
|
||||
-1, -3, -5, -7, -9, -11, -13, -15,
|
||||
};
|
||||
/* delta to next delta (rate= *64) */
|
||||
/* 0.9 , 0.9 , 0.9 , 0.9 , 1.2 , 1.6 , 2.0 , 2.4 */
|
||||
static constexpr int32_t ym_deltat_decode_tableB2[16] = {
|
||||
static const int32_t ym_deltat_decode_tableB2[16] = {
|
||||
57, 57, 57, 57, 77, 102, 128, 153,
|
||||
57, 57, 57, 57, 77, 102, 128, 153
|
||||
};
|
||||
|
@ -152,7 +152,7 @@ uint8_t YM_DELTAT::ADPCM_Read()
|
|||
|
||||
|
||||
/* 0-DRAM x1, 1-ROM, 2-DRAM x8, 3-ROM (3 is bad setting - not allowed by the manual) */
|
||||
static constexpr uint8_t dram_rightshift[4]={3,0,0,0};
|
||||
static const uint8_t dram_rightshift[4]={3,0,0,0};
|
||||
|
||||
/* DELTA-T ADPCM write register */
|
||||
void YM_DELTAT::ADPCM_Write(int r, int v)
|
||||
|
|
|
@ -11,8 +11,10 @@ typedef void (*STATUS_CHANGE_HANDLER)(void *chip, uint8_t status_bits);
|
|||
|
||||
/* DELTA-T (adpcm type B) struct */
|
||||
struct YM_DELTAT { /* AT: rearranged and tightened structure */
|
||||
static constexpr int EMULATION_MODE_NORMAL = 0;
|
||||
static constexpr int EMULATION_MODE_YM2610 = 1;
|
||||
enum {
|
||||
EMULATION_MODE_NORMAL = 0,
|
||||
EMULATION_MODE_YM2610 = 1,
|
||||
};
|
||||
|
||||
uint8_t *memory;
|
||||
int32_t *output_pointer;/* pointer of output pointers */
|
||||
|
|
|
@ -628,7 +628,7 @@ static int num_lock = 0;
|
|||
|
||||
static inline void OPL3_SLOT_CONNECT(OPL3 *chip, OPL3_SLOT *slot) {
|
||||
if (slot->conn_enum == CONN_NULL) {
|
||||
slot->connect = nullptr;
|
||||
slot->connect = 0;
|
||||
} else if (slot->conn_enum >= CONN_CHAN0 && slot->conn_enum < CONN_PHASEMOD) {
|
||||
slot->connect = &chip->chanout[slot->conn_enum];
|
||||
} else if (slot->conn_enum == CONN_PHASEMOD) {
|
||||
|
@ -2355,7 +2355,7 @@ static OPL3 *OPL3Create(device_t *device, int clock, int rate, int type)
|
|||
{
|
||||
OPL3 *chip;
|
||||
|
||||
if (OPL3_LockTable(device) == -1) return nullptr;
|
||||
if (OPL3_LockTable(device) == -1) return 0;
|
||||
|
||||
/* allocate memory block */
|
||||
chip = auto_alloc_clear(device->machine(), OPL3 );
|
||||
|
|
Loading…
Add table
Reference in a new issue