commit 044b7b2b785a1fe8f74034b0d5e2fc4b16fb0226
parent 5dd63fa4701944a700d3ebdf6452ad22e2c45ab9
Author: Matt Demanett <matt@demanett.net>
Date: Thu, 16 Apr 2020 22:56:51 -0400
Fix indenting.
Diffstat:
8 files changed, 608 insertions(+), 608 deletions(-)
diff --git a/benchmarks/analyzer_benchmark.cpp b/benchmarks/analyzer_benchmark.cpp
@@ -6,87 +6,87 @@
using namespace bogaudio::dsp;
static void BM_HanningWindowInit(benchmark::State& state) {
- for (auto _ : state) {
- delete new HanningWindow(1024);
- }
+ for (auto _ : state) {
+ delete new HanningWindow(1024);
+ }
}
BENCHMARK(BM_HanningWindowInit);
static void BM_HanningWindowApply(benchmark::State& state) {
- const int n = 1024;
- HanningWindow w(n);
- float in[n];
- std::fill_n(in, n, 1.1);
- float out[n] {};
- for (auto _ : state) {
- w.apply(in, out);
- in[0] = out[0]; // prevents the call from being optimized away?
- }
+ const int n = 1024;
+ HanningWindow w(n);
+ float in[n];
+ std::fill_n(in, n, 1.1);
+ float out[n] {};
+ for (auto _ : state) {
+ w.apply(in, out);
+ in[0] = out[0]; // prevents the call from being optimized away?
+ }
}
BENCHMARK(BM_HanningWindowApply);
static void BM_RuntimeFFT1024(benchmark::State& state) {
- const int n = 1024;
- ffft::FFTReal<float> fft(n);
- float in[n];
- std::fill_n(in, n, 1.1);
- float out[n] {};
- for (auto _ : state) {
- fft.do_fft(out, in);
- }
+ const int n = 1024;
+ ffft::FFTReal<float> fft(n);
+ float in[n];
+ std::fill_n(in, n, 1.1);
+ float out[n] {};
+ for (auto _ : state) {
+ fft.do_fft(out, in);
+ }
}
BENCHMARK(BM_RuntimeFFT1024);
static void BM_CompileTimeFFT1024(benchmark::State& state) {
- FFT1024 fft;
- const int n = 1024;
- float in[n];
- std::fill_n(in, n, 1.1);
- float out[n] {};
- for (auto _ : state) {
- fft.do_fft(out, in);
- }
+ FFT1024 fft;
+ const int n = 1024;
+ float in[n];
+ std::fill_n(in, n, 1.1);
+ float out[n] {};
+ for (auto _ : state) {
+ fft.do_fft(out, in);
+ }
}
BENCHMARK(BM_CompileTimeFFT1024);
static void BM_RuntimeFFT4096(benchmark::State& state) {
- const int n = 4096;
- ffft::FFTReal<float> fft(n);
- float in[n];
- std::fill_n(in, n, 1.1);
- float out[n] {};
- for (auto _ : state) {
- fft.do_fft(out, in);
- }
+ const int n = 4096;
+ ffft::FFTReal<float> fft(n);
+ float in[n];
+ std::fill_n(in, n, 1.1);
+ float out[n] {};
+ for (auto _ : state) {
+ fft.do_fft(out, in);
+ }
}
BENCHMARK(BM_RuntimeFFT4096);
static void BM_CompileTimeFFT4096(benchmark::State& state) {
- FFT4096 fft;
- const int n = 4096;
- float in[n];
- std::fill_n(in, n, 1.1);
- float out[n] {};
- for (auto _ : state) {
- fft.do_fft(out, in);
- }
+ FFT4096 fft;
+ const int n = 4096;
+ float in[n];
+ std::fill_n(in, n, 1.1);
+ float out[n] {};
+ for (auto _ : state) {
+ fft.do_fft(out, in);
+ }
}
BENCHMARK(BM_CompileTimeFFT4096);
static void BM_SpectrumAnalyzerStep(benchmark::State& state) {
- SpectrumAnalyzer sa(
- SpectrumAnalyzer::SIZE_1024,
- SpectrumAnalyzer::OVERLAP_1,
- SpectrumAnalyzer::WINDOW_HANNING,
- 44100.0
- );
- float in[8] = { 0.0, 0.7, 1.0, 0.7, 0.0, -0.7, -1.0, -0.7 };
- int i = 0;
- for (auto _ : state) {
- sa.step(in[i]);
- ++i;
- i %= 8;
- }
+ SpectrumAnalyzer sa(
+ SpectrumAnalyzer::SIZE_1024,
+ SpectrumAnalyzer::OVERLAP_1,
+ SpectrumAnalyzer::WINDOW_HANNING,
+ 44100.0
+ );
+ float in[8] = { 0.0, 0.7, 1.0, 0.7, 0.0, -0.7, -1.0, -0.7 };
+ int i = 0;
+ for (auto _ : state) {
+ sa.step(in[i]);
+ ++i;
+ i %= 8;
+ }
}
BENCHMARK(BM_SpectrumAnalyzerStep);
@@ -109,21 +109,21 @@ BENCHMARK(BM_SpectrumAnalyzerStep);
// BENCHMARK(BM_SpectrumAnalyzerProcess);
static void BM_SpectrumAnalyzerGetMagnitudes(benchmark::State& state) {
- SpectrumAnalyzer sa(
- SpectrumAnalyzer::SIZE_1024,
- SpectrumAnalyzer::OVERLAP_1,
- SpectrumAnalyzer::WINDOW_HANNING,
- 44100.0
- );
- const int nBins = 256;
- float bins[nBins];
- float in[8] = { 0.0, 0.7, 1.0, 0.7, 0.0, -0.7, -1.0, -0.7 };
- for (int i = 0; i < 1024; ++i) {
- sa.step(in[i % 8]);
- }
+ SpectrumAnalyzer sa(
+ SpectrumAnalyzer::SIZE_1024,
+ SpectrumAnalyzer::OVERLAP_1,
+ SpectrumAnalyzer::WINDOW_HANNING,
+ 44100.0
+ );
+ const int nBins = 256;
+ float bins[nBins];
+ float in[8] = { 0.0, 0.7, 1.0, 0.7, 0.0, -0.7, -1.0, -0.7 };
+ for (int i = 0; i < 1024; ++i) {
+ sa.step(in[i % 8]);
+ }
- for (auto _ : state) {
- sa.getMagnitudes(bins, nBins);
- }
+ for (auto _ : state) {
+ sa.getMagnitudes(bins, nBins);
+ }
}
BENCHMARK(BM_SpectrumAnalyzerGetMagnitudes);
diff --git a/benchmarks/buffer_benchmark.cpp b/benchmarks/buffer_benchmark.cpp
@@ -6,43 +6,43 @@
using namespace bogaudio::dsp;
struct BMOverlappingBuffer : OverlappingBuffer<float> {
- BMOverlappingBuffer(int size, int o) : OverlappingBuffer(size, o) {}
- void processBuffer(float* samples) override {}
+ BMOverlappingBuffer(int size, int o) : OverlappingBuffer(size, o) {}
+ void processBuffer(float* samples) override {}
};
static void BM_OverlappingBuffer(benchmark::State& state) {
- BMOverlappingBuffer b(1024, 2);
- int i = 0;
- for (auto _ : state) {
- b.step(i++);
- }
+ BMOverlappingBuffer b(1024, 2);
+ int i = 0;
+ for (auto _ : state) {
+ b.step(i++);
+ }
}
BENCHMARK(BM_OverlappingBuffer);
static void _averagingBuffer(benchmark::State& state, int n, int m) {
- AveragingBuffer<float> b(n, m);
- for (int i = 0; i < m; ++i) {
- float* frame = b.getInputFrame();
- std::fill_n(frame, n, M_PI);
- b.commitInputFrame();
- }
- float pi = 0.0;
- for (auto _ : state) {
- b.getInputFrame();
- b.commitInputFrame();
- pi = b.getAverages()[0];
- }
- const float e = 0.00001;
- assert(pi > M_PI - e && pi < M_PI + e);
+ AveragingBuffer<float> b(n, m);
+ for (int i = 0; i < m; ++i) {
+ float* frame = b.getInputFrame();
+ std::fill_n(frame, n, M_PI);
+ b.commitInputFrame();
+ }
+ float pi = 0.0;
+ for (auto _ : state) {
+ b.getInputFrame();
+ b.commitInputFrame();
+ pi = b.getAverages()[0];
+ }
+ const float e = 0.00001;
+ assert(pi > M_PI - e && pi < M_PI + e);
}
static void BM_AveragingBufferSmallN(benchmark::State& state) {
- _averagingBuffer(state, 1024, 3);
+ _averagingBuffer(state, 1024, 3);
}
BENCHMARK(BM_AveragingBufferSmallN);
static void BM_AveragingBufferLargeN(benchmark::State& state) {
- _averagingBuffer(state, 1024, 100);
+ _averagingBuffer(state, 1024, 100);
}
BENCHMARK(BM_AveragingBufferLargeN);
diff --git a/benchmarks/filter_benchmark.cpp b/benchmarks/filter_benchmark.cpp
@@ -8,30 +8,30 @@
using namespace bogaudio::dsp;
static void BM_LPFDecimator(benchmark::State& state) {
- WhiteNoiseGenerator r;
- const int n = 8;
- float buf[n];
- for (int i = 0; i < n; ++i) {
- buf[i] = r.next();
- }
- LPFDecimator d(44100.0, n);
- for (auto _ : state) {
- benchmark::DoNotOptimize(d.next(buf));
- }
+ WhiteNoiseGenerator r;
+ const int n = 8;
+ float buf[n];
+ for (int i = 0; i < n; ++i) {
+ buf[i] = r.next();
+ }
+ LPFDecimator d(44100.0, n);
+ for (auto _ : state) {
+ benchmark::DoNotOptimize(d.next(buf));
+ }
}
BENCHMARK(BM_LPFDecimator);
static void BM_CICDecimator(benchmark::State& state) {
- WhiteNoiseGenerator r;
- const int n = 8;
- float buf[n];
- for (int i = 0; i < n; ++i) {
- buf[i] = r.next();
- }
- CICDecimator d(4, 8);
- for (auto _ : state) {
- benchmark::DoNotOptimize(d.next(buf));
- }
+ WhiteNoiseGenerator r;
+ const int n = 8;
+ float buf[n];
+ for (int i = 0; i < n; ++i) {
+ buf[i] = r.next();
+ }
+ CICDecimator d(4, 8);
+ for (auto _ : state) {
+ benchmark::DoNotOptimize(d.next(buf));
+ }
}
BENCHMARK(BM_CICDecimator);
@@ -50,35 +50,35 @@ BENCHMARK(BM_CICDecimator);
// BENCHMARK(BM_RackDecimator);
static void BM_Biquad(benchmark::State& state) {
- WhiteNoiseGenerator r;
- const int n = 8;
- float buf[n];
- for (int i = 0; i < n; ++i) {
- buf[i] = r.next();
- }
+ WhiteNoiseGenerator r;
+ const int n = 8;
+ float buf[n];
+ for (int i = 0; i < n; ++i) {
+ buf[i] = r.next();
+ }
- BiquadFilter<double> f;
- f.setParams(0.012672, 0.025345, 0.012672, 1.102730, -1.974655, 0.922615);
- int i = 0;
- for (auto _ : state) {
- benchmark::DoNotOptimize(f.next(buf[i]));
- i = (i + 1) % n;
- }
+ BiquadFilter<double> f;
+ f.setParams(0.012672, 0.025345, 0.012672, 1.102730, -1.974655, 0.922615);
+ int i = 0;
+ for (auto _ : state) {
+ benchmark::DoNotOptimize(f.next(buf[i]));
+ i = (i + 1) % n;
+ }
}
BENCHMARK(BM_Biquad);
static void BM_AnalogFrequency(benchmark::State& state) {
- WhiteNoiseGenerator r;
- const int n = 128;
- float buf[n];
- for (int i = 0; i < n; ++i) {
- buf[i] = std::abs(r.next()) * 0.5f * M_PI;
- }
+ WhiteNoiseGenerator r;
+ const int n = 128;
+ float buf[n];
+ for (int i = 0; i < n; ++i) {
+ buf[i] = std::abs(r.next()) * 0.5f * M_PI;
+ }
- int i = 0;
- for (auto _ : state) {
- benchmark::DoNotOptimize(std::tan(buf[i]));
- i = (i + 1) % n;
- }
+ int i = 0;
+ for (auto _ : state) {
+ benchmark::DoNotOptimize(std::tan(buf[i]));
+ i = (i + 1) % n;
+ }
}
BENCHMARK(BM_AnalogFrequency);
diff --git a/benchmarks/noise_benchmark.cpp b/benchmarks/noise_benchmark.cpp
@@ -6,33 +6,33 @@
using namespace bogaudio::dsp;
static void BM_WhiteNoise(benchmark::State& state) {
- WhiteNoiseGenerator g;
- for (auto _ : state) {
- g.next();
- }
+ WhiteNoiseGenerator g;
+ for (auto _ : state) {
+ g.next();
+ }
}
BENCHMARK(BM_WhiteNoise);
static void BM_PinkNoise(benchmark::State& state) {
- PinkNoiseGenerator g;
- for (auto _ : state) {
- g.next();
- }
+ PinkNoiseGenerator g;
+ for (auto _ : state) {
+ g.next();
+ }
}
BENCHMARK(BM_PinkNoise);
static void BM_RedNoise(benchmark::State& state) {
- RedNoiseGenerator g;
- for (auto _ : state) {
- g.next();
- }
+ RedNoiseGenerator g;
+ for (auto _ : state) {
+ g.next();
+ }
}
BENCHMARK(BM_RedNoise);
static void BM_GaussianNoise(benchmark::State& state) {
- GaussianNoiseGenerator g;
- for (auto _ : state) {
- g.next();
- }
+ GaussianNoiseGenerator g;
+ for (auto _ : state) {
+ g.next();
+ }
}
BENCHMARK(BM_GaussianNoise);
diff --git a/benchmarks/oscillator_benchmark.cpp b/benchmarks/oscillator_benchmark.cpp
@@ -6,154 +6,154 @@
using namespace bogaudio::dsp;
static void BM_Phasor(benchmark::State& state) {
- Phasor p(44100.0, 440.0);
- for (auto _ : state) {
- p.next();
- }
+ Phasor p(44100.0, 440.0);
+ for (auto _ : state) {
+ p.next();
+ }
}
BENCHMARK(BM_Phasor);
static void BM_SineOscillator(benchmark::State& state) {
- SineOscillator o(44100.0, 440.0);
- for (auto _ : state) {
- o.next();
- }
+ SineOscillator o(44100.0, 440.0);
+ for (auto _ : state) {
+ o.next();
+ }
}
BENCHMARK(BM_SineOscillator);
static void BM_SineTableOscillator(benchmark::State& state) {
- SineTableOscillator o(44100.0, 440.0);
- for (auto _ : state) {
- o.next();
- }
+ SineTableOscillator o(44100.0, 440.0);
+ for (auto _ : state) {
+ o.next();
+ }
}
BENCHMARK(BM_SineTableOscillator);
static void BM_SineOscillatorFM(benchmark::State& state) {
- const float baseHz = 440.0;
- SineOscillator m(44100.0, baseHz);
- SineOscillator c(44100.0, baseHz);
- for (auto _ : state) {
- c.setFrequency(baseHz + m.next());
- c.next();
- }
+ const float baseHz = 440.0;
+ SineOscillator m(44100.0, baseHz);
+ SineOscillator c(44100.0, baseHz);
+ for (auto _ : state) {
+ c.setFrequency(baseHz + m.next());
+ c.next();
+ }
}
BENCHMARK(BM_SineOscillatorFM);
static void BM_SineTableOscillatorPM(benchmark::State& state) {
- SineTableOscillator m(44100.0, 440.0);
- SineTableOscillator c(44100.0, 440.0);
- for (auto _ : state) {
- c.advancePhase();
- c.nextFromPhasor(c, Phasor::radiansToPhase(m.next()));
- }
+ SineTableOscillator m(44100.0, 440.0);
+ SineTableOscillator c(44100.0, 440.0);
+ for (auto _ : state) {
+ c.advancePhase();
+ c.nextFromPhasor(c, Phasor::radiansToPhase(m.next()));
+ }
}
BENCHMARK(BM_SineTableOscillatorPM);
static void BM_SawOscillator(benchmark::State& state) {
- SawOscillator o(44100.0, 440.0);
- for (auto _ : state) {
- o.next();
- }
+ SawOscillator o(44100.0, 440.0);
+ for (auto _ : state) {
+ o.next();
+ }
}
BENCHMARK(BM_SawOscillator);
static void BM_SaturatingSawOscillator(benchmark::State& state) {
- SaturatingSawOscillator o(44100.0, 440.0);
- o.setSaturation(0.9);
- for (auto _ : state) {
- o.next();
- }
+ SaturatingSawOscillator o(44100.0, 440.0);
+ o.setSaturation(0.9);
+ for (auto _ : state) {
+ o.next();
+ }
}
BENCHMARK(BM_SaturatingSawOscillator);
static void BM_BandLimitedSawOscillator(benchmark::State& state) {
- BandLimitedSawOscillator o(44100.0, 440.0);
- o.setQuality(12);
- for (auto _ : state) {
- o.next();
- }
+ BandLimitedSawOscillator o(44100.0, 440.0);
+ o.setQuality(12);
+ for (auto _ : state) {
+ o.next();
+ }
}
BENCHMARK(BM_BandLimitedSawOscillator);
static void BM_SquareOscillator(benchmark::State& state) {
- SquareOscillator o(44100.0, 440.0);
- for (auto _ : state) {
- o.next();
- }
+ SquareOscillator o(44100.0, 440.0);
+ for (auto _ : state) {
+ o.next();
+ }
}
BENCHMARK(BM_SquareOscillator);
static void BM_BandLimitedSquareOscillator(benchmark::State& state) {
- BandLimitedSquareOscillator o(44100.0, 440.0);
- o.setQuality(12);
- for (auto _ : state) {
- o.next();
- }
+ BandLimitedSquareOscillator o(44100.0, 440.0);
+ o.setQuality(12);
+ for (auto _ : state) {
+ o.next();
+ }
}
BENCHMARK(BM_BandLimitedSquareOscillator);
static void BM_TriangleOscillator(benchmark::State& state) {
- TriangleOscillator o(44100.0, 440.0);
- for (auto _ : state) {
- o.next();
- }
+ TriangleOscillator o(44100.0, 440.0);
+ for (auto _ : state) {
+ o.next();
+ }
}
BENCHMARK(BM_TriangleOscillator);
static void BM_SampledTriangleOscillator(benchmark::State& state) {
- TriangleOscillator o(44100.0, 440.0);
- o.setSampleWidth(Phasor::maxSampleWidth / 2.0);
- for (auto _ : state) {
- o.next();
- }
+ TriangleOscillator o(44100.0, 440.0);
+ o.setSampleWidth(Phasor::maxSampleWidth / 2.0);
+ for (auto _ : state) {
+ o.next();
+ }
}
BENCHMARK(BM_SampledTriangleOscillator);
static void BM_SineBankOscillator100(benchmark::State& state) {
- SineBankOscillator o(44100.0, 100.0, 100);
- for (int i = 1, n = o.partialCount(); i <= n; ++i) {
- o.setPartial(i, i, 1.0 / (float)i);
- }
+ SineBankOscillator o(44100.0, 100.0, 100);
+ for (int i = 1, n = o.partialCount(); i <= n; ++i) {
+ o.setPartial(i, i, 1.0 / (float)i);
+ }
- for (auto _ : state) {
- o.next();
- }
+ for (auto _ : state) {
+ o.next();
+ }
}
BENCHMARK(BM_SineBankOscillator100);
static void BM_SineBankOscillator500(benchmark::State& state) {
- SineBankOscillator o(44100.0, 500.0, 100);
- for (int i = 1, n = o.partialCount(); i <= n; ++i) {
- o.setPartial(i, i, 1.0 / (float)i);
- }
+ SineBankOscillator o(44100.0, 500.0, 100);
+ for (int i = 1, n = o.partialCount(); i <= n; ++i) {
+ o.setPartial(i, i, 1.0 / (float)i);
+ }
- for (auto _ : state) {
- o.next();
- }
+ for (auto _ : state) {
+ o.next();
+ }
}
BENCHMARK(BM_SineBankOscillator500);
static void BM_SineBankOscillator5000(benchmark::State& state) {
- SineBankOscillator o(44100.0, 5000.0, 100);
- for (int i = 1, n = o.partialCount(); i <= n; ++i) {
- o.setPartial(i, i, 1.0 / (float)i);
- }
+ SineBankOscillator o(44100.0, 5000.0, 100);
+ for (int i = 1, n = o.partialCount(); i <= n; ++i) {
+ o.setPartial(i, i, 1.0 / (float)i);
+ }
- for (auto _ : state) {
- o.next();
- }
+ for (auto _ : state) {
+ o.next();
+ }
}
BENCHMARK(BM_SineBankOscillator5000);
static void BM_SineBankOscillator15000(benchmark::State& state) {
- SineBankOscillator o(44100.0, 15000.0, 100);
- for (int i = 1, n = o.partialCount(); i <= n; ++i) {
- o.setPartial(i, i, 1.0 / (float)i);
- }
-
- for (auto _ : state) {
- o.next();
- }
+ SineBankOscillator o(44100.0, 15000.0, 100);
+ for (int i = 1, n = o.partialCount(); i <= n; ++i) {
+ o.setPartial(i, i, 1.0 / (float)i);
+ }
+
+ for (auto _ : state) {
+ o.next();
+ }
}
BENCHMARK(BM_SineBankOscillator15000);
diff --git a/benchmarks/signal_benchmark.cpp b/benchmarks/signal_benchmark.cpp
@@ -10,231 +10,231 @@
using namespace bogaudio::dsp;
static void BM_DecibelsToAmplitude(benchmark::State& state) {
- std::vector<float> buf = { 10.0f, 6.0f, 3.0f, 0.0f, -3.0f, -6.0f, -10.0f, -30.0f, -60.0f };
- int i = 0;
- for (auto _ : state) {
- i = ++i % buf.size();
- benchmark::DoNotOptimize(decibelsToAmplitude(buf.at(i)));
- }
+ std::vector<float> buf = { 10.0f, 6.0f, 3.0f, 0.0f, -3.0f, -6.0f, -10.0f, -30.0f, -60.0f };
+ int i = 0;
+ for (auto _ : state) {
+ i = ++i % buf.size();
+ benchmark::DoNotOptimize(decibelsToAmplitude(buf.at(i)));
+ }
}
BENCHMARK(BM_DecibelsToAmplitude);
static void BM_AmplitudeToDecibels(benchmark::State& state) {
- std::vector<float> buf = { 0.0001f, 0.0001f, 0.001f, 0.01, 0.1f, 0.3f, 0.5f, 0.8f, 1.0f, 1.5f, 2.0f, 5.0f, 10.0f };
- int i = 0;
- for (auto _ : state) {
- i = ++i % buf.size();
- benchmark::DoNotOptimize(amplitudeToDecibels(buf.at(i)));
- }
+ std::vector<float> buf = { 0.0001f, 0.0001f, 0.001f, 0.01, 0.1f, 0.3f, 0.5f, 0.8f, 1.0f, 1.5f, 2.0f, 5.0f, 10.0f };
+ int i = 0;
+ for (auto _ : state) {
+ i = ++i % buf.size();
+ benchmark::DoNotOptimize(amplitudeToDecibels(buf.at(i)));
+ }
}
BENCHMARK(BM_AmplitudeToDecibels);
static void BM_Amplifier(benchmark::State& state) {
- WhiteNoiseGenerator r;
- const int n = 256;
- float samples[n];
- for (int i = 0; i < n; ++i) {
- samples[i] = r.next();
- }
- std::vector<float> decibels = { 10.0f, 6.0f, 3.0f, 0.0f, -3.0f, -6.0f, -10.0f, -30.0f, -60.0f };
-
- Amplifier a;
- int i = 0, j = 0;
- for (auto _ : state) {
- i = ++i % decibels.size();
- j = ++j % n;
- a.setLevel(decibels.at(i));
- benchmark::DoNotOptimize(a.next(samples[j]));
- }
+ WhiteNoiseGenerator r;
+ const int n = 256;
+ float samples[n];
+ for (int i = 0; i < n; ++i) {
+ samples[i] = r.next();
+ }
+ std::vector<float> decibels = { 10.0f, 6.0f, 3.0f, 0.0f, -3.0f, -6.0f, -10.0f, -30.0f, -60.0f };
+
+ Amplifier a;
+ int i = 0, j = 0;
+ for (auto _ : state) {
+ i = ++i % decibels.size();
+ j = ++j % n;
+ a.setLevel(decibels.at(i));
+ benchmark::DoNotOptimize(a.next(samples[j]));
+ }
}
BENCHMARK(BM_Amplifier);
static void BM_RMS_Short(benchmark::State& state) {
- SineOscillator o(500.0, 100.0);
- const int n = 256;
- float buf[n];
- for (int i = 0; i < n; ++i) {
- buf[i] = o.next() * 5.0f;
- }
- RootMeanSquare rms(44100.0, 0.05);
- int i = 0;
- for (auto _ : state) {
- i = ++i % n;
- benchmark::DoNotOptimize(rms.next(buf[i]));
- }
+ SineOscillator o(500.0, 100.0);
+ const int n = 256;
+ float buf[n];
+ for (int i = 0; i < n; ++i) {
+ buf[i] = o.next() * 5.0f;
+ }
+ RootMeanSquare rms(44100.0, 0.05);
+ int i = 0;
+ for (auto _ : state) {
+ i = ++i % n;
+ benchmark::DoNotOptimize(rms.next(buf[i]));
+ }
}
BENCHMARK(BM_RMS_Short);
static void BM_RMS_Long(benchmark::State& state) {
- SineOscillator o(500.0, 100.0);
- const int n = 256;
- float buf[n];
- for (int i = 0; i < n; ++i) {
- buf[i] = o.next() * 5.0f;
- }
- RootMeanSquare rms(44100.0, 1.0);
- int i = 0;
- for (auto _ : state) {
- i = ++i % n;
- benchmark::DoNotOptimize(rms.next(buf[i]));
- }
+ SineOscillator o(500.0, 100.0);
+ const int n = 256;
+ float buf[n];
+ for (int i = 0; i < n; ++i) {
+ buf[i] = o.next() * 5.0f;
+ }
+ RootMeanSquare rms(44100.0, 1.0);
+ int i = 0;
+ for (auto _ : state) {
+ i = ++i % n;
+ benchmark::DoNotOptimize(rms.next(buf[i]));
+ }
}
BENCHMARK(BM_RMS_Long);
static void BM_RMS_Modulating(benchmark::State& state) {
- SineOscillator o(500.0, 100.0);
- const int n = 256;
- float buf[n];
- for (int i = 0; i < n; ++i) {
- buf[i] = o.next() * 5.0f;
- }
+ SineOscillator o(500.0, 100.0);
+ const int n = 256;
+ float buf[n];
+ for (int i = 0; i < n; ++i) {
+ buf[i] = o.next() * 5.0f;
+ }
std::minstd_rand g;
std::uniform_real_distribution<float> r(0.0f, 1.0f);
- RootMeanSquare rms(44100.0, 1.0);
- int i = 0;
- for (auto _ : state) {
- i = ++i % n;
- if (i % 50 == 0) {
- rms.setSensitivity(r(g));
- }
- benchmark::DoNotOptimize(rms.next(buf[i]));
- }
+ RootMeanSquare rms(44100.0, 1.0);
+ int i = 0;
+ for (auto _ : state) {
+ i = ++i % n;
+ if (i % 50 == 0) {
+ rms.setSensitivity(r(g));
+ }
+ benchmark::DoNotOptimize(rms.next(buf[i]));
+ }
}
BENCHMARK(BM_RMS_Modulating);
static void BM_PucketteEnvelopeFollower(benchmark::State& state) {
- SineOscillator o(500.0, 100.0);
- const int n = 256;
- float buf[n];
- for (int i = 0; i < n; ++i) {
- buf[i] = o.next() * 5.0f;
- }
- PucketteEnvelopeFollower pef;
- int i = 0;
- for (auto _ : state) {
- i = ++i % n;
- benchmark::DoNotOptimize(pef.next(buf[i]));
- }
+ SineOscillator o(500.0, 100.0);
+ const int n = 256;
+ float buf[n];
+ for (int i = 0; i < n; ++i) {
+ buf[i] = o.next() * 5.0f;
+ }
+ PucketteEnvelopeFollower pef;
+ int i = 0;
+ for (auto _ : state) {
+ i = ++i % n;
+ benchmark::DoNotOptimize(pef.next(buf[i]));
+ }
}
BENCHMARK(BM_PucketteEnvelopeFollower);
static void BM_SlewLimiter(benchmark::State& state) {
- WhiteNoiseGenerator r;
- const int n = 256;
- float buf[n];
- for (int i = 0; i < n; ++i) {
- buf[i] = r.next();
- }
- SlewLimiter sl(44100.0, 1.0f);
- int i = 0;
- for (auto _ : state) {
- i = ++i % n;
- benchmark::DoNotOptimize(sl.next(buf[i]));
- }
+ WhiteNoiseGenerator r;
+ const int n = 256;
+ float buf[n];
+ for (int i = 0; i < n; ++i) {
+ buf[i] = r.next();
+ }
+ SlewLimiter sl(44100.0, 1.0f);
+ int i = 0;
+ for (auto _ : state) {
+ i = ++i % n;
+ benchmark::DoNotOptimize(sl.next(buf[i]));
+ }
}
BENCHMARK(BM_SlewLimiter);
static void BM_ShapedSlewLimiter(benchmark::State& state) {
- WhiteNoiseGenerator r;
- const int n = 256;
- float buf[n];
- for (int i = 0; i < n; ++i) {
- buf[i] = r.next();
- }
- ShapedSlewLimiter sl(44100.0, 1.0f, 0.5f);
- int i = 0;
- for (auto _ : state) {
- i = ++i % n;
- benchmark::DoNotOptimize(sl.next(buf[i]));
- }
+ WhiteNoiseGenerator r;
+ const int n = 256;
+ float buf[n];
+ for (int i = 0; i < n; ++i) {
+ buf[i] = r.next();
+ }
+ ShapedSlewLimiter sl(44100.0, 1.0f, 0.5f);
+ int i = 0;
+ for (auto _ : state) {
+ i = ++i % n;
+ benchmark::DoNotOptimize(sl.next(buf[i]));
+ }
}
BENCHMARK(BM_ShapedSlewLimiter);
static void BM_Panner(benchmark::State& state) {
- SineOscillator o(500.0, 100.0);
- const int n = 256;
- float buf[n];
- for (int i = 0; i < n; ++i) {
- buf[i] = o.next() * 5.0f;
- }
- Panner p;
- int i = 0;
- float l, r;
- for (auto _ : state) {
- i = ++i % n;
- p.next(buf[i], l, r);
- }
+ SineOscillator o(500.0, 100.0);
+ const int n = 256;
+ float buf[n];
+ for (int i = 0; i < n; ++i) {
+ buf[i] = o.next() * 5.0f;
+ }
+ Panner p;
+ int i = 0;
+ float l, r;
+ for (auto _ : state) {
+ i = ++i % n;
+ p.next(buf[i], l, r);
+ }
}
BENCHMARK(BM_Panner);
static void BM_Panner_Modulating(benchmark::State& state) {
- SineOscillator o(500.0, 100.0);
- const int n = 256;
- float buf[n];
- for (int i = 0; i < n; ++i) {
- buf[i] = o.next() * 5.0f;
- }
- std::minstd_rand g;
+ SineOscillator o(500.0, 100.0);
+ const int n = 256;
+ float buf[n];
+ for (int i = 0; i < n; ++i) {
+ buf[i] = o.next() * 5.0f;
+ }
+ std::minstd_rand g;
std::uniform_real_distribution<float> r(-1.0f, 1.0f);
- Panner p;
- int i = 0;
- float l, rr;
- for (auto _ : state) {
- i = ++i % n;
- p.setPan(r(g));
- p.next(buf[i], l, rr);
- }
+ Panner p;
+ int i = 0;
+ float l, rr;
+ for (auto _ : state) {
+ i = ++i % n;
+ p.setPan(r(g));
+ p.next(buf[i], l, rr);
+ }
}
BENCHMARK(BM_Panner_Modulating);
static void BM_DelayLine(benchmark::State& state) {
- SineOscillator o(500.0, 100.0);
- const int n = 256;
- float buf[n];
- for (int i = 0; i < n; ++i) {
- buf[i] = o.next() * 5.0f;
- }
- DelayLine dl(44100.0, 1000.0, 1.0);
- int i = 0;
- for (auto _ : state) {
- i = ++i % n;
- benchmark::DoNotOptimize(dl.next(buf[i]));
- }
+ SineOscillator o(500.0, 100.0);
+ const int n = 256;
+ float buf[n];
+ for (int i = 0; i < n; ++i) {
+ buf[i] = o.next() * 5.0f;
+ }
+ DelayLine dl(44100.0, 1000.0, 1.0);
+ int i = 0;
+ for (auto _ : state) {
+ i = ++i % n;
+ benchmark::DoNotOptimize(dl.next(buf[i]));
+ }
}
BENCHMARK(BM_DelayLine);
static void BM_Saturator(benchmark::State& state) {
- SineOscillator o(500.0, 100.0);
- const int n = 256;
- float buf[n];
- for (int i = 0; i < n; ++i) {
- buf[i] = o.next() * 20.0f;
- }
- Saturator s;
- int i = 0;
- for (auto _ : state) {
- i = ++i % n;
- benchmark::DoNotOptimize(s.next(buf[i]));
- }
+ SineOscillator o(500.0, 100.0);
+ const int n = 256;
+ float buf[n];
+ for (int i = 0; i < n; ++i) {
+ buf[i] = o.next() * 20.0f;
+ }
+ Saturator s;
+ int i = 0;
+ for (auto _ : state) {
+ i = ++i % n;
+ benchmark::DoNotOptimize(s.next(buf[i]));
+ }
}
BENCHMARK(BM_Saturator);
static void BM_CompressorSoftKnee(benchmark::State& state) {
- int i = 0;
- Compressor c;
- for (auto _ : state) {
- i = ++i % 15;
- benchmark::DoNotOptimize(c.compressionDb((float)(i + 5), 10.0f, 2.0f, true));
- }
+ int i = 0;
+ Compressor c;
+ for (auto _ : state) {
+ i = ++i % 15;
+ benchmark::DoNotOptimize(c.compressionDb((float)(i + 5), 10.0f, 2.0f, true));
+ }
}
BENCHMARK(BM_CompressorSoftKnee);
static void BM_NoiseGateSoftKnee(benchmark::State& state) {
- int i = 0;
- NoiseGate ng;
- for (auto _ : state) {
- i = ++i % 15;
- benchmark::DoNotOptimize(ng.compressionDb(0.0f - (float)(i * 3), 0.0f, 2.0f, true));
- }
+ int i = 0;
+ NoiseGate ng;
+ for (auto _ : state) {
+ i = ++i % 15;
+ benchmark::DoNotOptimize(ng.compressionDb(0.0f - (float)(i * 3), 0.0f, 2.0f, true));
+ }
}
BENCHMARK(BM_NoiseGateSoftKnee);
diff --git a/src/template_panels.cpp b/src/template_panels.cpp
@@ -2,60 +2,60 @@
#include "template_panels.hpp"
struct ThreeHPWidget : ModuleWidget {
- ThreeHPWidget(Module* module) {
- setModule(module);
- box.size = Vec(RACK_GRID_WIDTH * 3, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ThreeHP.svg")));
- addChild(panel);
- }
-
- addChild(createWidget<ScrewSilver>(Vec(0, 0)));
- addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
- }
+ ThreeHPWidget(Module* module) {
+ setModule(module);
+ box.size = Vec(RACK_GRID_WIDTH * 3, RACK_GRID_HEIGHT);
+
+ {
+ SvgPanel *panel = new SvgPanel();
+ panel->box.size = box.size;
+ panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ThreeHP.svg")));
+ addChild(panel);
+ }
+
+ addChild(createWidget<ScrewSilver>(Vec(0, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
+ }
};
Model* modelThreeHP = bogaudio::createModel<Module, ThreeHPWidget>("Bogaudio-ThreeHP", "THREEHP", "Template/blank", "Blank");
struct SixHPWidget : ModuleWidget {
- SixHPWidget(Module* module) {
- setModule(module);
- box.size = Vec(RACK_GRID_WIDTH * 6, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/SixHP.svg")));
- addChild(panel);
- }
-
- addChild(createWidget<ScrewSilver>(Vec(0, 0)));
- addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
- }
+ SixHPWidget(Module* module) {
+ setModule(module);
+ box.size = Vec(RACK_GRID_WIDTH * 6, RACK_GRID_HEIGHT);
+
+ {
+ SvgPanel *panel = new SvgPanel();
+ panel->box.size = box.size;
+ panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/SixHP.svg")));
+ addChild(panel);
+ }
+
+ addChild(createWidget<ScrewSilver>(Vec(0, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
+ }
};
Model* modelSixHP = bogaudio::createModel<Module, SixHPWidget>("Bogaudio-SixHP", "SIXHP", "Template/blank", "Blank");
struct EightHPWidget : ModuleWidget {
- EightHPWidget(Module* module) {
- setModule(module);
- box.size = Vec(RACK_GRID_WIDTH * 8, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/EightHP.svg")));
- addChild(panel);
- }
-
- addChild(createWidget<ScrewSilver>(Vec(0, 0)));
- addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
- }
+ EightHPWidget(Module* module) {
+ setModule(module);
+ box.size = Vec(RACK_GRID_WIDTH * 8, RACK_GRID_HEIGHT);
+
+ {
+ SvgPanel *panel = new SvgPanel();
+ panel->box.size = box.size;
+ panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/EightHP.svg")));
+ addChild(panel);
+ }
+
+ addChild(createWidget<ScrewSilver>(Vec(0, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
+ }
};
Model* modelEightHP = bogaudio::createModel<Module, EightHPWidget>("Bogaudio-EightHP", "EIGHTHP", "Template/blank", "Blank");
@@ -63,7 +63,7 @@ Model* modelEightHP = bogaudio::createModel<Module, EightHPWidget>("Bogaudio-Eig
struct TenHPWidget : ModuleWidget {
TenHPWidget(Module* module) {
- setModule(module);
+ setModule(module);
box.size = Vec(RACK_GRID_WIDTH * 10, RACK_GRID_HEIGHT);
{
@@ -84,198 +84,198 @@ Model* modelTenHP = bogaudio::createModel<Module, TenHPWidget>("Bogaudio-TenHP",
struct TwelveHPWidget : ModuleWidget {
- TwelveHPWidget(Module* module) {
- setModule(module);
- box.size = Vec(RACK_GRID_WIDTH * 12, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/TwelveHP.svg")));
- addChild(panel);
- }
-
- addChild(createWidget<ScrewSilver>(Vec(0, 0)));
- addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0)));
- addChild(createWidget<ScrewSilver>(Vec(0, 365)));
- addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
- }
+ TwelveHPWidget(Module* module) {
+ setModule(module);
+ box.size = Vec(RACK_GRID_WIDTH * 12, RACK_GRID_HEIGHT);
+
+ {
+ SvgPanel *panel = new SvgPanel();
+ panel->box.size = box.size;
+ panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/TwelveHP.svg")));
+ addChild(panel);
+ }
+
+ addChild(createWidget<ScrewSilver>(Vec(0, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(0, 365)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
+ }
};
Model* modelTwelveHP = bogaudio::createModel<Module, TwelveHPWidget>("Bogaudio-TwelveHP", "TWELVEHP", "Template/blank", "Blank");
struct ThirteenHPWidget : ModuleWidget {
- ThirteenHPWidget(Module* module) {
- setModule(module);
- box.size = Vec(RACK_GRID_WIDTH * 13, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ThirteenHP.svg")));
- addChild(panel);
- }
-
- addChild(createWidget<ScrewSilver>(Vec(0, 0)));
- addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0)));
- addChild(createWidget<ScrewSilver>(Vec(0, 365)));
- addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
- }
+ ThirteenHPWidget(Module* module) {
+ setModule(module);
+ box.size = Vec(RACK_GRID_WIDTH * 13, RACK_GRID_HEIGHT);
+
+ {
+ SvgPanel *panel = new SvgPanel();
+ panel->box.size = box.size;
+ panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ThirteenHP.svg")));
+ addChild(panel);
+ }
+
+ addChild(createWidget<ScrewSilver>(Vec(0, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(0, 365)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
+ }
};
Model* modelThirteenHP = bogaudio::createModel<Module, ThirteenHPWidget>("Bogaudio-ThirteenHP", "THIRTEENHP", "Template/blank", "Blank");
struct FifteenHPWidget : ModuleWidget {
- FifteenHPWidget(Module* module) {
- setModule(module);
- box.size = Vec(RACK_GRID_WIDTH * 15, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/FifteenHP.svg")));
- addChild(panel);
- }
-
- addChild(createWidget<ScrewSilver>(Vec(15, 0)));
- addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
- addChild(createWidget<ScrewSilver>(Vec(15, 365)));
- addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 365)));
- }
+ FifteenHPWidget(Module* module) {
+ setModule(module);
+ box.size = Vec(RACK_GRID_WIDTH * 15, RACK_GRID_HEIGHT);
+
+ {
+ SvgPanel *panel = new SvgPanel();
+ panel->box.size = box.size;
+ panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/FifteenHP.svg")));
+ addChild(panel);
+ }
+
+ addChild(createWidget<ScrewSilver>(Vec(15, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(15, 365)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 365)));
+ }
};
Model* modelFifteenHP = bogaudio::createModel<Module, FifteenHPWidget>("Bogaudio-FifteenHP", "FIFTEENHP", "Template/blank", "Blank");
struct SixteenHPWidget : ModuleWidget {
- SixteenHPWidget(Module* module) {
- setModule(module);
- box.size = Vec(RACK_GRID_WIDTH * 16, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/SixteenHP.svg")));
- addChild(panel);
- }
-
- addChild(createWidget<ScrewSilver>(Vec(15, 0)));
- addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
- addChild(createWidget<ScrewSilver>(Vec(15, 365)));
- addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 365)));
- }
+ SixteenHPWidget(Module* module) {
+ setModule(module);
+ box.size = Vec(RACK_GRID_WIDTH * 16, RACK_GRID_HEIGHT);
+
+ {
+ SvgPanel *panel = new SvgPanel();
+ panel->box.size = box.size;
+ panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/SixteenHP.svg")));
+ addChild(panel);
+ }
+
+ addChild(createWidget<ScrewSilver>(Vec(15, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(15, 365)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 365)));
+ }
};
Model* modelSixteenHP = bogaudio::createModel<Module, SixteenHPWidget>("Bogaudio-SixteenHP", "SIXTEENHP", "Template/blank", "Blank");
struct EighteenHPWidget : ModuleWidget {
- EighteenHPWidget(Module* module) {
- setModule(module);
- box.size = Vec(RACK_GRID_WIDTH * 18, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/EighteenHP.svg")));
- addChild(panel);
- }
-
- addChild(createWidget<ScrewSilver>(Vec(15, 0)));
- addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
- addChild(createWidget<ScrewSilver>(Vec(15, 365)));
- addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 365)));
- }
+ EighteenHPWidget(Module* module) {
+ setModule(module);
+ box.size = Vec(RACK_GRID_WIDTH * 18, RACK_GRID_HEIGHT);
+
+ {
+ SvgPanel *panel = new SvgPanel();
+ panel->box.size = box.size;
+ panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/EighteenHP.svg")));
+ addChild(panel);
+ }
+
+ addChild(createWidget<ScrewSilver>(Vec(15, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(15, 365)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 365)));
+ }
};
Model* modelEighteenHP = bogaudio::createModel<Module, EighteenHPWidget>("Bogaudio-EighteenHP", "EIGHTEENHP", "Template/blank", "Blank");
struct TwentyHPWidget : ModuleWidget {
- TwentyHPWidget(Module* module) {
- setModule(module);
- box.size = Vec(RACK_GRID_WIDTH * 20, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/TwentyHP.svg")));
- addChild(panel);
- }
-
- addChild(createWidget<ScrewSilver>(Vec(15, 0)));
- addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
- addChild(createWidget<ScrewSilver>(Vec(15, 365)));
- addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 365)));
- }
+ TwentyHPWidget(Module* module) {
+ setModule(module);
+ box.size = Vec(RACK_GRID_WIDTH * 20, RACK_GRID_HEIGHT);
+
+ {
+ SvgPanel *panel = new SvgPanel();
+ panel->box.size = box.size;
+ panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/TwentyHP.svg")));
+ addChild(panel);
+ }
+
+ addChild(createWidget<ScrewSilver>(Vec(15, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(15, 365)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 365)));
+ }
};
Model* modelTwentyHP = bogaudio::createModel<Module, TwentyHPWidget>("Bogaudio-TwentyHP", "TWENTYHP", "Template/blank", "Blank");
struct TwentyTwoHPWidget : ModuleWidget {
- TwentyTwoHPWidget(Module* module) {
- setModule(module);
- box.size = Vec(RACK_GRID_WIDTH * 22, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/TwentyTwoHP.svg")));
- addChild(panel);
- }
-
- addChild(createWidget<ScrewSilver>(Vec(15, 0)));
- addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
- addChild(createWidget<ScrewSilver>(Vec(15, 365)));
- addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 365)));
- }
+ TwentyTwoHPWidget(Module* module) {
+ setModule(module);
+ box.size = Vec(RACK_GRID_WIDTH * 22, RACK_GRID_HEIGHT);
+
+ {
+ SvgPanel *panel = new SvgPanel();
+ panel->box.size = box.size;
+ panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/TwentyTwoHP.svg")));
+ addChild(panel);
+ }
+
+ addChild(createWidget<ScrewSilver>(Vec(15, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(15, 365)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 365)));
+ }
};
Model* modelTwentyTwoHP = bogaudio::createModel<Module, TwentyTwoHPWidget>("Bogaudio-TwentyTwoHP", "TWENTYTWOHP", "Template/blank", "Blank");
struct TwentyFiveHPWidget : ModuleWidget {
- TwentyFiveHPWidget(Module* module) {
- setModule(module);
- box.size = Vec(RACK_GRID_WIDTH * 25, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/TwentyFiveHP.svg")));
- addChild(panel);
- }
-
- addChild(createWidget<ScrewSilver>(Vec(15, 0)));
- addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
- addChild(createWidget<ScrewSilver>(Vec(15, 365)));
- addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 365)));
- }
+ TwentyFiveHPWidget(Module* module) {
+ setModule(module);
+ box.size = Vec(RACK_GRID_WIDTH * 25, RACK_GRID_HEIGHT);
+
+ {
+ SvgPanel *panel = new SvgPanel();
+ panel->box.size = box.size;
+ panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/TwentyFiveHP.svg")));
+ addChild(panel);
+ }
+
+ addChild(createWidget<ScrewSilver>(Vec(15, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(15, 365)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 365)));
+ }
};
Model* modelTwentyFiveHP = bogaudio::createModel<Module, TwentyFiveHPWidget>("Bogaudio-TwentyFiveHP", "TWENTYFIVEHP", "Template/blank", "Blank");
struct ThirtyHPWidget : ModuleWidget {
- ThirtyHPWidget(Module* module) {
- setModule(module);
- box.size = Vec(RACK_GRID_WIDTH * 30, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ThirtyHP.svg")));
- addChild(panel);
- }
-
- addChild(createWidget<ScrewSilver>(Vec(15, 0)));
- addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
- addChild(createWidget<ScrewSilver>(Vec(15, 365)));
- addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 365)));
- }
+ ThirtyHPWidget(Module* module) {
+ setModule(module);
+ box.size = Vec(RACK_GRID_WIDTH * 30, RACK_GRID_HEIGHT);
+
+ {
+ SvgPanel *panel = new SvgPanel();
+ panel->box.size = box.size;
+ panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ThirtyHP.svg")));
+ addChild(panel);
+ }
+
+ addChild(createWidget<ScrewSilver>(Vec(15, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(15, 365)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 365)));
+ }
};
Model* modelThirtyHP = bogaudio::createModel<Module, ThirtyHPWidget>("Bogaudio-ThirtyHP", "THIRTYHP", "Template/blank", "Blank");
diff --git a/test/plot.cpp b/test/plot.cpp
@@ -40,17 +40,17 @@ float y(float x) {
}
int main() {
- const float xMin = 0.1f;
- // const float xMax = 1023.0f;
- const float xMax = 100.0f;
- const float samples = 1024.0f;
-
- const float delta = (xMax - xMin) / samples;
- float x = xMin;
- while (x <= xMax) {
- printf("%f, %f\n", x, y(x));
- x += delta;
- }
- // printf("%f\n", y(1.0f));
- return 0;
+ const float xMin = 0.1f;
+ // const float xMax = 1023.0f;
+ const float xMax = 100.0f;
+ const float samples = 1024.0f;
+
+ const float delta = (xMax - xMin) / samples;
+ float x = xMin;
+ while (x <= xMax) {
+ printf("%f, %f\n", x, y(x));
+ x += delta;
+ }
+ // printf("%f\n", y(1.0f));
+ return 0;
}