MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / ReadInput_HiFi

Method ReadInput_HiFi

pcsx2/SPU2/ReadInput.cpp:20–85  ·  view source on GitHub ↗

Core 1 Input is "CDDA mode" - Source audio data is 32 bits. PS2 note: Very! few PS2 games use this mode. Some PSX games used it, however no known* PS2 game does since it was likely only available if the game was recorded to CD media (ie, not available in DVD mode, which almost all PS2 games use). Plus PS2 games generally prefer to use ADPCM streaming audio since they need as much storage space

Source from the content-addressed store, hash-verified

18// possible for FMVs and high-def textures.
19//
20StereoOut32 V_Core::ReadInput_HiFi()
21{
22 if (SPU2::IsRunningPSXMode() && SPU2::MsgToConsole())
23 SPU2::ConLog("ReadInput_HiFi!!!!!\n");
24
25 const u16 ReadIndex = (OutPos * 2) & 0x1FF;
26
27 StereoOut32 retval(
28 (s32&)(*GetMemPtr(0x2000 + (Index << 10) + ReadIndex)),
29 (s32&)(*GetMemPtr(0x2200 + (Index << 10) + ReadIndex)));
30
31 if (Index == 1)
32 {
33 retval.Left >>= 16;
34 retval.Right >>= 16;
35 }
36
37 // Simulate MADR increase, GTA VC tracks the MADR address for calculating a certain point in the buffer
38 if (InputDataTransferred)
39 {
40 u32 amount = std::min(InputDataTransferred, (u32)0x180);
41
42 InputDataTransferred -= amount;
43 MADR += amount;
44 // Because some games watch the MADR to see when it reaches the end we need to end the DMA here
45 // Tom & Jerry War of the Whiskers is one such game, the music will skip
46 if (!InputDataTransferred && !InputDataLeft)
47 {
48 if (Index == 0)
49 spu2DMA4Irq();
50 else
51 spu2DMA7Irq();
52 }
53 }
54
55 if (ReadIndex == 0x100 || ReadIndex == 0x0 || ReadIndex == 0x80 || ReadIndex == 0x180)
56 {
57 if (ReadIndex == 0x100)
58 InputPosWrite = 0;
59 else if (ReadIndex == 0)
60 InputPosWrite = 0x100;
61
62 if (InputDataLeft >= 0x100)
63 {
64 AutoDMAReadBuffer(0);
65 AdmaInProgress = 1;
66 if (InputDataLeft < 0x100)
67 {
68 if (IsDevBuild)
69 {
70 SPU2::FileLog("[%10d] AutoDMA%c block end.\n", Cycles, GetDmaIndexChar());
71 if (InputDataLeft > 0)
72 {
73 if (SPU2::MsgAutoDMA())
74 SPU2::ConLog("WARNING: adma buffer didn't finish with a whole block!!\n");
75 }
76 }
77

Callers 1

spu2MixFunction · 0.80

Calls 8

MsgToConsoleFunction · 0.85
ConLogFunction · 0.85
GetMemPtrFunction · 0.85
spu2DMA4IrqFunction · 0.85
spu2DMA7IrqFunction · 0.85
FileLogFunction · 0.85
MsgAutoDMAFunction · 0.85
minFunction · 0.50

Tested by

no test coverage detected