MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / rmsLevel

Function rmsLevel

apps/tools/Tools/commands/VonCommand.cpp:55–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53};
54
55static float rmsLevel(const int16_t* pcm, int n)
56{
57 if (n <= 0)
58 return 0.0f;
59 double sum = 0;
60 for (int i = 0; i < n; ++i)
61 sum += static_cast<double>(pcm[i]) * pcm[i];
62 return static_cast<float>(std::sqrt(sum / n) / 32768.0);
63}
64
65static void drawMeter(SDL_Renderer* r, int x, int y, int w, int h, float level, uint8_t cr, uint8_t cg, uint8_t cb)
66{

Callers 1

ExecuteTestFunction · 0.85

Calls 1

sqrtFunction · 0.85

Tested by

no test coverage detected