mirror of
https://github.com/mamedev/mame.git
synced 2024-11-16 07:48:32 +01: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
1 changed files with 22 additions and 7 deletions
|
@ -432,15 +432,30 @@ void upd1771c_device::write(uint8_t data)
|
|||
//6Khz(ish) DIGI playback
|
||||
|
||||
//end capture
|
||||
if (m_index >= 2 && m_packet[m_index - 2] == 0xfe && m_packet[m_index - 1] == 0x00)
|
||||
{
|
||||
//TODO play capture!
|
||||
m_index = 0;
|
||||
m_packet[0] = 0;
|
||||
m_state = STATE_ADPCM;
|
||||
bool have_all_data = false;
|
||||
if (m_index >= 2 && m_packet[m_index - 2] == 0xfe && m_packet[m_index - 1] == 0x00)
|
||||
{
|
||||
//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_packet[0] = 0;
|
||||
m_state = STATE_ADPCM;
|
||||
have_all_data = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!have_all_data)
|
||||
m_timer->adjust(attotime::from_ticks(512, clock()));
|
||||
}
|
||||
else
|
||||
m_timer->adjust(attotime::from_ticks(512, clock()));
|
||||
break;
|
||||
|
||||
//garbage: wipe stack
|
||||
|
|
Loading…
Reference in a new issue