| 352 | } |
| 353 | |
| 354 | static void UpdateSpkr() |
| 355 | { |
| 356 | if(!g_bFullSpeed || SoundCore_GetTimerState()) |
| 357 | { |
| 358 | ULONG nCycleDiff = (ULONG) (g_nCumulativeCycles - g_nSpkrLastCycle); |
| 359 | |
| 360 | UpdateRemainderBuffer(&nCycleDiff); |
| 361 | |
| 362 | ULONG nNumSamples = (ULONG) ((double)nCycleDiff / g_fClksPerSpkrSample); |
| 363 | |
| 364 | ULONG nCyclesRemaining = (ULONG) ((double)nCycleDiff - (double)nNumSamples * g_fClksPerSpkrSample); |
| 365 | |
| 366 | while ((nNumSamples--) && (g_nBufferIdx < SPKR_SAMPLE_RATE - 1)) |
| 367 | { |
| 368 | QueueOneFrame(g_pSpeakerBuffer, g_nBufferIdx, (short)g_nSpeakerData); |
| 369 | } |
| 370 | |
| 371 | ReinitRemainderBuffer(nCyclesRemaining); // Partially fill 1Mhz sample buffer |
| 372 | } |
| 373 | |
| 374 | g_nSpkrLastCycle = g_nCumulativeCycles; |
| 375 | } |
| 376 | |
| 377 | //============================================================================= |
| 378 |
no test coverage detected