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

Function TimeUpdate

pcsx2/SPU2/spu2sys.cpp:317–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

315static constexpr int SanityInterval = 4800;
316
317__forceinline void TimeUpdate(u32 cClocks)
318{
319 u32 dClocks = cClocks - lClocks;
320
321 // Sanity Checks:
322 // It's not totally uncommon for the IOP's clock to jump backwards a cycle or two, and in
323 // such cases we just want to ignore the TimeUpdate call.
324
325 if (dClocks > (u32)-15)
326 return;
327
328 // But if for some reason our clock value seems way off base (typically due to bad dma
329 // timings from PCSX2), just mix out a little bit, skip the rest, and hope the ship
330 // "rights" itself later on.
331
332 if (dClocks > static_cast<u32>(TickInterval * SanityInterval))
333 {
334 if (SPU2::MsgToConsole())
335 SPU2::ConLog(" * SPU2 > TimeUpdate Sanity Check (Tick Delta: %d) (PS2 Ticks: %d)\n", dClocks / TickInterval, cClocks / TickInterval);
336 dClocks = TickInterval * SanityInterval;
337 lClocks = cClocks - dClocks;
338 }
339
340 //Update Mixing Progress
341 while (dClocks >= TickInterval)
342 {
343 dClocks -= TickInterval;
344 lClocks += TickInterval;
345 Cycles++;
346
347 for(int c = 0; c < 2; c++)
348 {
349 if (Cores[c].KeyOff)
350 {
351 StopVoices(c, Cores[c].KeyOff);
352 Cores[c].KeyOff = 0;
353 }
354
355 if (Cores[c].KeyOn)
356 {
357 StartVoices(c, Cores[c].KeyOn);
358 Cores[c].KeyOn = 0;
359 }
360 }
361
362 spu2Mix();
363 }
364
365 CheckDMAProgress(0);
366 CheckDMAProgress(1);
367}
368
369__forceinline void UpdateSpdifMode()
370{

Callers 10

SPU2readDMA4MemFunction · 0.85
SPU2writeDMA4MemFunction · 0.85
SPU2readDMA7MemFunction · 0.85
SPU2writeDMA7MemFunction · 0.85
SPU2asyncFunction · 0.85
SPU2readFunction · 0.85
SPU2writeFunction · 0.85
StartADMAWriteMethod · 0.85
PlainDMAWriteMethod · 0.85
DoDMAreadMethod · 0.85

Calls 6

MsgToConsoleFunction · 0.85
ConLogFunction · 0.85
StopVoicesFunction · 0.85
StartVoicesFunction · 0.85
spu2MixFunction · 0.85
CheckDMAProgressFunction · 0.85

Tested by

no test coverage detected