mirror of
https://github.com/holub/mame
synced 2025-07-05 01:48:29 +03:00
sound/upd1771.cpp: Improve check for end of adpcm stream when the stream contains multiple samples. (#12913)
* Fixes SCV Star Speeder.
This commit is contained in:
parent
b5ee6d82d2
commit
2ba3fe29c1
@ -432,15 +432,30 @@ void upd1771c_device::write(uint8_t data)
|
|||||||
//6Khz(ish) DIGI playback
|
//6Khz(ish) DIGI playback
|
||||||
|
|
||||||
//end capture
|
//end capture
|
||||||
|
{
|
||||||
|
bool have_all_data = false;
|
||||||
if (m_index >= 2 && m_packet[m_index - 2] == 0xfe && m_packet[m_index - 1] == 0x00)
|
if (m_index >= 2 && m_packet[m_index - 2] == 0xfe && m_packet[m_index - 1] == 0x00)
|
||||||
{
|
{
|
||||||
//TODO play capture!
|
//TODO play capture!
|
||||||
|
if (m_index >= 6)
|
||||||
|
{
|
||||||
|
// offsets 2 and 3 in the transferred pcm data seem to contain the number of samples
|
||||||
|
uint16_t count = (m_packet[4] << 8) | m_packet[3];
|
||||||
|
count--;
|
||||||
|
m_packet[3] = count & 0xff;
|
||||||
|
m_packet[4] = (count >> 8);
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
m_index = 0;
|
m_index = 0;
|
||||||
m_packet[0] = 0;
|
m_packet[0] = 0;
|
||||||
m_state = STATE_ADPCM;
|
m_state = STATE_ADPCM;
|
||||||
|
have_all_data = true;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
}
|
||||||
|
if (!have_all_data)
|
||||||
m_timer->adjust(attotime::from_ticks(512, clock()));
|
m_timer->adjust(attotime::from_ticks(512, clock()));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//garbage: wipe stack
|
//garbage: wipe stack
|
||||||
|
Loading…
Reference in New Issue
Block a user