FastLED 3.9.15
Loading...
Searching...
No Matches
fft_impl.h
Go to the documentation of this file.
1#pragma once
2
3#include "fl/stl/span.h"
4#include "fl/stl/string.h"
5#include "fl/stl/unique_ptr.h"
6#include "fl/stl/noexcept.h"
7
8namespace fl {
9namespace audio {
10
11class Sample; // Forward declare in fl::audio (correct namespace)
12
13namespace fft {
14
15class Context;
16struct Args;
17
18// Example:
19// Impl fft(512, 16);
20// auto sample = SINE WAVE OF 512 SAMPLES
21// fft.run(buffer, &out);
22// FL_WARN("Impl output: " << out); // 16 bands of output.
23class Impl {
24 public:
25 // Result indicating success or failure of the Impl run (in which case
26 // there will be an error message).
27 struct Result {
28 Result(bool ok, const string &error) : ok(ok), error(error) {}
29 bool ok = false;
31 };
32 // Default values for the Impl.
33 Impl(const Args &args);
35
36 fl::size sampleSize() const;
37 // Note that the sample sizes MUST match the samples size passed into the
38 // constructor.
39 Result run(const Sample &sample, Bins *out);
40 Result run(span<const i16> sample, Bins *out);
41 // Info on what the frequency the bins represent
42 fl::string info() const;
43
44 // Disable copy and move constructors and assignment operators
45 Impl(const Impl &) FL_NOEXCEPT = delete;
46 Impl &operator=(const Impl &) FL_NOEXCEPT = delete;
47 Impl(Impl &&) FL_NOEXCEPT = delete;
48 Impl &operator=(Impl &&) FL_NOEXCEPT = delete;
49
50 private:
52};
53
54} // namespace fft
55} // namespace audio
56}; // namespace fl
Result run(const Sample &sample, Bins *out)
Impl(const Args &args)
fl::unique_ptr< Context > mContext
Definition fft_impl.h:51
fl::size sampleSize() const
fl::string info() const
CRGB sample(const CRGB *grid, const XYMap &xyMap, float x, float y, SampleMode mode)
Sample a pixel from a 2D CRGB grid at floating-point coordinates.
Definition sample.cpp.hpp:9
Base definition for an LED controller.
Definition crgb.hpp:179
corkscrew_args args
Definition old.h:149
#define FL_NOEXCEPT
Result(bool ok, const string &error)
Definition fft_impl.h:28