CDROM: Play audio when reading and mode.0 is set

This commit is contained in:
Connor McLaughlin 2020-07-22 15:23:13 +10:00
parent e9db1d0f6f
commit 10cd00c8dd
1 changed files with 34 additions and 29 deletions

View File

@ -1959,7 +1959,8 @@ void CDROM::DoSectorRead()
{ {
ProcessDataSector(m_reader.GetSectorBuffer().data(), subq); ProcessDataSector(m_reader.GetSectorBuffer().data(), subq);
} }
else if (!is_data_sector && m_drive_state == DriveState::Playing) else if (!is_data_sector &&
(m_drive_state == DriveState::Playing || (m_drive_state == DriveState::Reading && m_mode.cdda)))
{ {
ProcessCDDASector(m_reader.GetSectorBuffer().data(), subq); ProcessCDDASector(m_reader.GetSectorBuffer().data(), subq);
} }
@ -2233,8 +2234,11 @@ void CDROM::ProcessCDDASector(const u8* raw_sector, const CDImage::SubChannelQ&
{ {
// For CDDA sectors, the whole sector contains the audio data. // For CDDA sectors, the whole sector contains the audio data.
Log_DevPrintf("Read sector %u as CDDA", m_current_lba); Log_DevPrintf("Read sector %u as CDDA", m_current_lba);
m_secondary_status.playing_cdda = true;
// These bits/reporting doesn't happen if we're reading with the CDDA mode bit set.
if (m_drive_state == DriveState::Playing)
{
m_secondary_status.playing_cdda = true;
if (m_mode.report_audio) if (m_mode.report_audio)
{ {
const u8 frame_nibble = subq.absolute_frame_bcd >> 4; const u8 frame_nibble = subq.absolute_frame_bcd >> 4;
@ -2268,6 +2272,7 @@ void CDROM::ProcessCDDASector(const u8* raw_sector, const CDImage::SubChannelQ&
SetAsyncInterrupt(Interrupt::DataReady); SetAsyncInterrupt(Interrupt::DataReady);
} }
} }
}
// Apply volume when pushing sectors to SPU. // Apply volume when pushing sectors to SPU.
if (m_muted) if (m_muted)