params: settings: fftSize, minDecibels, maxDecibels, smoothingTimeConstant
| 20 | // settings: fftSize, minDecibels, maxDecibels, smoothingTimeConstant |
| 21 | // |
| 22 | class AnalyserNode : public AudioBasicInspectorNode |
| 23 | { |
| 24 | void shared_construction(int fftSize); |
| 25 | |
| 26 | virtual double tailTime(ContextRenderLock & r) const override { return 0; } |
| 27 | virtual double latencyTime(ContextRenderLock & r) const override { return 0; } |
| 28 | |
| 29 | struct Detail; |
| 30 | Detail * _detail = nullptr; |
| 31 | |
| 32 | public: |
| 33 | AnalyserNode(AudioContext & ac); |
| 34 | AnalyserNode(AudioContext & ac, int fftSize); |
| 35 | virtual ~AnalyserNode(); |
| 36 | |
| 37 | static const char* static_name() { return "Analyser"; } |
| 38 | virtual const char* name() const override { return static_name(); } |
| 39 | static AudioNodeDescriptor * desc(); |
| 40 | |
| 41 | virtual void process(ContextRenderLock &, int bufferSize) override; |
| 42 | virtual void reset(ContextRenderLock &) override; |
| 43 | |
| 44 | void setFftSize(ContextRenderLock &, int fftSize); |
| 45 | size_t fftSize() const; |
| 46 | |
| 47 | // a value large enough to hold all the data return from get*FrequencyData |
| 48 | size_t frequencyBinCount() const; |
| 49 | |
| 50 | void setMinDecibels(double k); |
| 51 | double minDecibels() const; |
| 52 | |
| 53 | void setMaxDecibels(double k); |
| 54 | double maxDecibels() const; |
| 55 | |
| 56 | void setSmoothingTimeConstant(double k); |
| 57 | double smoothingTimeConstant() const; |
| 58 | |
| 59 | // frequency bins, reported in db |
| 60 | void getFloatFrequencyData(std::vector<float> & array); |
| 61 | |
| 62 | // frequency bins, reported as a linear mapping of minDecibels to maxDecibles onto 0-255. |
| 63 | // if resample is true, then the computed values will be linearly resampled |
| 64 | void getByteFrequencyData(std::vector<uint8_t> & array, bool resample = false); |
| 65 | void getFloatTimeDomainData(std::vector<float> & array); |
| 66 | void getByteTimeDomainData(std::vector<uint8_t> & array); |
| 67 | }; |
| 68 | |
| 69 | } // namespace lab |
| 70 |
nothing calls this directly
no outgoing calls
no test coverage detected