diff --git a/core/src/config.cpp b/core/src/config.cpp index 913d5fad..6a5fc314 100644 --- a/core/src/config.cpp +++ b/core/src/config.cpp @@ -82,37 +82,4 @@ void ConfigManager::autoSaveWorker(ConfigManager* _this) { _this->mtx.unlock(); 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; -// } - +} \ No newline at end of file diff --git a/core/src/credits.cpp b/core/src/credits.cpp index 128019c4..30487f25 100644 --- a/core/src/credits.cpp +++ b/core/src/credits.cpp @@ -25,6 +25,7 @@ namespace sdrpp_credits { }; const char* patrons[] = { + "Croccydile", "Daniele D'Agnelli", "W4IPA", "Lee Donaghy", diff --git a/core/src/event.h b/core/src/event.h index 594470e1..d44c4416 100644 --- a/core/src/event.h +++ b/core/src/event.h @@ -2,34 +2,35 @@ #include #include +template +struct EventHandler { + EventHandler() {} + EventHandler(void (*handler)(T, void*), void* ctx) { + this->handler = handler; + this->ctx = ctx; + } + + void (*handler)(T, void*); + void* ctx; +}; + template class Event { public: 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) { for (auto const& handler : handlers) { handler.handler(value, handler.ctx); } } - void bindHandler(const EventHandler& handler) { + void bindHandler(const EventHandler& handler) { handlers.push_back(handler); } - void unbindHandler(const EventHandler& handler) { + void unbindHandler(const EventHandler& handler) { if (handlers.find(handler) == handlers.end()) { spdlog::error("Tried to remove a non-existant event handler"); return; @@ -38,6 +39,6 @@ public: } private: - std::vector handlers; + std::vector> handlers; }; \ No newline at end of file diff --git a/core/src/signal_path/sink.cpp b/core/src/signal_path/sink.cpp index 499df6fa..cf930054 100644 --- a/core/src/signal_path/sink.cpp +++ b/core/src/signal_path/sink.cpp @@ -14,11 +14,11 @@ SinkManager::SinkManager() { registerSinkProvider("None", prov); } -SinkManager::Stream::Stream(dsp::stream* in, const Event::EventHandler& srChangeHandler, float sampleRate) { +SinkManager::Stream::Stream(dsp::stream* in, const EventHandler& srChangeHandler, float sampleRate) { init(in, srChangeHandler, sampleRate); } -void SinkManager::Stream::init(dsp::stream* in, const Event::EventHandler& srChangeHandler, float sampleRate) { +void SinkManager::Stream::init(dsp::stream* in, const EventHandler& srChangeHandler, float sampleRate) { _in = in; srChange.bindHandler(srChangeHandler); _sampleRate = sampleRate; diff --git a/core/src/signal_path/sink.h b/core/src/signal_path/sink.h index 90dc4bb7..061527e5 100644 --- a/core/src/signal_path/sink.h +++ b/core/src/signal_path/sink.h @@ -25,9 +25,9 @@ public: class Stream { public: Stream() {} - Stream(dsp::stream* in, const Event::EventHandler& srChangeHandler, float sampleRate); + Stream(dsp::stream* in, const EventHandler& srChangeHandler, float sampleRate); - void init(dsp::stream* in, const Event::EventHandler& srChangeHandler, float sampleRate); + void init(dsp::stream* in, const EventHandler& srChangeHandler, float sampleRate); void start(); void stop(); diff --git a/make_windows_package.ps1 b/make_windows_package.ps1 index af6f8606..ad3a9965 100644 --- a/make_windows_package.ps1 +++ b/make_windows_package.ps1 @@ -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/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/ diff --git a/radio/src/main.cpp b/radio/src/main.cpp index be5a8bc8..dd41c398 100644 --- a/radio/src/main.cpp +++ b/radio/src/main.cpp @@ -199,7 +199,7 @@ private: dsp::NullSink ns; - Event::EventHandler srChangeHandler; + EventHandler srChangeHandler; SinkManager::Stream stream; }; diff --git a/readme.md b/readme.md index d7211cca..4b787589 100644 --- a/readme.md +++ b/readme.md @@ -219,6 +219,7 @@ I will soon publish a contributing.md listing the code style to use. ## Patrons +* [Croccydile](https://example.com/) * [Daniele D'Agnelli](https://linkedin.com/in/dagnelli) * [W4IPA](https://twitter.com/W4IPAstroke5) * [Lee Donaghy](https://github.com/github) diff --git a/sdrplay_source/src/main.cpp b/sdrplay_source/src/main.cpp index 7fb1990b..7eac2d02 100644 --- a/sdrplay_source/src/main.cpp +++ b/sdrplay_source/src/main.cpp @@ -514,7 +514,16 @@ private: _this->openDevParams->rxChannelA->tunerParams.rfFreq.rfHz = _this->freq; _this->openDevParams->rxChannelA->tunerParams.gain.gRdB = _this->gain; _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]; + 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_Frf, sdrplay_api_Update_Ext1_None);