| 325 | } |
| 326 | |
| 327 | static void UpdateRemainderBuffer(ULONG* pnCycleDiff) |
| 328 | { |
| 329 | if(g_nRemainderBufferIdx) |
| 330 | { |
| 331 | while((g_nRemainderBufferIdx < g_nRemainderBufferSize) && *pnCycleDiff) |
| 332 | { |
| 333 | g_pRemainderBuffer[g_nRemainderBufferIdx] = g_nSpeakerData; |
| 334 | g_nRemainderBufferIdx++; |
| 335 | (*pnCycleDiff)--; |
| 336 | } |
| 337 | |
| 338 | if(g_nRemainderBufferIdx == g_nRemainderBufferSize) |
| 339 | { |
| 340 | g_nRemainderBufferIdx = 0; |
| 341 | signed long nSampleMean = 0; |
| 342 | for(UINT i=0; i<g_nRemainderBufferSize; i++) |
| 343 | nSampleMean += (signed long) g_pRemainderBuffer[i]; |
| 344 | nSampleMean /= (signed long) g_nRemainderBufferSize; |
| 345 | |
| 346 | if (g_nBufferIdx < SPKR_SAMPLE_RATE - 1) |
| 347 | { |
| 348 | QueueOneFrame(g_pSpeakerBuffer, g_nBufferIdx, (short)nSampleMean); |
| 349 | } |
| 350 | } |
| 351 | } |
| 352 | } |
| 353 | |
| 354 | static void UpdateSpkr() |
| 355 | { |
no test coverage detected