| 315 | static 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 | { |
no test coverage detected