Merge pull request #1257 from superctr/c352_improvement
c352 code formatting, change type formats
This commit is contained in:
commit
e473144148
@ -62,16 +62,16 @@ void c352_device::fetch_sample(c352_voice_t* v)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char s;
|
INT8 s;
|
||||||
|
|
||||||
s = (char)read_byte(v->pos);
|
s = (INT8)read_byte(v->pos);
|
||||||
|
|
||||||
if(v->flags & C352_FLG_MULAW)
|
if(v->flags & C352_FLG_MULAW)
|
||||||
v->sample = m_mulaw_table[(unsigned char)s];
|
v->sample = m_mulaw_table[(UINT8)s];
|
||||||
else
|
else
|
||||||
v->sample = s<<8;
|
v->sample = s<<8;
|
||||||
|
|
||||||
unsigned short pos = v->pos&0xffff;
|
UINT16 pos = v->pos&0xffff;
|
||||||
|
|
||||||
if((v->flags & C352_FLG_LOOP) && v->flags & C352_FLG_REVERSE)
|
if((v->flags & C352_FLG_LOOP) && v->flags & C352_FLG_REVERSE)
|
||||||
{
|
{
|
||||||
@ -114,7 +114,7 @@ void c352_device::sound_stream_update(sound_stream &stream, stream_sample_t **in
|
|||||||
{
|
{
|
||||||
|
|
||||||
int i,j;
|
int i,j;
|
||||||
short s;
|
INT16 s;
|
||||||
stream_sample_t *buffer_fl = outputs[0];
|
stream_sample_t *buffer_fl = outputs[0];
|
||||||
stream_sample_t *buffer_fr = outputs[1];
|
stream_sample_t *buffer_fr = outputs[1];
|
||||||
stream_sample_t *buffer_rl = outputs[2];
|
stream_sample_t *buffer_rl = outputs[2];
|
||||||
@ -159,33 +159,33 @@ void c352_device::sound_stream_update(sound_stream &stream, stream_sample_t **in
|
|||||||
out[3] += ((v->flags & C352_FLG_PHASEFR) ? -s * (v->vol_r&0xff) : s * (v->vol_r&0xff))>>8;
|
out[3] += ((v->flags & C352_FLG_PHASEFR) ? -s * (v->vol_r&0xff) : s * (v->vol_r&0xff))>>8;
|
||||||
}
|
}
|
||||||
|
|
||||||
*buffer_fl++ = (short) (out[0]>>3);
|
*buffer_fl++ = (INT16) (out[0]>>3);
|
||||||
*buffer_fr++ = (short) (out[1]>>3);
|
*buffer_fr++ = (INT16) (out[1]>>3);
|
||||||
*buffer_rl++ = (short) (out[2]>>3);
|
*buffer_rl++ = (INT16) (out[2]>>3);
|
||||||
*buffer_rr++ = (short) (out[3]>>3);
|
*buffer_rr++ = (INT16) (out[3]>>3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned short c352_device::read_reg16(unsigned long address)
|
UINT16 c352_device::read_reg16(unsigned long address)
|
||||||
{
|
{
|
||||||
m_stream->update();
|
m_stream->update();
|
||||||
|
|
||||||
const int reg_map[8] =
|
const int reg_map[8] =
|
||||||
{
|
{
|
||||||
offsetof(c352_voice_t,vol_f) / sizeof(unsigned short),
|
offsetof(c352_voice_t,vol_f) / sizeof(UINT16),
|
||||||
offsetof(c352_voice_t,vol_r) / sizeof(unsigned short),
|
offsetof(c352_voice_t,vol_r) / sizeof(UINT16),
|
||||||
offsetof(c352_voice_t,freq) / sizeof(unsigned short),
|
offsetof(c352_voice_t,freq) / sizeof(UINT16),
|
||||||
offsetof(c352_voice_t,flags) / sizeof(unsigned short),
|
offsetof(c352_voice_t,flags) / sizeof(UINT16),
|
||||||
offsetof(c352_voice_t,wave_bank) / sizeof(unsigned short),
|
offsetof(c352_voice_t,wave_bank) / sizeof(UINT16),
|
||||||
offsetof(c352_voice_t,wave_start) / sizeof(unsigned short),
|
offsetof(c352_voice_t,wave_start) / sizeof(UINT16),
|
||||||
offsetof(c352_voice_t,wave_end) / sizeof(unsigned short),
|
offsetof(c352_voice_t,wave_end) / sizeof(UINT16),
|
||||||
offsetof(c352_voice_t,wave_loop) / sizeof(unsigned short),
|
offsetof(c352_voice_t,wave_loop) / sizeof(UINT16),
|
||||||
};
|
};
|
||||||
|
|
||||||
if(address < 0x100)
|
if(address < 0x100)
|
||||||
return *((unsigned short*)&m_c352_v[address/8]+reg_map[address%8]);
|
return *((UINT16*)&m_c352_v[address/8]+reg_map[address%8]);
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -198,14 +198,14 @@ void c352_device::write_reg16(unsigned long address, unsigned short val)
|
|||||||
|
|
||||||
const int reg_map[8] =
|
const int reg_map[8] =
|
||||||
{
|
{
|
||||||
offsetof(c352_voice_t,vol_f) / sizeof(unsigned short),
|
offsetof(c352_voice_t,vol_f) / sizeof(UINT16),
|
||||||
offsetof(c352_voice_t,vol_r) / sizeof(unsigned short),
|
offsetof(c352_voice_t,vol_r) / sizeof(UINT16),
|
||||||
offsetof(c352_voice_t,freq) / sizeof(unsigned short),
|
offsetof(c352_voice_t,freq) / sizeof(UINT16),
|
||||||
offsetof(c352_voice_t,flags) / sizeof(unsigned short),
|
offsetof(c352_voice_t,flags) / sizeof(UINT16),
|
||||||
offsetof(c352_voice_t,wave_bank) / sizeof(unsigned short),
|
offsetof(c352_voice_t,wave_bank) / sizeof(UINT16),
|
||||||
offsetof(c352_voice_t,wave_start) / sizeof(unsigned short),
|
offsetof(c352_voice_t,wave_start) / sizeof(UINT16),
|
||||||
offsetof(c352_voice_t,wave_end) / sizeof(unsigned short),
|
offsetof(c352_voice_t,wave_end) / sizeof(UINT16),
|
||||||
offsetof(c352_voice_t,wave_loop) / sizeof(unsigned short),
|
offsetof(c352_voice_t,wave_loop) / sizeof(UINT16),
|
||||||
};
|
};
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
@ -213,7 +213,7 @@ void c352_device::write_reg16(unsigned long address, unsigned short val)
|
|||||||
if(address < 0x100)
|
if(address < 0x100)
|
||||||
{
|
{
|
||||||
//printf("w %04lx,%04x, %d\n", address, val, reg_map[address&7]);
|
//printf("w %04lx,%04x, %d\n", address, val, reg_map[address&7]);
|
||||||
*((unsigned short*)&m_c352_v[address/8]+reg_map[address%8]) = val;
|
*((UINT16*)&m_c352_v[address/8]+reg_map[address%8]) = val;
|
||||||
}
|
}
|
||||||
else if(address == 0x200)
|
else if(address == 0x200)
|
||||||
m_control = val;
|
m_control = val;
|
||||||
@ -263,7 +263,7 @@ void c352_device::device_start()
|
|||||||
{
|
{
|
||||||
x = -x;
|
x = -x;
|
||||||
}
|
}
|
||||||
m_mulaw_table[i] = (short)x;
|
m_mulaw_table[i] = (UINT16)x;
|
||||||
}
|
}
|
||||||
|
|
||||||
// register save state info
|
// register save state info
|
||||||
|
@ -69,21 +69,21 @@ private:
|
|||||||
|
|
||||||
struct c352_voice_t {
|
struct c352_voice_t {
|
||||||
|
|
||||||
unsigned int pos;
|
UINT32 pos;
|
||||||
unsigned int counter;
|
UINT32 counter;
|
||||||
|
|
||||||
short sample;
|
INT16 sample;
|
||||||
short last_sample;
|
INT16 last_sample;
|
||||||
|
|
||||||
unsigned short vol_f;
|
UINT16 vol_f;
|
||||||
unsigned short vol_r;
|
UINT16 vol_r;
|
||||||
unsigned short freq;
|
UINT16 freq;
|
||||||
unsigned short flags;
|
UINT16 flags;
|
||||||
|
|
||||||
unsigned short wave_bank;
|
UINT16 wave_bank;
|
||||||
unsigned short wave_start;
|
UINT16 wave_start;
|
||||||
unsigned short wave_end;
|
UINT16 wave_end;
|
||||||
unsigned short wave_loop;
|
UINT16 wave_loop;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -91,10 +91,10 @@ private:
|
|||||||
int m_divider;
|
int m_divider;
|
||||||
|
|
||||||
c352_voice_t m_c352_v[32];
|
c352_voice_t m_c352_v[32];
|
||||||
short m_mulaw_table[256];
|
INT16 m_mulaw_table[256];
|
||||||
|
|
||||||
unsigned short m_random;
|
UINT16 m_random;
|
||||||
unsigned short m_control; // control flags, purpose unknown.
|
UINT16 m_control; // control flags, purpose unknown.
|
||||||
|
|
||||||
void fetch_sample(c352_voice_t* v);
|
void fetch_sample(c352_voice_t* v);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user