MCPcopy Create free account
hub / github.com/FastLED/FastLED / generateSine

Function generateSine

tests/fl/audio/fft/fft.cpp:227–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225namespace { // fft_tests
226
227fl::vector<fl::i16> generateSine(float freq, int count = 512, float sampleRate = 44100.0f, float amplitude = 16000.0f) {
228 fl::vector<fl::i16> samples;
229 samples.reserve(count);
230 for (int i = 0; i < count; ++i) {
231 float phase = 2.0f * FL_M_PI * freq * i / sampleRate;
232 samples.push_back(static_cast<fl::i16>(amplitude * fl::sinf(phase)));
233 }
234 return samples;
235}
236
237} // anonymous namespace
238

Callers 2

FL_TEST_FILEFunction · 0.70
FL_TEST_FILEFunction · 0.50

Calls 3

sinfFunction · 0.85
reserveMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected