- reformat to JUCE-Guidelines
- added Matrix => half working ;)
This commit is contained in:
parent
26a2935e1c
commit
ac22ea5e75
58 changed files with 1220 additions and 799 deletions
|
|
@ -4,32 +4,33 @@
|
|||
|
||||
#include "FFT.h"
|
||||
|
||||
void FFT::pushNextSampleIntoFifo(float sample) noexcept {
|
||||
void FFT::pushNextSampleIntoFifo (float sample) noexcept
|
||||
{
|
||||
{
|
||||
if (fifoIndex == fftSize) // [11]
|
||||
{
|
||||
if (!nextFFTBlockReady) // [12]
|
||||
{
|
||||
zeromem(fftData, sizeof(fftData));
|
||||
memcpy(fftData, fifo, sizeof(fifo));
|
||||
zeromem (fftData, sizeof (fftData));
|
||||
memcpy (fftData, fifo, sizeof (fifo));
|
||||
nextFFTBlockReady = true;
|
||||
}
|
||||
fifoIndex = 0;
|
||||
}
|
||||
|
||||
fifo[fifoIndex++] = sample; // [12]
|
||||
}
|
||||
}
|
||||
|
||||
void FFT::drawNextFrameOfSpectrum() {
|
||||
window.multiplyWithWindowingTable(fftData, fftSize); // [1]
|
||||
fft.performFrequencyOnlyForwardTransform(fftData); // [2]
|
||||
void FFT::drawNextFrameOfSpectrum ()
|
||||
{
|
||||
window.multiplyWithWindowingTable (fftData, fftSize); // [1]
|
||||
fft.performFrequencyOnlyForwardTransform (fftData); // [2]
|
||||
|
||||
auto mindB = -80.0f;
|
||||
auto maxdB = 0.0f;
|
||||
for (int i = 0; i < scopeSize; ++i)
|
||||
{
|
||||
auto level = jmap(Decibels::gainToDecibels(fftData[i], mindB), mindB, maxdB, -1.0f, 1.0f);
|
||||
auto level = jmap (Decibels::gainToDecibels (fftData[i], mindB), mindB, maxdB, -1.0f, 1.0f);
|
||||
scopeData[i] = level;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,28 +7,27 @@
|
|||
|
||||
#include "JuceHeader.h"
|
||||
|
||||
class FFT {
|
||||
class FFT
|
||||
{
|
||||
private:
|
||||
public:
|
||||
FFT() = default;
|
||||
~FFT() = default;
|
||||
FFT () = default;
|
||||
~FFT () = default;
|
||||
void pushNextSampleIntoFifo (float sample) noexcept;
|
||||
enum
|
||||
{
|
||||
fftOrder = 11, // [1]
|
||||
fftSize = 1 << fftOrder, // [2]
|
||||
fftOrder = 11, // [1]
|
||||
fftSize = 1 << fftOrder, // [2]
|
||||
scopeSize = 512 // [3]
|
||||
};
|
||||
void drawNextFrameOfSpectrum();
|
||||
void drawNextFrameOfSpectrum ();
|
||||
bool nextFFTBlockReady = false;
|
||||
float scopeData [scopeSize]{};
|
||||
float fftData [2 * fftSize]{};
|
||||
float scopeData[scopeSize]{};
|
||||
float fftData[2 * fftSize]{};
|
||||
protected:
|
||||
dsp::FFT fft{fftOrder};
|
||||
dsp::WindowingFunction<float> window{fftSize, dsp::WindowingFunction<float>::hann};
|
||||
float fifo [fftSize]{};
|
||||
float fifo[fftSize]{};
|
||||
int fifoIndex = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif //VENO_FFT_H
|
||||
|
|
|
|||
|
|
@ -4,13 +4,15 @@
|
|||
|
||||
#include "Logger.h"
|
||||
|
||||
void VeNo::Logger::debugMessage(const std::string &message) {
|
||||
void VeNo::Logger::debugMessage (const std::string& message)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cout << "\u001b[38;5;172m[DEBUG]\u001b[0m\t" << message << "\n";
|
||||
#endif
|
||||
}
|
||||
|
||||
void VeNo::Logger::infoDebugMessage(const std::string &message) {
|
||||
void VeNo::Logger::infoDebugMessage (const std::string& message)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cout << "\u001b[38;5;111m[INFO]\u001b[0m\t" << message << "\n";
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
#ifndef VENO_LOGGER_H
|
||||
#define VENO_LOGGER_H
|
||||
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace VeNo {
|
||||
class Logger {
|
||||
namespace VeNo
|
||||
{
|
||||
class Logger
|
||||
{
|
||||
public:
|
||||
static void debugMessage(const std::string &message);
|
||||
static void infoDebugMessage(const std::string &message);
|
||||
static void debugMessage (const std::string& message);
|
||||
static void infoDebugMessage (const std::string& message);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //VENO_LOGGER_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue