diff options
Diffstat (limited to 'src/mame/audio/exidy440.cpp')
-rw-r--r-- | src/mame/audio/exidy440.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/mame/audio/exidy440.cpp b/src/mame/audio/exidy440.cpp index 78c122a9caf..04e9eadaeb5 100644 --- a/src/mame/audio/exidy440.cpp +++ b/src/mame/audio/exidy440.cpp @@ -48,7 +48,7 @@ static const int channel_bits[4] = const device_type EXIDY440 = &device_creator<exidy440_sound_device>; -exidy440_sound_device::exidy440_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) +exidy440_sound_device::exidy440_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, EXIDY440, "Exidy 440 CVSD", tag, owner, clock, "exidy440_sound", __FILE__), device_sound_interface(mconfig, *this), m_sound_command(0), @@ -121,15 +121,15 @@ void exidy440_sound_device::device_start() /* allocate the sample cache */ length = machine().root_device().memregion("cvsd")->bytes() * 16 + MAX_CACHE_ENTRIES * sizeof(sound_cache_entry); - m_sound_cache = (sound_cache_entry *)auto_alloc_array_clear(machine(), UINT8, length); + m_sound_cache = (sound_cache_entry *)auto_alloc_array_clear(machine(), uint8_t, length); /* determine the hard end of the cache and reset */ - m_sound_cache_max = (sound_cache_entry *)((UINT8 *)m_sound_cache + length); + m_sound_cache_max = (sound_cache_entry *)((uint8_t *)m_sound_cache + length); reset_sound_cache(); /* allocate the mixer buffer */ - m_mixer_buffer_left = make_unique_clear<INT32[]>(clock()); - m_mixer_buffer_right = make_unique_clear<INT32[]>(clock()); + m_mixer_buffer_left = make_unique_clear<int32_t[]>(clock()); + m_mixer_buffer_right = make_unique_clear<int32_t[]>(clock()); if (SOUND_LOG) m_debuglog = fopen("sound.log", "w"); @@ -151,10 +151,10 @@ void exidy440_sound_device::device_stop() * *************************************/ -void exidy440_sound_device::add_and_scale_samples(int ch, INT32 *dest, int samples, int volume) +void exidy440_sound_device::add_and_scale_samples(int ch, int32_t *dest, int samples, int volume) { sound_channel_data *channel = &m_sound_channel[ch]; - INT16 *srcdata; + int16_t *srcdata; int i; /* channels 2 and 3 are half-rate samples */ @@ -172,7 +172,7 @@ void exidy440_sound_device::add_and_scale_samples(int ch, INT32 *dest, int sampl /* copy 1 for 2 to the destination */ for (i = 0; i < samples; i += 2) { - INT16 sample = *srcdata++ * volume / 256; + int16_t sample = *srcdata++ * volume / 256; *dest++ += sample; *dest++ += sample; } @@ -197,14 +197,14 @@ void exidy440_sound_device::add_and_scale_samples(int ch, INT32 *dest, int sampl void exidy440_sound_device::mix_to_16(int length, stream_sample_t *dest_left, stream_sample_t *dest_right) { - INT32 *mixer_left = m_mixer_buffer_left.get(); - INT32 *mixer_right = m_mixer_buffer_right.get(); + int32_t *mixer_left = m_mixer_buffer_left.get(); + int32_t *mixer_right = m_mixer_buffer_right.get(); int i, clippers = 0; for (i = 0; i < length; i++) { - INT32 sample_left = *mixer_left++; - INT32 sample_right = *mixer_right++; + int32_t sample_left = *mixer_left++; + int32_t sample_right = *mixer_right++; if (sample_left < -32768) { sample_left = -32768; clippers++; } else if (sample_left > 32767) { sample_left = 32767; clippers++; } @@ -232,7 +232,7 @@ READ8_MEMBER( exidy440_sound_device::sound_command_r ) } -void exidy440_sound_device::exidy440_sound_command(UINT8 param) +void exidy440_sound_device::exidy440_sound_command(uint8_t param) { m_sound_command = param; m_sound_command_ack = 0; @@ -240,7 +240,7 @@ void exidy440_sound_device::exidy440_sound_command(UINT8 param) } -UINT8 exidy440_sound_device::exidy440_sound_command_ack() +uint8_t exidy440_sound_device::exidy440_sound_command_ack() { return m_sound_command_ack; } @@ -522,12 +522,12 @@ void exidy440_sound_device::reset_sound_cache() } -INT16 *exidy440_sound_device::add_to_sound_cache(UINT8 *input, int address, int length, int bits, int frequency) +int16_t *exidy440_sound_device::add_to_sound_cache(uint8_t *input, int address, int length, int bits, int frequency) { sound_cache_entry *current = m_sound_cache_end; /* compute where the end will be once we add this entry */ - m_sound_cache_end = (sound_cache_entry *)((UINT8 *)current + sizeof(sound_cache_entry) + length * 16); + m_sound_cache_end = (sound_cache_entry *)((uint8_t *)current + sizeof(sound_cache_entry) + length * 16); /* if this will overflow the cache, reset and re-add */ if (m_sound_cache_end > m_sound_cache_max) @@ -549,7 +549,7 @@ INT16 *exidy440_sound_device::add_to_sound_cache(UINT8 *input, int address, int } -INT16 *exidy440_sound_device::find_or_add_to_sound_cache(int address, int length, int bits, int frequency) +int16_t *exidy440_sound_device::find_or_add_to_sound_cache(int address, int length, int bits, int frequency) { sound_cache_entry *current; @@ -573,7 +573,7 @@ void exidy440_sound_device::play_cvsd(int ch) sound_channel_data *channel = &m_sound_channel[ch]; int address = m_m6844_channel[ch].address; int length = m_m6844_channel[ch].counter; - INT16 *base; + int16_t *base; /* add the bank number to the address */ if (m_sound_banks[ch] & 1) @@ -634,11 +634,11 @@ void exidy440_sound_device::stop_cvsd(int ch) * *************************************/ -void exidy440_sound_device::fir_filter(INT32 *input, INT16 *output, int count) +void exidy440_sound_device::fir_filter(int32_t *input, int16_t *output, int count) { while (count--) { - INT32 result = (input[-1] - input[-8] - input[-48] + input[-55]) << 2; + int32_t result = (input[-1] - input[-8] - input[-48] + input[-55]) << 2; result += (input[0] + input[-18] + input[-38] + input[-56]) << 3; result += (-input[-2] - input[-4] + input[-5] + input[-51] - input[-52] - input[-54]) << 4; result += (-input[-3] - input[-11] - input[-45] - input[-53]) << 5; @@ -669,9 +669,9 @@ void exidy440_sound_device::fir_filter(INT32 *input, INT16 *output, int count) * *************************************/ -void exidy440_sound_device::decode_and_filter_cvsd(UINT8 *input, int bytes, int maskbits, int frequency, INT16 *output) +void exidy440_sound_device::decode_and_filter_cvsd(uint8_t *input, int bytes, int maskbits, int frequency, int16_t *output) { - INT32 buffer[SAMPLE_BUFFER_LENGTH + FIR_HISTORY_LENGTH]; + int32_t buffer[SAMPLE_BUFFER_LENGTH + FIR_HISTORY_LENGTH]; int total_samples = bytes * 8; int mask = (1 << maskbits) - 1; double filter, integrator, leak; @@ -688,7 +688,7 @@ void exidy440_sound_device::decode_and_filter_cvsd(UINT8 *input, int bytes, int gain = SAMPLE_GAIN; /* clear the history words for a start */ - memset(&buffer[0], 0, FIR_HISTORY_LENGTH * sizeof(INT32)); + memset(&buffer[0], 0, FIR_HISTORY_LENGTH * sizeof(int32_t)); /* initialize the CVSD decoder */ steps = 0xaa; @@ -698,7 +698,7 @@ void exidy440_sound_device::decode_and_filter_cvsd(UINT8 *input, int bytes, int /* loop over chunks */ for (chunk_start = 0; chunk_start < total_samples; chunk_start += SAMPLE_BUFFER_LENGTH) { - INT32 *bufptr = &buffer[FIR_HISTORY_LENGTH]; + int32_t *bufptr = &buffer[FIR_HISTORY_LENGTH]; int chunk_bytes; int ind; @@ -771,13 +771,13 @@ void exidy440_sound_device::decode_and_filter_cvsd(UINT8 *input, int bytes, int fir_filter(&buffer[FIR_HISTORY_LENGTH], &output[chunk_start], chunk_bytes * 8); /* copy the last few input samples down to the start for a new history */ - memcpy(&buffer[0], &buffer[SAMPLE_BUFFER_LENGTH], FIR_HISTORY_LENGTH * sizeof(INT32)); + memcpy(&buffer[0], &buffer[SAMPLE_BUFFER_LENGTH], FIR_HISTORY_LENGTH * sizeof(int32_t)); } /* make sure the volume goes smoothly to 0 over the last 512 samples */ if (FADE_TO_ZERO) { - INT16 *data; + int16_t *data; chunk_start = (total_samples > 512) ? total_samples - 512 : 0; data = output + chunk_start; @@ -804,8 +804,8 @@ void exidy440_sound_device::sound_stream_update(sound_stream &stream, stream_sam int ch; /* reset the mixer buffers */ - memset(m_mixer_buffer_left.get(), 0, samples * sizeof(INT32)); - memset(m_mixer_buffer_right.get(), 0, samples * sizeof(INT32)); + memset(m_mixer_buffer_left.get(), 0, samples * sizeof(int32_t)); + memset(m_mixer_buffer_right.get(), 0, samples * sizeof(int32_t)); /* loop over channels */ for (ch = 0; ch < 4; ch++) |