Changed the default NFM snap interval

This commit is contained in:
Ryzerth
2021-06-17 20:14:23 +02:00
parent b5d38c71ce
commit da2f4fcf3a
6 changed files with 160 additions and 33 deletions

View File

@ -214,4 +214,79 @@ namespace dsp {
std::condition_variable canReadVar;
std::condition_variable canWriteVar;
};
template <class T>
class BufferBlock : public generic_block<BufferBlock<T>> {
public:
BufferBlock() {}
BufferBlock(stream<T>* in, int bufferSize) { init(in, bufferSize); }
~BufferBlock(stream<T>* in, int bufferSize) {
generic_block<BufferBlock<T>>::stop();
delete[] buffer;
}
void init(stream<T>* in, int bufferSize) {
_in = in;
_bufferSize = bufferSize;
buffer = new T[_bufferSize];
generic_block<BufferBlock<T>>::registerInput(_in);
}
void setInput(stream<T>* in) {
std::lock_guard<std::mutex> lck(generic_block<BufferBlock<T>>::ctrlMtx);
generic_block<BufferBlock<T>>::tempStop();
generic_block<BufferBlock<T>>::unregisterInput(_in);
_in = in;
generic_block<BufferBlock<T>>::registerInput(_in);
generic_block<BufferBlock<T>>::tempStart();
}
int run() {
int count = _in->read();
if (count < 0) { return -1; }
// If there's enough space in the buffer, write data. Otherwise, discard
{
std::lock_guard<std::mutex> lck(bufferMtx);
if (dataInBuffer + count <= _bufferSize) {
memcpy(&buffer[dataInBuffer], _in->readBuf, count);
dataInBuffer += count;
}
}
// Notify reader that data is available
cnd.notify_all();
_in->flush();
return count;
}
void readWorker() {
}
private:
void doStart() {
}
void doStop() {
}
stream<T>* _in;
int _bufferSize;
T* buffer;
int dataInBuffer = 0;
std::mutex bufferMtx;
std::condition_variable cnd;
bool stopReaderThread = false;
std::thread readerThread;
};
};

View File

@ -7,6 +7,7 @@
#include <volk/volk.h>
#include <GLFW/glfw3.h>
#include <spdlog/spdlog.h>
#include <gui/gui.h>
float DEFAULT_COLOR_MAP[][3] = {
{0x00, 0x00, 0x20},

View File

@ -154,7 +154,6 @@ namespace ImGui {
_BANDPLAN_POS_COUNT
};
private:
void drawWaterfall();
void drawFFT();