summaryrefslogtreecommitdiffstats
path: root/src/devices/sound/ymf271.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/sound/ymf271.cpp')
-rw-r--r--src/devices/sound/ymf271.cpp78
1 files changed, 39 insertions, 39 deletions
diff --git a/src/devices/sound/ymf271.cpp b/src/devices/sound/ymf271.cpp
index 653285f18a1..ed58c45d316 100644
--- a/src/devices/sound/ymf271.cpp
+++ b/src/devices/sound/ymf271.cpp
@@ -217,7 +217,7 @@ void ymf271_device::calculate_step(YMF271Slot *slot)
st /= (double)(524288/65536); // pre-multiply with 65536
- slot->step = (UINT32)st;
+ slot->step = (uint32_t)st;
}
else
{
@@ -230,7 +230,7 @@ void ymf271_device::calculate_step(YMF271Slot *slot)
st /= (double)(536870912/65536); // pre-multiply with 65536
- slot->step = (UINT32)st;
+ slot->step = (uint32_t)st;
}
}
@@ -404,11 +404,11 @@ void ymf271_device::update_lfo(YMF271Slot *slot)
calculate_step(slot);
}
-INT64 ymf271_device::calculate_slot_volume(YMF271Slot *slot)
+int64_t ymf271_device::calculate_slot_volume(YMF271Slot *slot)
{
- INT64 volume;
- INT64 env_volume;
- INT64 lfo_volume = 65536;
+ int64_t volume;
+ int64_t env_volume;
+ int64_t lfo_volume = 65536;
switch (slot->ams)
{
@@ -425,12 +425,12 @@ INT64 ymf271_device::calculate_slot_volume(YMF271Slot *slot)
return volume;
}
-void ymf271_device::update_pcm(int slotnum, INT32 *mixp, int length)
+void ymf271_device::update_pcm(int slotnum, int32_t *mixp, int length)
{
int i;
- INT64 final_volume;
- INT16 sample;
- INT64 ch0_vol, ch1_vol; //, ch2_vol, ch3_vol;
+ int64_t final_volume;
+ int16_t sample;
+ int64_t ch0_vol, ch1_vol; //, ch2_vol, ch3_vol;
YMF271Slot *slot = &m_slots[slotnum];
@@ -449,17 +449,17 @@ void ymf271_device::update_pcm(int slotnum, INT32 *mixp, int length)
// loop
if ((slot->stepptr>>16) > slot->endaddr)
{
- slot->stepptr = slot->stepptr - ((UINT64)slot->endaddr<<16) + ((UINT64)slot->loopaddr<<16);
+ slot->stepptr = slot->stepptr - ((uint64_t)slot->endaddr<<16) + ((uint64_t)slot->loopaddr<<16);
if ((slot->stepptr>>16) > slot->endaddr)
{
// overflow
slot->stepptr &= 0xffff;
- slot->stepptr |= ((UINT64)slot->loopaddr<<16);
+ slot->stepptr |= ((uint64_t)slot->loopaddr<<16);
if ((slot->stepptr>>16) > slot->endaddr)
{
// still overflow? (triggers in rdft2, rarely)
slot->stepptr &= 0xffff;
- slot->stepptr |= ((UINT64)slot->endaddr<<16);
+ slot->stepptr |= ((uint64_t)slot->endaddr<<16);
}
}
}
@@ -500,10 +500,10 @@ void ymf271_device::update_pcm(int slotnum, INT32 *mixp, int length)
}
// calculates the output of one FM operator
-INT64 ymf271_device::calculate_op(int slotnum, INT64 inp)
+int64_t ymf271_device::calculate_op(int slotnum, int64_t inp)
{
YMF271Slot *slot = &m_slots[slotnum];
- INT64 env, slot_output, slot_input = 0;
+ int64_t env, slot_output, slot_input = 0;
update_envelope(slot);
update_lfo(slot);
@@ -528,7 +528,7 @@ INT64 ymf271_device::calculate_op(int slotnum, INT64 inp)
return slot_output;
}
-void ymf271_device::set_feedback(int slotnum, INT64 inp)
+void ymf271_device::set_feedback(int slotnum, int64_t inp)
{
YMF271Slot *slot = &m_slots[slotnum];
slot->feedback_modulation1 = (((inp << (SIN_BITS-2)) * feedback_level[slot->feedback]) / 16);
@@ -542,7 +542,7 @@ void ymf271_device::sound_stream_update(sound_stream &stream, stream_sample_t **
{
int i, j;
int op;
- INT32 *mixp;
+ int32_t *mixp;
memset(m_mix_buffer.get(), 0, sizeof(m_mix_buffer[0])*samples*2);
@@ -573,8 +573,8 @@ void ymf271_device::sound_stream_update(sound_stream &stream, stream_sample_t **
{
for (i = 0; i < samples; i++)
{
- INT64 output1 = 0, output2 = 0, output3 = 0, output4 = 0;
- INT64 phase_mod1, phase_mod2, phase_mod3;
+ int64_t output1 = 0, output2 = 0, output3 = 0, output4 = 0;
+ int64_t phase_mod1, phase_mod2, phase_mod3;
switch (m_slots[slot1].algorithm)
{
// <--------|
@@ -799,8 +799,8 @@ void ymf271_device::sound_stream_update(sound_stream &stream, stream_sample_t **
{
for (i = 0; i < samples; i++)
{
- INT64 output1 = 0, output3 = 0;
- INT64 phase_mod1, phase_mod3;
+ int64_t output1 = 0, output3 = 0;
+ int64_t phase_mod1, phase_mod3;
switch (m_slots[slot1].algorithm & 3)
{
// <--------|
@@ -862,8 +862,8 @@ void ymf271_device::sound_stream_update(sound_stream &stream, stream_sample_t **
{
for (i = 0; i < samples; i++)
{
- INT64 output1 = 0, output2 = 0, output3 = 0;
- INT64 phase_mod1, phase_mod3;
+ int64_t output1 = 0, output2 = 0, output3 = 0;
+ int64_t phase_mod1, phase_mod3;
switch (m_slots[slot1].algorithm & 7)
{
// <--------|
@@ -984,7 +984,7 @@ void ymf271_device::sound_stream_update(sound_stream &stream, stream_sample_t **
}
}
-void ymf271_device::write_register(int slotnum, int reg, UINT8 data)
+void ymf271_device::write_register(int slotnum, int reg, uint8_t data)
{
YMF271Slot *slot = &m_slots[slotnum];
@@ -1089,7 +1089,7 @@ void ymf271_device::write_register(int slotnum, int reg, UINT8 data)
}
}
-void ymf271_device::ymf271_write_fm(int bank, UINT8 address, UINT8 data)
+void ymf271_device::ymf271_write_fm(int bank, uint8_t address, uint8_t data)
{
int groupnum = fm_tab[address & 0xf];
if (groupnum == -1)
@@ -1187,7 +1187,7 @@ void ymf271_device::ymf271_write_fm(int bank, UINT8 address, UINT8 data)
}
}
-void ymf271_device::ymf271_write_pcm(UINT8 address, UINT8 data)
+void ymf271_device::ymf271_write_pcm(uint8_t address, uint8_t data)
{
int slotnum = pcm_tab[address & 0xf];
if (slotnum == -1)
@@ -1301,7 +1301,7 @@ void ymf271_device::device_timer(emu_timer &timer, device_timer_id id, int param
}
}
-UINT8 ymf271_device::ymf271_read_memory(UINT32 offset)
+uint8_t ymf271_device::ymf271_read_memory(uint32_t offset)
{
if (m_ext_read_handler.isnull())
{
@@ -1319,7 +1319,7 @@ UINT8 ymf271_device::ymf271_read_memory(UINT32 offset)
return m_ext_read_handler(offset);
}
-void ymf271_device::ymf271_write_timer(UINT8 address, UINT8 data)
+void ymf271_device::ymf271_write_timer(uint8_t address, uint8_t data)
{
if ((address & 0xf0) == 0)
{
@@ -1487,7 +1487,7 @@ READ8_MEMBER( ymf271_device::read )
if (!m_ext_rw)
return 0xff;
- UINT8 ret = m_ext_readlatch;
+ uint8_t ret = m_ext_readlatch;
m_ext_address = (m_ext_address + 1) & 0x7fffff;
m_ext_readlatch = ymf271_read_memory(m_ext_address);
return ret;
@@ -1505,7 +1505,7 @@ void ymf271_device::init_tables()
int i, j;
for (i = 0; i < 8; i++)
- m_lut_waves[i] = std::make_unique<INT16[]>(SIN_LEN);
+ m_lut_waves[i] = std::make_unique<int16_t[]>(SIN_LEN);
for (i = 0; i < 4*8; i++)
m_lut_plfo[i>>3][i&7] = std::make_unique<double[]>(LFO_LENGTH);
@@ -1519,25 +1519,25 @@ void ymf271_device::init_tables()
double m2 = sin( ((i*4)+1) * M_PI / SIN_LEN );
// Waveform 0: sin(wt) (0 <= wt <= 2PI)
- m_lut_waves[0][i] = (INT16)(m * MAXOUT);
+ m_lut_waves[0][i] = (int16_t)(m * MAXOUT);
// Waveform 1: sin?(wt) (0 <= wt <= PI) -sin?(wt) (PI <= wt <= 2PI)
- m_lut_waves[1][i] = (i < (SIN_LEN/2)) ? (INT16)((m * m) * MAXOUT) : (INT16)((m * m) * MINOUT);
+ m_lut_waves[1][i] = (i < (SIN_LEN/2)) ? (int16_t)((m * m) * MAXOUT) : (int16_t)((m * m) * MINOUT);
// Waveform 2: sin(wt) (0 <= wt <= PI) -sin(wt) (PI <= wt <= 2PI)
- m_lut_waves[2][i] = (i < (SIN_LEN/2)) ? (INT16)(m * MAXOUT) : (INT16)(-m * MAXOUT);
+ m_lut_waves[2][i] = (i < (SIN_LEN/2)) ? (int16_t)(m * MAXOUT) : (int16_t)(-m * MAXOUT);
// Waveform 3: sin(wt) (0 <= wt <= PI) 0
- m_lut_waves[3][i] = (i < (SIN_LEN/2)) ? (INT16)(m * MAXOUT) : 0;
+ m_lut_waves[3][i] = (i < (SIN_LEN/2)) ? (int16_t)(m * MAXOUT) : 0;
// Waveform 4: sin(2wt) (0 <= wt <= PI) 0
- m_lut_waves[4][i] = (i < (SIN_LEN/2)) ? (INT16)(m2 * MAXOUT) : 0;
+ m_lut_waves[4][i] = (i < (SIN_LEN/2)) ? (int16_t)(m2 * MAXOUT) : 0;
// Waveform 5: |sin(2wt)| (0 <= wt <= PI) 0
- m_lut_waves[5][i] = (i < (SIN_LEN/2)) ? (INT16)(fabs(m2) * MAXOUT) : 0;
+ m_lut_waves[5][i] = (i < (SIN_LEN/2)) ? (int16_t)(fabs(m2) * MAXOUT) : 0;
// Waveform 6: 1 (0 <= wt <= 2PI)
- m_lut_waves[6][i] = (INT16)(1 * MAXOUT);
+ m_lut_waves[6][i] = (int16_t)(1 * MAXOUT);
m_lut_waves[7][i] = 0;
}
@@ -1717,7 +1717,7 @@ void ymf271_device::device_start()
init_state();
m_stream = machine().sound().stream_alloc(*this, 0, 2, clock()/384);
- m_mix_buffer = std::make_unique<INT32[]>(44100*2);
+ m_mix_buffer = std::make_unique<int32_t[]>(44100*2);
}
//-------------------------------------------------
@@ -1746,7 +1746,7 @@ void ymf271_device::device_reset()
const device_type YMF271 = &device_creator<ymf271_device>;
-ymf271_device::ymf271_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ymf271_device::ymf271_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, YMF271, "YMF271", tag, owner, clock, "ymf271", __FILE__)
, device_sound_interface(mconfig, *this)
, m_timerA(0)