2019-09-17 09:22:39 +00:00
|
|
|
#pragma once
|
2020-03-12 03:51:53 +00:00
|
|
|
#include "cdrom_async_reader.h"
|
2019-09-17 09:22:39 +00:00
|
|
|
#include "common/bitfield.h"
|
2019-10-04 09:05:19 +00:00
|
|
|
#include "common/cd_image.h"
|
2019-10-15 07:27:35 +00:00
|
|
|
#include "common/cd_xa.h"
|
2019-10-05 06:07:15 +00:00
|
|
|
#include "common/fifo_queue.h"
|
2019-10-27 03:44:23 +00:00
|
|
|
#include "common/heap_array.h"
|
2019-09-21 15:12:16 +00:00
|
|
|
#include "types.h"
|
2019-10-15 07:27:35 +00:00
|
|
|
#include <array>
|
2019-09-24 13:55:22 +00:00
|
|
|
#include <string>
|
2020-07-21 14:03:44 +00:00
|
|
|
#include <tuple>
|
2019-09-24 11:39:38 +00:00
|
|
|
#include <vector>
|
2019-09-17 09:22:39 +00:00
|
|
|
|
|
|
|
class StateWrapper;
|
2020-01-24 04:53:40 +00:00
|
|
|
class TimingEvent;
|
2019-09-17 09:22:39 +00:00
|
|
|
|
2020-07-31 07:09:18 +00:00
|
|
|
class CDROM final
|
2019-09-17 09:22:39 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
CDROM();
|
|
|
|
~CDROM();
|
|
|
|
|
2020-07-31 07:09:18 +00:00
|
|
|
void Initialize();
|
|
|
|
void Shutdown();
|
2019-09-17 09:22:39 +00:00
|
|
|
void Reset();
|
|
|
|
bool DoState(StateWrapper& sw);
|
|
|
|
|
2020-05-19 16:26:06 +00:00
|
|
|
bool HasMedia() const { return m_reader.HasMedia(); }
|
2020-07-22 16:36:05 +00:00
|
|
|
const std::string& GetMediaFileName() const { return m_reader.GetMediaFileName(); }
|
2020-05-19 16:26:06 +00:00
|
|
|
|
2019-11-16 05:27:57 +00:00
|
|
|
void InsertMedia(std::unique_ptr<CDImage> media);
|
2020-07-21 14:02:37 +00:00
|
|
|
std::unique_ptr<CDImage> RemoveMedia(bool force = false);
|
2019-09-20 10:14:00 +00:00
|
|
|
|
2020-09-29 13:29:28 +00:00
|
|
|
void CPUClockChanged();
|
|
|
|
|
2019-09-17 09:22:39 +00:00
|
|
|
// I/O
|
|
|
|
u8 ReadRegister(u32 offset);
|
|
|
|
void WriteRegister(u32 offset, u8 value);
|
2019-10-13 06:48:11 +00:00
|
|
|
void DMARead(u32* words, u32 word_count);
|
2019-09-17 09:22:39 +00:00
|
|
|
|
2019-10-17 13:54:51 +00:00
|
|
|
// Render statistics debug window.
|
|
|
|
void DrawDebugWindow();
|
|
|
|
|
2020-02-21 15:19:10 +00:00
|
|
|
void SetUseReadThread(bool enabled);
|
|
|
|
|
2020-07-21 14:03:44 +00:00
|
|
|
/// Reads a frame from the audio FIFO, used by the SPU.
|
|
|
|
ALWAYS_INLINE std::tuple<s16, s16> GetAudioFrame()
|
|
|
|
{
|
|
|
|
const u32 frame = m_audio_fifo.IsEmpty() ? 0u : m_audio_fifo.Pop();
|
|
|
|
return std::tuple<s16, s16>(static_cast<s16>(frame), static_cast<s16>(frame >> 16));
|
|
|
|
}
|
|
|
|
|
2019-09-17 09:22:39 +00:00
|
|
|
private:
|
2019-10-27 03:44:23 +00:00
|
|
|
enum : u32
|
|
|
|
{
|
|
|
|
RAW_SECTOR_OUTPUT_SIZE = CDImage::RAW_SECTOR_SIZE - CDImage::SECTOR_SYNC_SIZE,
|
|
|
|
DATA_SECTOR_OUTPUT_SIZE = CDImage::DATA_SECTOR_SIZE,
|
|
|
|
SECTOR_SYNC_SIZE = CDImage::SECTOR_SYNC_SIZE,
|
|
|
|
SECTOR_HEADER_SIZE = CDImage::SECTOR_HEADER_SIZE,
|
|
|
|
XA_RESAMPLE_RING_BUFFER_SIZE = 32,
|
|
|
|
XA_RESAMPLE_ZIGZAG_TABLE_SIZE = 29,
|
|
|
|
XA_RESAMPLE_NUM_ZIGZAG_TABLES = 7,
|
|
|
|
|
|
|
|
PARAM_FIFO_SIZE = 16,
|
|
|
|
RESPONSE_FIFO_SIZE = 16,
|
|
|
|
DATA_FIFO_SIZE = RAW_SECTOR_OUTPUT_SIZE,
|
2020-03-28 15:13:25 +00:00
|
|
|
NUM_SECTOR_BUFFERS = 8,
|
2020-07-21 14:03:44 +00:00
|
|
|
AUDIO_FIFO_SIZE = 44100 * 2,
|
|
|
|
AUDIO_FIFO_LOW_WATERMARK = 5,
|
2020-07-11 10:34:16 +00:00
|
|
|
|
|
|
|
BASE_RESET_TICKS = 400000,
|
2020-10-29 10:57:10 +00:00
|
|
|
|
|
|
|
MAX_FAST_FORWARD_RATE = 12,
|
|
|
|
FAST_FORWARD_RATE_STEP = 4
|
2019-10-27 03:44:23 +00:00
|
|
|
};
|
|
|
|
|
2019-09-17 09:22:39 +00:00
|
|
|
static constexpr u8 INTERRUPT_REGISTER_MASK = 0x1F;
|
|
|
|
|
2019-09-17 12:18:58 +00:00
|
|
|
enum class Interrupt : u8
|
|
|
|
{
|
2020-03-07 05:10:19 +00:00
|
|
|
DataReady = 0x01,
|
|
|
|
Complete = 0x02,
|
2019-09-24 14:41:09 +00:00
|
|
|
ACK = 0x03,
|
2020-03-07 05:10:19 +00:00
|
|
|
DataEnd = 0x04,
|
|
|
|
Error = 0x05
|
2019-09-17 12:18:58 +00:00
|
|
|
};
|
|
|
|
|
2019-10-27 09:42:37 +00:00
|
|
|
enum class Command : u16
|
2019-09-17 12:18:58 +00:00
|
|
|
{
|
|
|
|
Sync = 0x00,
|
|
|
|
Getstat = 0x01,
|
|
|
|
Setloc = 0x02,
|
|
|
|
Play = 0x03,
|
|
|
|
Forward = 0x04,
|
|
|
|
Backward = 0x05,
|
|
|
|
ReadN = 0x06,
|
|
|
|
MotorOn = 0x07,
|
|
|
|
Stop = 0x08,
|
|
|
|
Pause = 0x09,
|
2020-03-28 15:15:04 +00:00
|
|
|
Reset = 0x0A,
|
2019-09-17 12:18:58 +00:00
|
|
|
Mute = 0x0B,
|
|
|
|
Demute = 0x0C,
|
|
|
|
Setfilter = 0x0D,
|
|
|
|
Setmode = 0x0E,
|
|
|
|
Getparam = 0x0F,
|
|
|
|
GetlocL = 0x10,
|
|
|
|
GetlocP = 0x11,
|
|
|
|
SetSession = 0x12,
|
|
|
|
GetTN = 0x13,
|
|
|
|
GetTD = 0x14,
|
|
|
|
SeekL = 0x15,
|
|
|
|
SeekP = 0x16,
|
|
|
|
SetClock = 0x17,
|
|
|
|
GetClock = 0x18,
|
|
|
|
Test = 0x19,
|
|
|
|
GetID = 0x1A,
|
|
|
|
ReadS = 0x1B,
|
2020-03-28 15:15:04 +00:00
|
|
|
Init = 0x1C,
|
2019-09-17 12:18:58 +00:00
|
|
|
GetQ = 0x1D,
|
|
|
|
ReadTOC = 0x1E,
|
2019-10-27 09:42:37 +00:00
|
|
|
VideoCD = 0x1F,
|
|
|
|
|
|
|
|
None = 0xFFFF
|
2019-09-17 12:18:58 +00:00
|
|
|
};
|
|
|
|
|
2019-10-27 09:42:37 +00:00
|
|
|
enum class DriveState : u8
|
2019-09-17 09:22:39 +00:00
|
|
|
{
|
2019-09-21 15:12:16 +00:00
|
|
|
Idle,
|
2020-05-19 16:26:06 +00:00
|
|
|
ShellOpening,
|
2020-03-28 15:15:04 +00:00
|
|
|
Resetting,
|
2019-11-16 02:54:41 +00:00
|
|
|
SeekingPhysical,
|
|
|
|
SeekingLogical,
|
2019-10-27 09:42:37 +00:00
|
|
|
ReadingID,
|
2019-11-08 14:21:11 +00:00
|
|
|
ReadingTOC,
|
2019-10-27 09:42:37 +00:00
|
|
|
Reading,
|
|
|
|
Playing,
|
2019-10-28 07:19:29 +00:00
|
|
|
Pausing,
|
2020-03-07 05:10:19 +00:00
|
|
|
Stopping,
|
|
|
|
ChangingSession
|
2019-09-17 09:22:39 +00:00
|
|
|
};
|
|
|
|
|
2019-09-21 15:12:16 +00:00
|
|
|
union StatusRegister
|
2019-09-17 09:22:39 +00:00
|
|
|
{
|
|
|
|
u8 bits;
|
|
|
|
BitField<u8, u8, 0, 2> index;
|
|
|
|
BitField<u8, bool, 2, 1> ADPBUSY;
|
|
|
|
BitField<u8, bool, 3, 1> PRMEMPTY;
|
|
|
|
BitField<u8, bool, 4, 1> PRMWRDY;
|
|
|
|
BitField<u8, bool, 5, 1> RSLRRDY;
|
|
|
|
BitField<u8, bool, 6, 1> DRQSTS;
|
|
|
|
BitField<u8, bool, 7, 1> BUSYSTS;
|
2019-09-21 15:12:16 +00:00
|
|
|
};
|
2019-09-17 09:22:39 +00:00
|
|
|
|
2020-03-08 05:53:53 +00:00
|
|
|
enum StatBits : u8
|
|
|
|
{
|
|
|
|
STAT_ERROR = (1 << 0),
|
|
|
|
STAT_MOTOR_ON = (1 << 1),
|
|
|
|
STAT_SEEK_ERROR = (1 << 2),
|
|
|
|
STAT_ID_ERROR = (1 << 3),
|
|
|
|
STAT_SHELL_OPEN = (1 << 4),
|
2020-03-29 07:41:31 +00:00
|
|
|
STAT_READING = (1 << 5),
|
2020-03-08 05:53:53 +00:00
|
|
|
STAT_SEEKING = (1 << 6),
|
|
|
|
STAT_PLAYING_CDDA = (1 << 7)
|
|
|
|
};
|
|
|
|
|
2020-03-31 12:28:55 +00:00
|
|
|
enum ErrorReason : u8
|
|
|
|
{
|
2020-05-30 11:59:03 +00:00
|
|
|
ERROR_REASON_INVALID_ARGUMENT = 0x10,
|
|
|
|
ERROR_REASON_INCORRECT_NUMBER_OF_PARAMETERS = 0x20,
|
|
|
|
ERROR_REASON_INVALID_COMMAND = 0x40,
|
|
|
|
ERROR_REASON_NOT_READY = 0x80
|
2020-03-31 12:28:55 +00:00
|
|
|
};
|
|
|
|
|
2019-09-21 15:12:16 +00:00
|
|
|
union SecondaryStatusRegister
|
2019-09-17 12:18:58 +00:00
|
|
|
{
|
|
|
|
u8 bits;
|
|
|
|
BitField<u8, bool, 0, 1> error;
|
|
|
|
BitField<u8, bool, 1, 1> motor_on;
|
|
|
|
BitField<u8, bool, 2, 1> seek_error;
|
|
|
|
BitField<u8, bool, 3, 1> id_error;
|
|
|
|
BitField<u8, bool, 4, 1> shell_open;
|
2020-03-29 07:41:31 +00:00
|
|
|
BitField<u8, bool, 5, 1> reading;
|
2019-09-17 12:18:58 +00:00
|
|
|
BitField<u8, bool, 6, 1> seeking;
|
|
|
|
BitField<u8, bool, 7, 1> playing_cdda;
|
2019-10-20 05:55:23 +00:00
|
|
|
|
2020-03-28 15:16:01 +00:00
|
|
|
/// Clears the CDDA/seeking bits.
|
2020-03-29 07:41:31 +00:00
|
|
|
ALWAYS_INLINE void ClearActiveBits() { bits &= ~(STAT_SEEKING | STAT_READING | STAT_PLAYING_CDDA); }
|
2019-09-21 15:12:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
union ModeRegister
|
|
|
|
{
|
|
|
|
u8 bits;
|
|
|
|
BitField<u8, bool, 0, 1> cdda;
|
|
|
|
BitField<u8, bool, 1, 1> auto_pause;
|
|
|
|
BitField<u8, bool, 2, 1> report_audio;
|
|
|
|
BitField<u8, bool, 3, 1> xa_filter;
|
|
|
|
BitField<u8, bool, 4, 1> ignore_bit;
|
|
|
|
BitField<u8, bool, 5, 1> read_raw_sector;
|
2019-09-30 10:01:41 +00:00
|
|
|
BitField<u8, bool, 6, 1> xa_enable;
|
2019-09-21 15:12:16 +00:00
|
|
|
BitField<u8, bool, 7, 1> double_speed;
|
|
|
|
};
|
|
|
|
|
|
|
|
union RequestRegister
|
|
|
|
{
|
|
|
|
u8 bits;
|
|
|
|
BitField<u8, bool, 5, 1> SMEN;
|
|
|
|
BitField<u8, bool, 6, 1> BFWR;
|
|
|
|
BitField<u8, bool, 7, 1> BFRD;
|
|
|
|
};
|
|
|
|
|
2019-10-05 06:07:15 +00:00
|
|
|
void SoftReset();
|
|
|
|
|
2020-07-21 14:03:44 +00:00
|
|
|
ALWAYS_INLINE bool IsDriveIdle() const { return m_drive_state == DriveState::Idle; }
|
|
|
|
ALWAYS_INLINE bool IsSeeking() const
|
2020-05-19 15:52:53 +00:00
|
|
|
{
|
2020-07-11 10:34:16 +00:00
|
|
|
return (m_drive_state == DriveState::SeekingLogical || m_drive_state == DriveState::SeekingPhysical ||
|
|
|
|
m_drive_state == DriveState::Resetting);
|
2020-05-19 15:52:53 +00:00
|
|
|
}
|
2020-07-21 14:03:44 +00:00
|
|
|
ALWAYS_INLINE bool IsReadingOrPlaying() const
|
2020-06-01 14:59:11 +00:00
|
|
|
{
|
|
|
|
return (m_drive_state == DriveState::Reading || m_drive_state == DriveState::Playing);
|
|
|
|
}
|
2020-07-21 14:03:44 +00:00
|
|
|
ALWAYS_INLINE bool CanReadMedia() const { return (m_drive_state != DriveState::ShellOpening && m_reader.HasMedia()); }
|
|
|
|
ALWAYS_INLINE bool HasPendingCommand() const { return m_command != Command::None; }
|
|
|
|
ALWAYS_INLINE bool HasPendingInterrupt() const { return m_interrupt_flag_register != 0; }
|
|
|
|
ALWAYS_INLINE bool HasPendingAsyncInterrupt() const { return m_pending_async_interrupt != 0; }
|
|
|
|
ALWAYS_INLINE void AddCDAudioFrame(s16 left, s16 right)
|
|
|
|
{
|
|
|
|
m_audio_fifo.Push(ZeroExtend32(static_cast<u16>(left)) | (ZeroExtend32(static_cast<u16>(right)) << 16));
|
|
|
|
}
|
|
|
|
|
2019-09-21 15:12:16 +00:00
|
|
|
void SetInterrupt(Interrupt interrupt);
|
2019-10-26 07:41:37 +00:00
|
|
|
void SetAsyncInterrupt(Interrupt interrupt);
|
2019-11-12 10:31:59 +00:00
|
|
|
void ClearAsyncInterrupt();
|
2019-10-26 07:41:37 +00:00
|
|
|
void DeliverAsyncInterrupt();
|
2019-10-26 06:12:37 +00:00
|
|
|
void SendACKAndStat();
|
2020-03-08 05:53:53 +00:00
|
|
|
void SendErrorResponse(u8 stat_bits = STAT_ERROR, u8 reason = 0x80);
|
|
|
|
void SendAsyncErrorResponse(u8 stat_bits = STAT_ERROR, u8 reason = 0x80);
|
2019-09-21 15:12:16 +00:00
|
|
|
void UpdateStatusRegister();
|
2019-11-08 13:48:09 +00:00
|
|
|
void UpdateInterruptRequest();
|
2019-09-21 15:12:16 +00:00
|
|
|
|
2020-04-10 14:40:39 +00:00
|
|
|
TickCount GetAckDelayForCommand(Command command);
|
|
|
|
TickCount GetTicksForRead();
|
|
|
|
TickCount GetTicksForSeek(CDImage::LBA new_lba);
|
2020-05-19 16:26:06 +00:00
|
|
|
TickCount GetTicksForStop(bool motor_was_on);
|
2020-06-01 14:59:11 +00:00
|
|
|
CDImage::LBA GetNextSectorToBeRead();
|
2019-09-21 15:12:16 +00:00
|
|
|
void BeginCommand(Command command); // also update status register
|
2019-11-10 13:03:52 +00:00
|
|
|
void EndCommand(); // also updates status register
|
2020-03-31 12:28:48 +00:00
|
|
|
void AbortCommand();
|
2019-09-21 15:12:16 +00:00
|
|
|
void ExecuteCommand();
|
|
|
|
void ExecuteTestCommand(u8 subcommand);
|
2020-01-24 04:53:40 +00:00
|
|
|
void UpdateCommandEvent();
|
|
|
|
void ExecuteDrive(TickCount ticks_late);
|
2020-04-25 04:16:20 +00:00
|
|
|
void BeginReading(TickCount ticks_late = 0, bool after_seek = false);
|
|
|
|
void BeginPlaying(u8 track_bcd, TickCount ticks_late = 0, bool after_seek = false);
|
2020-05-19 16:26:06 +00:00
|
|
|
void DoShellOpenComplete(TickCount ticks_late);
|
2020-03-28 15:15:04 +00:00
|
|
|
void DoResetComplete(TickCount ticks_late);
|
2020-01-24 04:53:40 +00:00
|
|
|
void DoSeekComplete(TickCount ticks_late);
|
2019-10-27 09:42:37 +00:00
|
|
|
void DoPauseComplete();
|
2019-10-28 07:19:29 +00:00
|
|
|
void DoStopComplete();
|
2020-03-07 05:10:19 +00:00
|
|
|
void DoChangeSessionComplete();
|
2019-10-27 09:42:37 +00:00
|
|
|
void DoIDRead();
|
2019-11-08 14:21:11 +00:00
|
|
|
void DoTOCRead();
|
2019-09-21 15:12:16 +00:00
|
|
|
void DoSectorRead();
|
2020-03-29 07:41:31 +00:00
|
|
|
void ProcessDataSectorHeader(const u8* raw_sector);
|
2019-11-12 10:31:59 +00:00
|
|
|
void ProcessDataSector(const u8* raw_sector, const CDImage::SubChannelQ& subq);
|
|
|
|
void ProcessXAADPCMSector(const u8* raw_sector, const CDImage::SubChannelQ& subq);
|
|
|
|
void ProcessCDDASector(const u8* raw_sector, const CDImage::SubChannelQ& subq);
|
2020-05-08 00:50:22 +00:00
|
|
|
void StopReadingWithDataEnd();
|
2019-11-16 02:54:41 +00:00
|
|
|
void BeginSeeking(bool logical, bool read_after_seek, bool play_after_seek);
|
2020-05-19 15:52:53 +00:00
|
|
|
void UpdatePositionWhileSeeking();
|
2020-04-04 15:39:43 +00:00
|
|
|
void ResetCurrentXAFile();
|
2020-07-21 14:03:44 +00:00
|
|
|
void ResetAudioDecoder();
|
2019-09-30 10:01:41 +00:00
|
|
|
void LoadDataFIFO();
|
2020-03-12 05:32:41 +00:00
|
|
|
void ClearSectorBuffers();
|
2019-09-21 15:12:16 +00:00
|
|
|
|
2020-07-21 14:03:44 +00:00
|
|
|
template<bool STEREO, bool SAMPLE_RATE>
|
|
|
|
void ResampleXAADPCM(const s16* frames_in, u32 num_frames_in);
|
|
|
|
|
2020-01-24 04:53:40 +00:00
|
|
|
std::unique_ptr<TimingEvent> m_command_event;
|
|
|
|
std::unique_ptr<TimingEvent> m_drive_event;
|
2019-09-21 15:12:16 +00:00
|
|
|
|
2019-10-27 09:42:37 +00:00
|
|
|
Command m_command = Command::None;
|
|
|
|
DriveState m_drive_state = DriveState::Idle;
|
2020-03-12 03:51:53 +00:00
|
|
|
DiscRegion m_disc_region = DiscRegion::Other;
|
2019-09-21 15:12:16 +00:00
|
|
|
|
|
|
|
StatusRegister m_status = {};
|
|
|
|
SecondaryStatusRegister m_secondary_status = {};
|
|
|
|
ModeRegister m_mode = {};
|
2020-04-10 14:40:39 +00:00
|
|
|
bool m_current_double_speed = false;
|
2019-09-17 12:18:58 +00:00
|
|
|
|
2019-10-15 07:27:35 +00:00
|
|
|
u8 m_interrupt_enable_register = INTERRUPT_REGISTER_MASK;
|
|
|
|
u8 m_interrupt_flag_register = 0;
|
2019-10-26 07:41:37 +00:00
|
|
|
u8 m_pending_async_interrupt = 0;
|
2019-10-15 07:27:35 +00:00
|
|
|
|
2019-10-26 11:07:28 +00:00
|
|
|
CDImage::Position m_setloc_position = {};
|
2020-05-19 15:52:53 +00:00
|
|
|
CDImage::LBA m_current_lba{};
|
|
|
|
CDImage::LBA m_seek_start_lba{};
|
|
|
|
CDImage::LBA m_seek_end_lba{};
|
2019-10-26 11:07:28 +00:00
|
|
|
bool m_setloc_pending = false;
|
|
|
|
bool m_read_after_seek = false;
|
|
|
|
bool m_play_after_seek = false;
|
|
|
|
|
|
|
|
bool m_muted = false;
|
|
|
|
bool m_adpcm_muted = false;
|
2019-10-15 07:27:35 +00:00
|
|
|
|
2020-04-04 15:39:43 +00:00
|
|
|
u8 m_xa_filter_file_number = 0;
|
|
|
|
u8 m_xa_filter_channel_number = 0;
|
|
|
|
u8 m_xa_current_file_number = 0;
|
|
|
|
u8 m_xa_current_channel_number = 0;
|
|
|
|
u8 m_xa_current_set = false;
|
2019-10-15 07:27:35 +00:00
|
|
|
|
2019-11-10 12:45:48 +00:00
|
|
|
CDImage::SectorHeader m_last_sector_header{};
|
|
|
|
CDXA::XASubHeader m_last_sector_subheader{};
|
2020-03-29 07:41:31 +00:00
|
|
|
bool m_last_sector_header_valid = false;
|
2019-11-10 12:45:48 +00:00
|
|
|
CDImage::SubChannelQ m_last_subq{};
|
2019-11-10 13:03:52 +00:00
|
|
|
u8 m_last_cdda_report_frame_nibble = 0xFF;
|
2019-11-13 06:33:49 +00:00
|
|
|
u8 m_play_track_number_bcd = 0xFF;
|
2020-03-07 05:10:19 +00:00
|
|
|
u8 m_async_command_parameter = 0x00;
|
2020-10-29 10:57:10 +00:00
|
|
|
s8 m_fast_forward_rate = 0;
|
2019-10-04 09:05:19 +00:00
|
|
|
|
2019-10-15 07:27:35 +00:00
|
|
|
std::array<std::array<u8, 2>, 2> m_cd_audio_volume_matrix{};
|
|
|
|
std::array<std::array<u8, 2>, 2> m_next_cd_audio_volume_matrix{};
|
|
|
|
|
|
|
|
std::array<s32, 4> m_xa_last_samples{};
|
|
|
|
std::array<std::array<s16, XA_RESAMPLE_RING_BUFFER_SIZE>, 2> m_xa_resample_ring_buffer{};
|
|
|
|
u8 m_xa_resample_p = 0;
|
|
|
|
u8 m_xa_resample_sixstep = 6;
|
2019-09-17 09:22:39 +00:00
|
|
|
|
|
|
|
InlineFIFOQueue<u8, PARAM_FIFO_SIZE> m_param_fifo;
|
|
|
|
InlineFIFOQueue<u8, RESPONSE_FIFO_SIZE> m_response_fifo;
|
2019-10-26 07:41:37 +00:00
|
|
|
InlineFIFOQueue<u8, RESPONSE_FIFO_SIZE> m_async_response_fifo;
|
2019-09-17 09:22:39 +00:00
|
|
|
HeapFIFOQueue<u8, DATA_FIFO_SIZE> m_data_fifo;
|
2020-03-12 05:32:41 +00:00
|
|
|
|
|
|
|
struct SectorBuffer
|
|
|
|
{
|
|
|
|
HeapArray<u8, RAW_SECTOR_OUTPUT_SIZE> data;
|
|
|
|
u32 size;
|
|
|
|
};
|
|
|
|
|
2020-03-28 15:13:25 +00:00
|
|
|
u32 m_current_read_sector_buffer = 0;
|
|
|
|
u32 m_current_write_sector_buffer = 0;
|
2020-03-12 05:32:41 +00:00
|
|
|
std::array<SectorBuffer, NUM_SECTOR_BUFFERS> m_sector_buffers;
|
2020-02-21 15:19:10 +00:00
|
|
|
|
|
|
|
CDROMAsyncReader m_reader;
|
2020-07-21 14:03:44 +00:00
|
|
|
|
|
|
|
// two 16-bit samples packed in 32-bits
|
2020-07-31 07:09:18 +00:00
|
|
|
HeapFIFOQueue<u32, AUDIO_FIFO_SIZE> m_audio_fifo;
|
2019-09-21 15:12:16 +00:00
|
|
|
};
|
2020-07-31 07:09:18 +00:00
|
|
|
|
|
|
|
extern CDROM g_cdrom;
|