MCPcopy Create free account
hub / github.com/ValveSoftware/steam-audio / ITEST

Function ITEST

core/src/itest/itest_windowfunction.cpp:23–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21#include "itest.h"
22
23ITEST(windowfunction)
24{
25 const auto frameSize = 1024;
26 const auto overlapSize = frameSize / 4;
27 const auto tukeySize = frameSize + overlapSize;
28
29 float rectangular[frameSize];
30 float bartlett[frameSize];
31 float hann[frameSize];
32 float hamming[frameSize];
33 float blackman[frameSize];
34 float blackmanHarris[frameSize];
35 float tukey[tukeySize];
36
37 WindowFunction::rectangular(frameSize, rectangular);
38 WindowFunction::bartlett(frameSize, bartlett);
39 WindowFunction::hann(frameSize, hann);
40 WindowFunction::hamming(frameSize, hamming);
41 WindowFunction::blackman(frameSize, blackman);
42 WindowFunction::blackmanHarris(frameSize, blackmanHarris);
43 WindowFunction::tukey(frameSize, overlapSize, tukey);
44
45 auto gui = [&]()
46 {
47 if (ImGui::Begin("Window Functions"))
48 {
49 const char* types[] = {
50 "Rectangular",
51 "Bartlett",
52 "Hann",
53 "Hamming",
54 "Blackman",
55 "Blackman-Harris",
56 "Tukey"
57 };
58
59 const float* data[] = {
60 rectangular,
61 bartlett,
62 hann,
63 hamming,
64 blackman,
65 blackmanHarris,
66 tukey
67 };
68
69 static auto currentType = -1;
70 ImGui::Combo("Type", &currentType, types, 7);
71
72 if (0 <= currentType && currentType < 7)
73 {
74 auto size = (currentType == 6) ? tukeySize : frameSize;
75 ImGui::PlotLines(types[currentType], data[currentType], size, 0, nullptr, 0.0f, 1.0f, ImVec2(512, 512));
76 }
77 }
78
79 ImGui::End();
80 };

Callers

nothing calls this directly

Calls 1

runMethod · 0.80

Tested by

no test coverage detected