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

Function makeSineAudioSample

tests/fl/audio/audio_context.hpp:16–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14namespace {
15
16static audio::Sample makeSineAudioSample(float freq, fl::u32 timestamp) {
17 fl::vector<fl::i16> data;
18 data.reserve(512);
19 for (int i = 0; i < 512; ++i) {
20 float phase = 2.0f * FL_M_PI * freq * i / 44100.0f;
21 data.push_back(static_cast<fl::i16>(16000.0f * fl::sinf(phase)));
22 }
23 return audio::Sample(data, timestamp);
24}
25
26} // anonymous namespace
27

Callers 1

audio_context.hppFile · 0.85

Calls 4

sinfFunction · 0.85
SampleClass · 0.50
reserveMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected