From 92b77904f617e3205877dace75d7cdb0557067fe Mon Sep 17 00:00:00 2001 From: Ryzerth Date: Fri, 4 Dec 2020 20:12:36 +0100 Subject: [PATCH] more fixes --- .gitignore | 1 + audio_sink/src/main.cpp | 4 ++-- core/src/core.cpp | 2 +- core/src/dsp/processing.h | 2 +- core/src/duktape/duk_config.h | 2 ++ core/src/gui/main_window.cpp | 1 + radio/src/main.cpp | 18 +++++++++--------- radio/src/path.cpp | 16 +++++++++++++--- root_dev/config.json | 21 ++++++++++++++++----- root_dev/module_list.json | 3 ++- root_dev/soapy_source_config.json | 8 ++++---- 11 files changed, 52 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index ae69b7ea..114ee785 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ build/ *.zip *.wav .DS_Store +sdrpp_v0.2.5_beta_x64 \ No newline at end of file diff --git a/audio_sink/src/main.cpp b/audio_sink/src/main.cpp index bb7d3c00..dd05a4c6 100644 --- a/audio_sink/src/main.cpp +++ b/audio_sink/src/main.cpp @@ -145,12 +145,12 @@ private: int bufferSize = sampleRate / 60.0f; if (dev->channels == 2) { - stereoRB.data.setMaxLatency(bufferSize * 3); + stereoRB.data.setMaxLatency(bufferSize * 2); stereoRB.start(); err = Pa_OpenStream(&stream, NULL, &outputParams, sampleRate, bufferSize, 0, _stereo_cb, this); } else { - monoRB.data.setMaxLatency(bufferSize * 3); + monoRB.data.setMaxLatency(bufferSize * 2); monoRB.start(); err = Pa_OpenStream(&stream, NULL, &outputParams, sampleRate, bufferSize, 0, _mono_cb, this); } diff --git a/core/src/core.cpp b/core/src/core.cpp index 90685555..4796ed65 100644 --- a/core/src/core.cpp +++ b/core/src/core.cpp @@ -99,7 +99,6 @@ int sdrpp_main() { if (window == NULL) return 1; glfwMakeContextCurrent(window); - glfwSwapInterval(1); // Enable vsync #if (GLFW_VERSION_MAJOR == 3) && (GLFW_VERSION_MINOR >= 3) if (maximized) { @@ -240,6 +239,7 @@ int sdrpp_main() { glClear(GL_COLOR_BUFFER_BIT); ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); + glfwSwapInterval(1); // Enable vsync glfwSwapBuffers(window); } diff --git a/core/src/dsp/processing.h b/core/src/dsp/processing.h index ee1557f1..e9126b23 100644 --- a/core/src/dsp/processing.h +++ b/core/src/dsp/processing.h @@ -92,7 +92,7 @@ namespace dsp { generic_block::registerOutput(&out); } - void setInputSize(stream* in) { + void setInput(stream* in) { std::lock_guard lck(generic_block::ctrlMtx); generic_block::tempStop(); generic_block::unregisterInput(_in); diff --git a/core/src/duktape/duk_config.h b/core/src/duktape/duk_config.h index 130168a9..c79a05cd 100644 --- a/core/src/duktape/duk_config.h +++ b/core/src/duktape/duk_config.h @@ -62,6 +62,8 @@ #if !defined(DUK_CONFIG_H_INCLUDED) #define DUK_CONFIG_H_INCLUDED +#define DUK_USE_DATE_NOW_WINDOWS + /* * Intermediate helper defines */ diff --git a/core/src/gui/main_window.cpp b/core/src/gui/main_window.cpp index 4132d48e..0e200aa2 100644 --- a/core/src/gui/main_window.cpp +++ b/core/src/gui/main_window.cpp @@ -127,6 +127,7 @@ void windowInit() { // Add squelsh // CW and RAW modes; // Bring VFO to a visible place when changing sample rate if it's smaller + // Use DUK_USE_DATE_NOW_WINDOWS for windows 7 support // TODO for 0.2.6 // And a module add/remove/change order menu diff --git a/radio/src/main.cpp b/radio/src/main.cpp index 0f29e67d..00d19ddc 100644 --- a/radio/src/main.cpp +++ b/radio/src/main.cpp @@ -114,24 +114,24 @@ private: ImGui::EndGroup(); - ImGui::Text("WFM Deemphasis"); - ImGui::SameLine(); - ImGui::PushItemWidth(menuColumnWidth - ImGui::GetCursorPosX()); - if (ImGui::Combo(CONCAT("##_deemp_select_", _this->name), &_this->deemp, DEEMP_LIST)) { - _this->sigPath.setDeemphasis(_this->deemp); + if (_this->demod == 1) { + ImGui::Text("WFM Deemphasis"); + ImGui::SameLine(); + ImGui::SetNextItemWidth(menuColumnWidth - ImGui::GetCursorPosX()); + if (ImGui::Combo(CONCAT("##_deemp_select_", _this->name), &_this->deemp, DEEMP_LIST)) { + _this->sigPath.setDeemphasis(_this->deemp); + } } - ImGui::PopItemWidth(); + ImGui::Text("Bandwidth"); ImGui::SameLine(); - ImGui::PushItemWidth(menuColumnWidth - ImGui::GetCursorPosX()); + ImGui::SetNextItemWidth(menuColumnWidth - ImGui::GetCursorPosX()); if (ImGui::InputInt(CONCAT("##_bw_select_", _this->name), &_this->bandWidth, 100, 1000)) { _this->bandWidth = std::clamp(_this->bandWidth, _this->bandWidthMin, _this->bandWidthMax); _this->sigPath.setBandwidth(_this->bandWidth); } - ImGui::PopItemWidth(); - ImGui::Text("Snap Interval"); ImGui::SameLine(); ImGui::SetNextItemWidth(menuColumnWidth - ImGui::GetCursorPosX()); diff --git a/radio/src/path.cpp b/radio/src/path.cpp index 9ba59724..01d352af 100644 --- a/radio/src/path.cpp +++ b/radio/src/path.cpp @@ -84,12 +84,15 @@ void SigPath::setDemodulator(int demId, float bandWidth) { amDemod.stop(); } else if (_demod == DEMOD_USB) { + agc.stop(); ssbDemod.stop(); } else if (_demod == DEMOD_LSB) { + agc.stop(); ssbDemod.stop(); } else if (_demod == DEMOD_DSB) { + agc.stop(); ssbDemod.stop(); } else { @@ -139,6 +142,7 @@ void SigPath::setDemodulator(int demId, float bandWidth) { else if (demId == DEMOD_AM) { demodOutputSamplerate = 125000; vfo->setSampleRate(12500, bandwidth); + agc.setInput(&amDemod.out); audioResamp.setInput(&agc.out); audioBw = std::min(bandwidth, outputSampleRate / 2.0f); @@ -157,7 +161,8 @@ void SigPath::setDemodulator(int demId, float bandWidth) { demodOutputSamplerate = 6000; vfo->setSampleRate(6000, bandwidth); ssbDemod.setMode(dsp::SSBDemod::MODE_USB); - audioResamp.setInput(&ssbDemod.out); + agc.setInput(&ssbDemod.out); + audioResamp.setInput(&agc.out); audioBw = std::min(bandwidth, outputSampleRate / 2.0f); audioResamp.setInSampleRate(6000); @@ -168,13 +173,15 @@ void SigPath::setDemodulator(int demId, float bandWidth) { deemp.bypass = true; vfo->setReference(ImGui::WaterfallVFO::REF_LOWER); + agc.start(); ssbDemod.start(); } else if (demId == DEMOD_LSB) { demodOutputSamplerate = 6000; vfo->setSampleRate(6000, bandwidth); ssbDemod.setMode(dsp::SSBDemod::MODE_LSB); - audioResamp.setInput(&ssbDemod.out); + agc.setInput(&ssbDemod.out); + audioResamp.setInput(&agc.out); audioBw = std::min(bandwidth, outputSampleRate / 2.0f); audioResamp.setInSampleRate(6000); @@ -185,13 +192,15 @@ void SigPath::setDemodulator(int demId, float bandWidth) { deemp.bypass = true; vfo->setReference(ImGui::WaterfallVFO::REF_UPPER); + agc.start(); ssbDemod.start(); } else if (demId == DEMOD_DSB) { demodOutputSamplerate = 6000; vfo->setSampleRate(6000, bandwidth); ssbDemod.setMode(dsp::SSBDemod::MODE_DSB); - audioResamp.setInput(&ssbDemod.out); + agc.setInput(&ssbDemod.out); + audioResamp.setInput(&agc.out); audioBw = std::min(bandwidth, outputSampleRate / 2.0f); audioResamp.setInSampleRate(6000); @@ -202,6 +211,7 @@ void SigPath::setDemodulator(int demId, float bandWidth) { deemp.bypass = true; vfo->setReference(ImGui::WaterfallVFO::REF_CENTER); + agc.start(); ssbDemod.start(); } else { diff --git a/root_dev/config.json b/root_dev/config.json index f87cc3f3..66c796dd 100644 --- a/root_dev/config.json +++ b/root_dev/config.json @@ -21,10 +21,11 @@ "fftHeight": 296, "frequency": 99000000, "max": 0.0, - "maximized": false, + "maximized": true, "menuOrder": [ "Source", - "Radio", + "Radio 1", + "Radio 2", "Recorder", "Sinks", "Audio", @@ -33,16 +34,26 @@ "Display" ], "menuWidth": 300, - "min": -70.5882339477539, + "min": -53.676475524902344, "offset": 0.0, "showWaterfall": true, - "source": "PlutoSDR", + "source": "SoapySDR", "sourceSettings": {}, "streams": { "Radio": { + "muted": false, + "sink": "Audio", + "volume": 0.5306122303009033 + }, + "Radio 1": { "muted": true, "sink": "Audio", - "volume": 0.65625 + "volume": 0.625 + }, + "Radio 2": { + "muted": false, + "sink": "Audio", + "volume": 1.0 } }, "windowSize": { diff --git a/root_dev/module_list.json b/root_dev/module_list.json index 5187e16c..a96849e7 100644 --- a/root_dev/module_list.json +++ b/root_dev/module_list.json @@ -1,5 +1,6 @@ { - "Radio": "./radio/Release/radio.dll", + "Radio 1": "./radio/Release/radio.dll", + "Radio 2": "./radio/Release/radio.dll", "Recorder": "./recorder/Release/recorder.dll", "Soapy": "./soapy/Release/soapy.dll", "RTLTCPSource": "./rtl_tcp_source/Release/rtl_tcp_source.dll", diff --git a/root_dev/soapy_source_config.json b/root_dev/soapy_source_config.json index bae23563..e1191d56 100644 --- a/root_dev/soapy_source_config.json +++ b/root_dev/soapy_source_config.json @@ -1,5 +1,5 @@ { - "device": "Generic RTL2832U OEM :: 00000001", + "device": "HackRF One #0 901868dc282c8f8b", "devices": { "": { "gains": { @@ -29,10 +29,10 @@ "HackRF One #0 901868dc282c8f8b": { "gains": { "AMP": 0.0, - "LNA": 24.711999893188477, - "VGA": 21.749000549316406 + "LNA": 23.415000915527344, + "VGA": 16.332000732421875 }, - "sampleRate": 2000000.0 + "sampleRate": 8000000.0 }, "Microphone (Realtek High Definition Audio)": { "sampleRate": 96000.0