diff options
author | Aaron Giles <aaron@aarongiles.com> | 2021-06-22 00:39:32 -0700 |
---|---|---|
committer | Aaron Giles <aaron@aarongiles.com> | 2021-06-22 00:39:32 -0700 |
commit | 86d1ef260440adbd0db84a897d624383f23526ed (patch) | |
tree | 3f80ff4c7da56bdc310a4f2674817c7fe0f9b573 | |
parent | 4728cc9c4d7449322c9331daccd2bae328a374d2 (diff) |
ymfm: Play ADPCM-A samples through the end of the end block inclusive
-rw-r--r-- | 3rdparty/ymfm/src/ymfm_adpcm.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/3rdparty/ymfm/src/ymfm_adpcm.cpp b/3rdparty/ymfm/src/ymfm_adpcm.cpp index 882dcf3de7c..0d285cd163b 100644 --- a/3rdparty/ymfm/src/ymfm_adpcm.cpp +++ b/3rdparty/ymfm/src/ymfm_adpcm.cpp @@ -157,20 +157,25 @@ bool adpcm_a_channel::clock() return false; } - // stop when we hit the end address; apparently only low 20 bits are used for - // comparison on the YM2610: this affects sample playback in some games, for - // example twinspri character select screen music will skip some samples if - // this is not correct - if (((m_curaddress ^ (m_regs.ch_end(m_choffs) << m_address_shift)) & 0xfffff) == 0) - { - m_playing = m_accumulator = 0; - return true; - } - // if we're about to read nibble 0, fetch the data uint8_t data; if (m_curnibble == 0) { + // stop when we hit the end address; apparently only low 20 bits are used for + // comparison on the YM2610: this affects sample playback in some games, for + // example twinspri character select screen music will skip some samples if + // this is not correct + // + // note also: end address is inclusive, so wait until we are about to fetch + // the sample just after the end before stopping; this is needed for nitd's + // jump sound, for example + uint32_t end = (m_regs.ch_end(m_choffs) + 1) << m_address_shift; + if (((m_curaddress ^ end) & 0xfffff) == 0) + { + m_playing = m_accumulator = 0; + return true; + } + m_curbyte = m_owner.intf().ymfm_external_read(ACCESS_ADPCM_A, m_curaddress++); data = m_curbyte >> 4; m_curnibble = 1; |