Merge updated files
This commit is contained in:
Cam K 2021-04-19 21:02:45 -04:00
commit 13949e0dde
9 changed files with 33 additions and 53 deletions

View File

@ -82,37 +82,4 @@ void ConfigManager::autoSaveWorker(ConfigManager* _this) {
_this->mtx.unlock(); _this->mtx.unlock();
std::this_thread::sleep_for(std::chrono::milliseconds(1000)); std::this_thread::sleep_for(std::chrono::milliseconds(1000));
} }
} }
// void ConfigManager::setResourceDir(std::string path) {
// if (!std::filesystem::exists(path)) {
// spdlog::error("Resource directory '{0}' does not exist", path);
// return;
// }
// if (!std::filesystem::is_regular_file(path)) {
// spdlog::error("Resource directory '{0}' is not a directory", path);
// return;
// }
// resDir = path;
// }
// std::string ConfigManager::getResourceDir() {
// return resDir;
// }
// void ConfigManager::setConfigDir(std::string path) {
// if (!std::filesystem::exists(path)) {
// spdlog::error("Resource directory '{0}' does not exist", path);
// return;
// }
// if (!std::filesystem::is_regular_file(path)) {
// spdlog::error("Resource directory '{0}' is not a directory", path);
// return;
// }
// resDir = path;
// }
// std::string ConfigManager::getConfigDir() {
// return configDir;
// }

View File

