MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / UpdateRemainderBuffer

Function UpdateRemainderBuffer

source/Speaker.cpp:327–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325}
326
327static 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
354static void UpdateSpkr()
355{

Callers 1

UpdateSpkrFunction · 0.85

Calls 1

QueueOneFrameFunction · 0.85

Tested by

no test coverage detected