mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-06-25 12:07:49 +02:00
More work
This commit is contained in:
@ -18,9 +18,23 @@ namespace demod {
|
||||
|
||||
void init(std::string name, ConfigManager* config, dsp::stream<dsp::complex_t>* input, double bandwidth, EventHandler<dsp::stream<dsp::stereo_t>*> outputChangeHandler, EventHandler<float> afbwChangeHandler, double audioSR) {
|
||||
this->name = name;
|
||||
_config = config;
|
||||
|
||||
// Load config
|
||||
config->acquire();
|
||||
if (config->conf[name][getName()].contains("agcAttack")) {
|
||||
agcAttack = config->conf[name][getName()]["agcAttack"];
|
||||
}
|
||||
if (config->conf[name][getName()].contains("agcDecay")) {
|
||||
agcDecay = config->conf[name][getName()]["agcDecay"];
|
||||
}
|
||||
if (config->conf[name][getName()].contains("carrierAgc")) {
|
||||
carrierAgc = config->conf[name][getName()]["carrierAgc"];
|
||||
}
|
||||
config->release();
|
||||
|
||||
// Define structure
|
||||
demod.init(input, dsp::demod::AM::AGCMode::CARRIER, 24.0 / getIFSampleRate());
|
||||
demod.init(input, carrierAgc ? dsp::demod::AM::AGCMode::CARRIER : dsp::demod::AM::AGCMode::AUDIO, agcAttack / getIFSampleRate(), agcDecay / getIFSampleRate(), 100.0 / getIFSampleRate());
|
||||
m2s.init(&demod.out);
|
||||
}
|
||||
|
||||
@ -35,7 +49,29 @@ namespace demod {
|
||||
}
|
||||
|
||||
void showMenu() {
|
||||
// TODO: Adjust AGC settings
|
||||
float menuWidth = ImGui::GetContentRegionAvail().x;
|
||||
ImGui::LeftLabel("AGC Attack");
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::SliderFloat(("##_radio_am_agc_attack_" + name).c_str(), &agcAttack, 1.0f, 50.0f)) {
|
||||
demod.setAGCAttack(agcAttack / getIFSampleRate());
|
||||
_config->acquire();
|
||||
_config->conf[name][getName()]["agcAttack"] = agcAttack;
|
||||
_config->release(true);
|
||||
}
|
||||
ImGui::LeftLabel("AGC Decay");
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::SliderFloat(("AGC Decay##_radio_am_agc_decay_" + name).c_str(), &agcDecay, 1.0f, 50.0f)) {
|
||||
demod.setAGCDecay(agcDecay / getIFSampleRate());
|
||||
_config->acquire();
|
||||
_config->conf[name][getName()]["agcDecay"] = agcDecay;
|
||||
_config->release(true);
|
||||
}
|
||||
if (ImGui::Checkbox(("Carrier AGC (W.I.P.)##_radio_am_carrier_agc_" + name).c_str(), &carrierAgc)) {
|
||||
demod.setAGCMode(carrierAgc ? dsp::demod::AM::AGCMode::CARRIER : dsp::demod::AM::AGCMode::AUDIO);
|
||||
_config->acquire();
|
||||
_config->conf[name][getName()]["carrierAgc"] = carrierAgc;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
void setBandwidth(double bandwidth) {}
|
||||
@ -71,6 +107,12 @@ namespace demod {
|
||||
dsp::demod::AM demod;
|
||||
dsp::convert::MonoToStereo m2s;
|
||||
|
||||
ConfigManager* _config = NULL;
|
||||
|
||||
float agcAttack = 40.0f;
|
||||
float agcDecay = 5.0f;
|
||||
bool carrierAgc = false;
|
||||
|
||||
std::string name;
|
||||
};
|
||||
}
|
@ -26,6 +26,12 @@ namespace demod {
|
||||
|
||||
// Load config
|
||||
config->acquire();
|
||||
if (config->conf[name][getName()].contains("agcAttack")) {
|
||||
agcAttack = config->conf[name][getName()]["agcAttack"];
|
||||
}
|
||||
if (config->conf[name][getName()].contains("agcDecay")) {
|
||||
agcDecay = config->conf[name][getName()]["agcDecay"];
|
||||
}
|
||||
if (config->conf[name][getName()].contains("tone")) {
|
||||
tone = config->conf[name][getName()]["tone"];
|
||||
}
|
||||
@ -34,7 +40,7 @@ namespace demod {
|
||||
// Define structure
|
||||
xlator.init(input, tone, getIFSampleRate());
|
||||
c2r.init(&xlator.out);
|
||||
agc.init(&c2r.out, 1.0, 24.0 / getIFSampleRate(), 10e6, 10.0);
|
||||
agc.init(&c2r.out, 1.0, agcAttack / getIFSampleRate(), agcDecay / getIFSampleRate(), 10e6, 10.0);
|
||||
m2s.init(&agc.out);
|
||||
}
|
||||
|
||||
@ -53,6 +59,23 @@ namespace demod {
|
||||
}
|
||||
|
||||
void showMenu() {
|
||||
float menuWidth = ImGui::GetContentRegionAvail().x;
|
||||
ImGui::LeftLabel("AGC Attack");
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::SliderFloat(("##_radio_cw_agc_attack_" + name).c_str(), &agcAttack, 1.0f, 50.0f)) {
|
||||
agc.setAttack(agcAttack / getIFSampleRate());
|
||||
_config->acquire();
|
||||
_config->conf[name][getName()]["agcAttack"] = agcAttack;
|
||||
_config->release(true);
|
||||
}
|
||||
ImGui::LeftLabel("AGC Decay");
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::SliderFloat(("AGC Decay##_radio_cw_agc_decay_" + name).c_str(), &agcDecay, 1.0f, 50.0f)) {
|
||||
agc.setDecay(agcDecay / getIFSampleRate());
|
||||
_config->acquire();
|
||||
_config->conf[name][getName()]["agcDecay"] = agcDecay;
|
||||
_config->release(true);
|
||||
}
|
||||
ImGui::LeftLabel("Tone Frequency");
|
||||
ImGui::FillWidth();
|
||||
if (ImGui::InputInt(("Stereo##_radio_cw_tone_" + name).c_str(), &tone, 10, 100)) {
|
||||
@ -103,6 +126,8 @@ namespace demod {
|
||||
|
||||
std::string name;
|
||||
|
||||
float agcAttack = 40.0f;
|
||||
float agcDecay = 5.0f;
|
||||
int tone = 800;
|
||||
double _bandwidth;
|
||||
|
||||
|
@ -18,9 +18,20 @@ namespace demod {
|
||||
|
||||
void init(std::string name, ConfigManager* config, dsp::stream<dsp::complex_t>* input, double bandwidth, EventHandler<dsp::stream<dsp::stereo_t>*> outputChangeHandler, EventHandler<float> afbwChangeHandler, double audioSR) {
|
||||
this->name = name;
|
||||
_config = config;
|
||||
|
||||
// Load config
|
||||
config->acquire();
|
||||
if (config->conf[name][getName()].contains("agcAttack")) {
|
||||
agcAttack = config->conf[name][getName()]["agcAttack"];
|
||||
}
|
||||
if (config->conf[name][getName()].contains("agcDecay")) {
|
||||
agcDecay = config->conf[name][getName()]["agcDecay"];
|
||||
}
|
||||
config->release();
|
||||
|
||||
// Define structure
|
||||
demod.init(input, dsp::demod::SSB::Mode::DSB, bandwidth, getIFSampleRate(), 24.0 / getIFSampleRate());
|
||||
demod.init(input, dsp::demod::SSB::Mode::DSB, bandwidth, getIFSampleRate(), agcAttack / getIFSampleRate(), agcDecay / getIFSampleRate());
|
||||
m2s.init(&demod.out);
|
||||
}
|
||||
|
||||
@ -35,7 +46,23 @@ namespace demod {
|
||||
}
|
||||
|
||||
void showMenu() {
|
||||
// TODO: Adjust AGC settings
|
||||
float menuWidth = ImGui::GetContentRegionAvail().x;
|
||||
ImGui::LeftLabel("AGC Attack");
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::SliderFloat(("##_radio_dsb_agc_attack_" + name).c_str(), &agcAttack, 1.0f, 50.0f)) {
|
||||
demod.setAGCAttack(agcAttack / getIFSampleRate());
|
||||
_config->acquire();
|
||||
_config->conf[name][getName()]["agcAttack"] = agcAttack;
|
||||
_config->release(true);
|
||||
}
|
||||
ImGui::LeftLabel("AGC Decay");
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::SliderFloat(("AGC Decay##_radio_dsb_agc_decay_" + name).c_str(), &agcDecay, 1.0f, 50.0f)) {
|
||||
demod.setAGCDecay(agcDecay / getIFSampleRate());
|
||||
_config->acquire();
|
||||
_config->conf[name][getName()]["agcDecay"] = agcDecay;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
void setBandwidth(double bandwidth) {
|
||||
@ -73,6 +100,11 @@ namespace demod {
|
||||
dsp::demod::SSB demod;
|
||||
dsp::convert::MonoToStereo m2s;
|
||||
|
||||
ConfigManager* _config;
|
||||
|
||||
float agcAttack = 40.0f;
|
||||
float agcDecay = 5.0f;
|
||||
|
||||
std::string name;
|
||||
};
|
||||
}
|
@ -18,9 +18,20 @@ namespace demod {
|
||||
|
||||
void init(std::string name, ConfigManager* config, dsp::stream<dsp::complex_t>* input, double bandwidth, EventHandler<dsp::stream<dsp::stereo_t>*> outputChangeHandler, EventHandler<float> afbwChangeHandler, double audioSR) {
|
||||
this->name = name;
|
||||
_config = config;
|
||||
|
||||
// Load config
|
||||
config->acquire();
|
||||
if (config->conf[name][getName()].contains("agcAttack")) {
|
||||
agcAttack = config->conf[name][getName()]["agcAttack"];
|
||||
}
|
||||
if (config->conf[name][getName()].contains("agcDecay")) {
|
||||
agcDecay = config->conf[name][getName()]["agcDecay"];
|
||||
}
|
||||
config->release();
|
||||
|
||||
// Define structure
|
||||
demod.init(input, dsp::demod::SSB::Mode::LSB, bandwidth, getIFSampleRate(), 24.0 / getIFSampleRate());
|
||||
demod.init(input, dsp::demod::SSB::Mode::LSB, bandwidth, getIFSampleRate(), agcAttack / getIFSampleRate(), agcDecay / getIFSampleRate());
|
||||
m2s.init(&demod.out);
|
||||
}
|
||||
|
||||
@ -35,7 +46,23 @@ namespace demod {
|
||||
}
|
||||
|
||||
void showMenu() {
|
||||
// TODO: Adjust AGC settings
|
||||
float menuWidth = ImGui::GetContentRegionAvail().x;
|
||||
ImGui::LeftLabel("AGC Attack");
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::SliderFloat(("##_radio_lsb_agc_attack_" + name).c_str(), &agcAttack, 1.0f, 50.0f)) {
|
||||
demod.setAGCAttack(agcAttack / getIFSampleRate());
|
||||
_config->acquire();
|
||||
_config->conf[name][getName()]["agcAttack"] = agcAttack;
|
||||
_config->release(true);
|
||||
}
|
||||
ImGui::LeftLabel("AGC Decay");
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::SliderFloat(("AGC Decay##_radio_lsb_agc_decay_" + name).c_str(), &agcDecay, 1.0f, 50.0f)) {
|
||||
demod.setAGCDecay(agcDecay / getIFSampleRate());
|
||||
_config->acquire();
|
||||
_config->conf[name][getName()]["agcDecay"] = agcDecay;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
void setBandwidth(double bandwidth) {
|
||||
@ -73,6 +100,11 @@ namespace demod {
|
||||
dsp::demod::SSB demod;
|
||||
dsp::convert::MonoToStereo m2s;
|
||||
|
||||
ConfigManager* _config;
|
||||
|
||||
float agcAttack = 40.0f;
|
||||
float agcDecay = 5.0f;
|
||||
|
||||
std::string name;
|
||||
};
|
||||
}
|
@ -18,9 +18,20 @@ namespace demod {
|
||||
|
||||
void init(std::string name, ConfigManager* config, dsp::stream<dsp::complex_t>* input, double bandwidth, EventHandler<dsp::stream<dsp::stereo_t>*> outputChangeHandler, EventHandler<float> afbwChangeHandler, double audioSR) {
|
||||
this->name = name;
|
||||
_config = config;
|
||||
|
||||
// Load config
|
||||
config->acquire();
|
||||
if (config->conf[name][getName()].contains("agcAttack")) {
|
||||
agcAttack = config->conf[name][getName()]["agcAttack"];
|
||||
}
|
||||
if (config->conf[name][getName()].contains("agcDecay")) {
|
||||
agcDecay = config->conf[name][getName()]["agcDecay"];
|
||||
}
|
||||
config->release();
|
||||
|
||||
// Define structure
|
||||
demod.init(input, dsp::demod::SSB::Mode::USB, bandwidth, getIFSampleRate(), 24.0 / getIFSampleRate());
|
||||
demod.init(input, dsp::demod::SSB::Mode::USB, bandwidth, getIFSampleRate(), agcAttack / getIFSampleRate(), agcDecay / getIFSampleRate());
|
||||
m2s.init(&demod.out);
|
||||
}
|
||||
|
||||
@ -35,7 +46,23 @@ namespace demod {
|
||||
}
|
||||
|
||||
void showMenu() {
|
||||
// TODO: Adjust AGC settings
|
||||
float menuWidth = ImGui::GetContentRegionAvail().x;
|
||||
ImGui::LeftLabel("AGC Attack");
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::SliderFloat(("##_radio_usb_agc_attack_" + name).c_str(), &agcAttack, 1.0f, 50.0f)) {
|
||||
demod.setAGCAttack(agcAttack / getIFSampleRate());
|
||||
_config->acquire();
|
||||
_config->conf[name][getName()]["agcAttack"] = agcAttack;
|
||||
_config->release(true);
|
||||
}
|
||||
ImGui::LeftLabel("AGC Decay");
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::SliderFloat(("AGC Decay##_radio_usb_agc_decay_" + name).c_str(), &agcDecay, 1.0f, 50.0f)) {
|
||||
demod.setAGCDecay(agcDecay / getIFSampleRate());
|
||||
_config->acquire();
|
||||
_config->conf[name][getName()]["agcDecay"] = agcDecay;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
void setBandwidth(double bandwidth) {
|
||||
@ -73,6 +100,11 @@ namespace demod {
|
||||
dsp::demod::SSB demod;
|
||||
dsp::convert::MonoToStereo m2s;
|
||||
|
||||
ConfigManager* _config;
|
||||
|
||||
float agcAttack = 40.0f;
|
||||
float agcDecay = 5.0f;
|
||||
|
||||
std::string name;
|
||||
};
|
||||
}
|
@ -26,10 +26,13 @@ namespace demod {
|
||||
if (config->conf[name][getName()].contains("stereo")) {
|
||||
_stereo = config->conf[name][getName()]["stereo"];
|
||||
}
|
||||
if (config->conf[name][getName()].contains("lowPass")) {
|
||||
_lowPass = config->conf[name][getName()]["lowPass"];
|
||||
}
|
||||
_config->release(modified);
|
||||
|
||||
// Define structure
|
||||
demod.init(input, bandwidth / 2.0f, getIFSampleRate(), _stereo);
|
||||
demod.init(input, bandwidth / 2.0f, getIFSampleRate(), _stereo, _lowPass);
|
||||
}
|
||||
|
||||
void start() {
|
||||
@ -49,6 +52,9 @@ namespace demod {
|
||||
}
|
||||
if (ImGui::Checkbox(("Low Pass##_radio_wfm_lowpass_" + name).c_str(), &_lowPass)) {
|
||||
demod.setLowPass(_lowPass);
|
||||
_config->acquire();
|
||||
_config->conf[name][getName()]["lowPass"] = _lowPass;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user