@ -25,6 +25,7 @@ namespace sdrpp_credits {
}; };
const char* patrons[] = { const char* patrons[] = {
"Croccydile",
"Daniele D'Agnelli", "Daniele D'Agnelli",
"W4IPA", "W4IPA",
"Lee Donaghy", "Lee Donaghy",

View File

@ -2,34 +2,35 @@
#include <vector> #include <vector>
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
template <class T>
struct EventHandler {
EventHandler() {}
EventHandler(void (*handler)(T, void*), void* ctx) {
this->handler = handler;
this->ctx = ctx;
}
void (*handler)(T, void*);
void* ctx;
};
template <class T> template <class T>
class Event { class Event {
public: public:
Event() {} Event() {}
~Event() {} ~Event() {}
struct EventHandler {
EventHandler() {}
EventHandler(void (*handler)(T, void*), void* ctx) {
this->handler = handler;
this->ctx = ctx;
}
void (*handler)(T, void*);
void* ctx;
};
void emit(T value) { void emit(T value) {
for (auto const& handler : handlers) { for (auto const& handler : handlers) {
handler.handler(value, handler.ctx); handler.handler(value, handler.ctx);
} }
} }
void bindHandler(const EventHandler& handler) { void bindHandler(const EventHandler<T>& handler) {
handlers.push_back(handler); handlers.push_back(handler);
} }
void unbindHandler(const EventHandler& handler) { void unbindHandler(const EventHandler<T>& handler) {
if (handlers.find(handler) == handlers.end()) { if (handlers.find(handler) == handlers.end()) {
spdlog::error("Tried to remove a non-existant event handler"); spdlog::error("Tried to remove a non-existant event handler");
return; return;
@ -38,6 +39,6 @@ public:
} }
private: private:
std::vector<EventHandler> handlers; std::vector<EventHandler<T>> handlers;
}; };

View File

@ -14,11 +14,11 @@ SinkManager::SinkManager() {
registerSinkProvider("None", prov); registerSinkProvider("None", prov);
} }
SinkManager::Stream::Stream(dsp::stream<dsp::stereo_t>* in, const Event<float>::EventHandler& srChangeHandler, float sampleRate) { SinkManager::Stream::Stream(dsp::stream<dsp::stereo_t>* in, const EventHandler<float>& srChangeHandler, float sampleRate) {
init(in, srChangeHandler, sampleRate); init(in, srChangeHandler, sampleRate);
} }
void SinkManager::Stream::init(dsp::stream<dsp::stereo_t>* in, const Event<float>::EventHandler& srChangeHandler, float sampleRate) { void SinkManager::Stream::init(dsp::stream<dsp::stereo_t>* in, const EventHandler<float>& srChangeHandler, float sampleRate) {
_in = in; _in = in;
srChange.bindHandler(srChangeHandler); srChange.bindHandler(srChangeHandler);
_sampleRate = sampleRate; _sampleRate = sampleRate;

View File

@ -25,9 +25,9 @@ public:
class Stream { class Stream {
public: public:
Stream() {} Stream() {}
Stream(dsp::stream<dsp::stereo_t>* in, const Event<float>::EventHandler& srChangeHandler, float sampleRate); Stream(dsp::stream<dsp::stereo_t>* in, const EventHandler<float>& srChangeHandler, float sampleRate);
void init(dsp::stream<dsp::stereo_t>* in, const Event<float>::EventHandler& srChangeHandler, float sampleRate); void init(dsp::stream<dsp::stereo_t>* in, const EventHandler<float>& srChangeHandler, float sampleRate);
void start(); void start();
void stop(); void stop();

View File

@ -35,6 +35,7 @@ cp build/soapy_source/Release/soapy_source.dll sdrpp_windows_x64/modules/
cp build/file_source/Release/file_source.dll sdrpp_windows_x64/modules/ cp build/file_source/Release/file_source.dll sdrpp_windows_x64/modules/
cp build/sdrplay_source/Release/sdrplay_source.dll sdrpp_windows_x64/modules/ cp build/sdrplay_source/Release/sdrplay_source.dll sdrpp_windows_x64/modules/
cp 'C:/Program Files/SDRplay/API/x64/sdrplay_api.dll' sdrpp_windows_x64/
cp build/meteor_demodulator/Release/meteor_demodulator.dll sdrpp_windows_x64/modules/ cp build/meteor_demodulator/Release/meteor_demodulator.dll sdrpp_windows_x64/modules/

View File

@ -199,7 +199,7 @@ private:
dsp::NullSink<dsp::complex_t> ns; dsp::NullSink<dsp::complex_t> ns;
Event<float>::EventHandler srChangeHandler; EventHandler<float> srChangeHandler;
SinkManager::Stream stream; SinkManager::Stream stream;
}; };

View File

@ -219,6 +219,7 @@ I will soon publish a contributing.md listing the code style to use.
## Patrons ## Patrons
* [Croccydile](https://example.com/)
* [Daniele D'Agnelli](https://linkedin.com/in/dagnelli) * [Daniele D'Agnelli](https://linkedin.com/in/dagnelli)
* [W4IPA](https://twitter.com/W4IPAstroke5) * [W4IPA](https://twitter.com/W4IPAstroke5)
* [Lee Donaghy](https://github.com/github) * [Lee Donaghy](https://github.com/github)

View File

@ -514,7 +514,16 @@ private:
_this->openDevParams->rxChannelA->tunerParams.rfFreq.rfHz = _this->freq; _this->openDevParams->rxChannelA->tunerParams.rfFreq.rfHz = _this->freq;
_this->openDevParams->rxChannelA->tunerParams.gain.gRdB = _this->gain; _this->openDevParams->rxChannelA->tunerParams.gain.gRdB = _this->gain;
_this->openDevParams->rxChannelA->tunerParams.gain.LNAstate = _this->lnaGain; _this->openDevParams->rxChannelA->tunerParams.gain.LNAstate = _this->lnaGain;
// Hard coded AGC parameters
_this->openDevParams->rxChannelA->ctrlParams.agc.attack_ms = 500;
_this->openDevParams->rxChannelA->ctrlParams.agc.decay_ms = 500;
_this->openDevParams->rxChannelA->ctrlParams.agc.decay_delay_ms = 200;
_this->openDevParams->rxChannelA->ctrlParams.agc.decay_threshold_dB = 5;
_this->openDevParams->rxChannelA->ctrlParams.agc.setPoint_dBfs = -30;
_this->openDevParams->rxChannelA->ctrlParams.agc.enable = agcModes[_this->agc]; _this->openDevParams->rxChannelA->ctrlParams.agc.enable = agcModes[_this->agc];
sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_Dev_Fs, sdrplay_api_Update_Ext1_None); sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_Dev_Fs, sdrplay_api_Update_Ext1_None);
sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_Tuner_BwType, sdrplay_api_Update_Ext1_None); sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_Tuner_BwType, sdrplay_api_Update_Ext1_None);
sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_Tuner_Frf, sdrplay_api_Update_Ext1_None); sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_Tuner_Frf, sdrplay_api_Update_Ext1_None);