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

Function DCFilter

source/Speaker.cpp:168–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168inline short DCFilter(short sample_in)
169{
170 if (g_uDCFilterState == 0) // no sound for a while, stay 0
171 return 0;
172
173 if (g_uDCFilterState >= 32768) // full gain after recent sound
174 {
175 g_uDCFilterState--;
176 return sample_in;
177 }
178
179 return (((int)sample_in) * (g_uDCFilterState--)) / 32768; // scale & divide by 32768 (NB. Don't ">>15" as undefined behaviour)
180}
181
182//=============================================================================
183

Callers 1

QueueOneFrameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected