From ce595bc9fab3e97208e744d1e88b1c1d4b13391d Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Sun, 14 Jun 2015 04:37:17 -0400 Subject: [PATCH] tms5110.c and tms5220.c: fix missing cast for chirp/excitation values, fix a potential off-by-one for tms5110.c as well. [Lord Nightmare] --- src/emu/sound/tms5110.c | 18 +++++++----------- src/emu/sound/tms5220.c | 4 ++-- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/emu/sound/tms5110.c b/src/emu/sound/tms5110.c index 0df81b1d56d..c5861e2d7c6 100644 --- a/src/emu/sound/tms5110.c +++ b/src/emu/sound/tms5110.c @@ -497,21 +497,17 @@ void tms5110_device::process(INT16 *buffer, unsigned int size) } else { - /* generate voiced samples here */ + // generate voiced samples here /* US patent 4331836 Figure 14B shows, and logic would hold, that a pitch based chirp * function has a chirp/peak and then a long chain of zeroes. - * The last entry of the chirp rom is at address 0b110011 (50d), the 51st sample, + * The last entry of the chirp rom is at address 0b110011 (51d), the 52nd sample, * and if the address reaches that point the ADDRESS incrementer is - * disabled, forcing all samples beyond 50d to be == 50d - * (address 50d holds zeroes) + * disabled, forcing all samples beyond 51d to be == 51d */ - - /*if (m_coeff->subtype & (SUBTYPE_TMS5100 | SUBTYPE_M58817))*/ - - if (m_pitch_count > 50) - current_val = m_coeff->chirptable[50]; - else - current_val = m_coeff->chirptable[m_pitch_count]; + if (m_pitch_count >= 51) + current_val = (INT8)m_coeff->chirptable[51]; + else /*m_pitch_count < 51*/ + current_val = (INT8)m_coeff->chirptable[m_pitch_count]; } /* Update LFSR *20* times every sample, like patent shows */ diff --git a/src/emu/sound/tms5220.c b/src/emu/sound/tms5220.c index 004925d031f..d71344a01e8 100644 --- a/src/emu/sound/tms5220.c +++ b/src/emu/sound/tms5220.c @@ -920,9 +920,9 @@ void tms5220_device::process(INT16 *buffer, unsigned int size) * disabled, forcing all samples beyond 51d to be == 51d */ if (m_pitch_count >= 51) - m_excitation_data = m_coeff->chirptable[51]; + m_excitation_data = (INT8)m_coeff->chirptable[51]; else /*m_pitch_count < 51*/ - m_excitation_data = m_coeff->chirptable[m_pitch_count]; + m_excitation_data = (INT8)m_coeff->chirptable[m_pitch_count]; } // Update LFSR *20* times every sample (once per T cycle), like patent shows