Formatted the entire codebase and added a CI check for formatting

This commit is contained in:
AlexandreRouma
2021-12-19 22:11:44 +01:00
parent 8644957881
commit ea587db0cb
161 changed files with 3302 additions and 3393 deletions

View File

@ -2,10 +2,9 @@
#include <core.h>
SignalPath::SignalPath() {
}
void SignalPath::init(uint64_t sampleRate, int fftRate, int fftSize, dsp::stream<dsp::complex_t>* input, dsp::complex_t* fftBuffer, void fftHandler(dsp::complex_t*,int,void*), void* fftHandlerCtx) {
void SignalPath::init(uint64_t sampleRate, int fftRate, int fftSize, dsp::stream<dsp::complex_t>* input, dsp::complex_t* fftBuffer, void fftHandler(dsp::complex_t*, int, void*), void* fftHandlerCtx) {
this->sampleRate = sampleRate;
this->sourceSampleRate = sampleRate;
this->fftRate = fftRate;
@ -179,12 +178,12 @@ void SignalPath::setDecimation(int dec) {
else {
split.setInput(&inputBuffer.out);
}
if (running) { split.start(); }
core::setInputSampleRate(sourceSampleRate);
return;
}
// Create new decimators
for (int i = 0; i < dec; i++) {
dsp::HalfDecimator<dsp::complex_t>* decimator;
@ -195,13 +194,13 @@ void SignalPath::setDecimation(int dec) {
decimator = new dsp::HalfDecimator<dsp::complex_t>(&inputBuffer.out, &halfBandWindow);
}
else {
decimator = new dsp::HalfDecimator<dsp::complex_t>(&decimators[i-1]->out, &halfBandWindow);
decimator = new dsp::HalfDecimator<dsp::complex_t>(&decimators[i - 1]->out, &halfBandWindow);
}
if (running) { decimator->start(); }
decimators.push_back(decimator);
}
split.setInput(&decimators[decimators.size()-1]->out);
split.setInput(&decimators[decimators.size() - 1]->out);
if (running) { split.start(); }
// Update the DSP sample rate
@ -247,12 +246,12 @@ void SignalPath::setFFTWindow(int win) {
void SignalPath::generateFFTWindow(int win, float* taps, int size) {
if (win == FFT_WINDOW_RECTANGULAR) {
for (int i = 0; i < size; i++) {
taps[i] = (i%2) ? 1 : -1;
taps[i] = (i % 2) ? 1 : -1;
}
}
else if (win == FFT_WINDOW_BLACKMAN) {
for (int i = 0; i < size; i++) {
taps[i] = ((i%2) ? dsp::window_function::blackman(i, size) : -dsp::window_function::blackman(i, size))*2;
taps[i] = ((i % 2) ? dsp::window_function::blackman(i, size) : -dsp::window_function::blackman(i, size)) * 2;
}
}
}

View File

@ -15,7 +15,7 @@ enum {
class SignalPath {
public:
SignalPath();
void init(uint64_t sampleRate, int fftRate, int fftSize, dsp::stream<dsp::complex_t>* input, dsp::complex_t* fftBuffer, void fftHandler(dsp::complex_t*,int,void*), void* fftHandlerCtx);
void init(uint64_t sampleRate, int fftRate, int fftSize, dsp::stream<dsp::complex_t>* input, dsp::complex_t* fftBuffer, void fftHandler(dsp::complex_t*, int, void*), void* fftHandlerCtx);
void start();
void stop();
void setSampleRate(double sampleRate);

View File

@ -32,7 +32,7 @@ void SinkManager::Stream::start() {
if (running) {
return;
}
splitter.start();
volumeAjust.start();
sink->start();
@ -113,7 +113,7 @@ void SinkManager::unregisterSinkProvider(std::string name) {
}
onSinkProviderUnregister.emit(name);
// Switch all sinks using it to a null sink
for (auto& [streamName, stream] : streams) {
if (providerNames[stream->providerId] != name) { continue; }
@ -344,7 +344,7 @@ void SinkManager::showMenu() {
float menuWidth = ImGui::GetContentRegionAvailWidth();
int count = 0;
int maxCount = streams.size();
std::string provStr = "";
for (auto const& name : providerNames) {
provStr += name;

View File

@ -48,7 +48,7 @@ public:
dsp::stream<dsp::stereo_t>* sinkOut;
Event<float> srChange;
Event<float> srChange;
private:
dsp::stream<dsp::stereo_t>* _in;
@ -86,7 +86,6 @@ public:
private:
dsp::NullSink<dsp::stereo_t> ns;
};
void registerSinkProvider(std::string name, SinkProvider provider);
@ -130,5 +129,4 @@ private:
std::vector<std::string> providerNames;
std::string providerNamesTxt;
std::vector<std::string> streamNames;
};

View File

@ -3,7 +3,6 @@
#include <signal_path/signal_path.h>
SourceManager::SourceManager() {
}
void SourceManager::registerSource(std::string name, SourceHandler* handler) {
@ -34,11 +33,11 @@ void SourceManager::unregisterSource(std::string name) {
std::vector<std::string> SourceManager::getSourceNames() {
std::vector<std::string> names;
for (auto const& [name, src] : sources) { names.push_back(name); }
for (auto const& [name, src] : sources) { names.push_back(name); }
return names;
}
void SourceManager::selectSource(std::string name) {
void SourceManager::selectSource(std::string name) {
if (sources.find(name) == sources.end()) {
spdlog::error("Tried to select non existent source: {0}", name);
return;

View File

@ -23,7 +23,7 @@ public:
void registerSource(std::string name, SourceHandler* handler);
void unregisterSource(std::string name);
void selectSource(std::string name);
void selectSource(std::string name);
void showSelectedMenu();
void start();
void stop();
@ -43,5 +43,4 @@ private:
double tuneOffset;
double currentFreq;
dsp::stream<dsp::complex_t> nullSource;
};

View File

@ -87,7 +87,6 @@ std::string VFOManager::VFO::getName() {
}
VFOManager::VFOManager() {
}
VFOManager::VFO* VFOManager::createVFO(std::string name, int reference, double offset, double bandwidth, double sampleRate, double minBandwidth, double maxBandwidth, bool bandwidthLocked) {
@ -187,7 +186,7 @@ int VFOManager::getReference(std::string name) {
return vfos[name]->getReference();
}
void VFOManager::setColor(std::string name, ImU32 color) {
void VFOManager::setColor(std::string name, ImU32 color) {
if (vfos.find(name) == vfos.end()) {
return;
}

View File

@ -35,7 +35,6 @@ public:
private:
std::string name;
};
VFOManager::VFO* createVFO(std::string name, int reference, double offset, double bandwidth, double sampleRate, double minBandwidth, double maxBandwidth, bool bandwidthLocked);