mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-12-24 18:08:27 +01:00
More bugfix + folder selection in recorder
This commit is contained in:
parent
92b77904f6
commit
9b8c1a3072
@ -10,7 +10,7 @@
|
||||
#include <gui/icons.h>
|
||||
#include <version.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <gui/bandplan.h>
|
||||
#include <gui/widgets/bandplan.h>
|
||||
#include <module.h>
|
||||
#include <stb_image.h>
|
||||
#include <config.h>
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include <gui/waterfall.h>
|
||||
#include <gui/frequency_select.h>
|
||||
#include <gui/menu.h>
|
||||
#include <gui/widgets/waterfall.h>
|
||||
#include <gui/widgets/frequency_select.h>
|
||||
#include <gui/widgets/menu.h>
|
||||
#include <gui/dialogs/loading_screen.h>
|
||||
#include <module.h>
|
||||
|
||||
|
@ -9,12 +9,12 @@
|
||||
#include <imgui_plot.h>
|
||||
#include <thread>
|
||||
#include <complex>
|
||||
#include <gui/waterfall.h>
|
||||
#include <gui/frequency_select.h>
|
||||
#include <gui/widgets/waterfall.h>
|
||||
#include <gui/widgets/frequency_select.h>
|
||||
#include <fftw3.h>
|
||||
#include <signal_path/dsp.h>
|
||||
#include <gui/icons.h>
|
||||
#include <gui/bandplan.h>
|
||||
#include <gui/widgets/bandplan.h>
|
||||
#include <watcher.h>
|
||||
#include <module.h>
|
||||
#include <signal_path/vfo_manager.h>
|
||||
@ -122,12 +122,13 @@ void windowInit() {
|
||||
displaymenu::init();
|
||||
|
||||
// TODO for 0.2.5
|
||||
// Add a loading screen
|
||||
// Add "select folder" option for the recorder module
|
||||
// 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
|
||||
// Add "select folder" option for the file source
|
||||
// Fix SSB demod
|
||||
// FIX AUDIO ISSUE ON BOTH LINUX AND SOMETIMES WINDOWS (probly the ring buffer, though double buffering could help)
|
||||
// Rewrite radio module with CW and RAW modes
|
||||
// Add default main config to avoid having to ship one
|
||||
// Have a good directory system on both linux and windows
|
||||
// Switch to double buffering
|
||||
|
||||
// TODO for 0.2.6
|
||||
// And a module add/remove/change order menu
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <gui/menus/bandplan.h>
|
||||
#include <gui/bandplan.h>
|
||||
#include <gui/widgets/bandplan.h>
|
||||
#include <gui/gui.h>
|
||||
#include <core.h>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <gui/bandplan.h>
|
||||
#include <gui/widgets/bandplan.h>
|
||||
#include <fstream>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <filesystem>
|
@ -1,4 +1,4 @@
|
||||
#include <gui/frequency_select.h>
|
||||
#include <gui/widgets/frequency_select.h>
|
||||
#include <config.h>
|
||||
#include <gui/style.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <gui/menu.h>
|
||||
#include <gui/widgets/menu.h>
|
||||
#include <imgui/imgui.h>
|
||||
|
||||
Menu::Menu() {
|
@ -1,4 +1,4 @@
|
||||
#include <gui/waterfall.h>
|
||||
#include <gui/widgets/waterfall.h>
|
||||
#include <imgui.h>
|
||||
#include <imgui_internal.h>
|
||||
#include <GL/glew.h>
|
||||
@ -564,6 +564,14 @@ namespace ImGui {
|
||||
double currentRatio = viewBandwidth / wholeBandwidth;
|
||||
wholeBandwidth = bandWidth;
|
||||
setViewBandwidth(bandWidth * currentRatio);
|
||||
for (auto const& [name, vfo] : vfos) {
|
||||
if (vfo->lowerOffset < -(bandWidth / 2)) {
|
||||
vfo->setCenterOffset(-(bandWidth / 2));
|
||||
}
|
||||
if (vfo->upperOffset > (bandWidth / 2)) {
|
||||
vfo->setCenterOffset(bandWidth / 2);
|
||||
}
|
||||
}
|
||||
updateAllVFOs();
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
#include <gui/bandplan.h>
|
||||
#include <gui/widgets/bandplan.h>
|
||||
#include <imgui/imgui.h>
|
||||
#include <imgui/imgui_internal.h>
|
||||
#include <GL/glew.h>
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include <dsp/vfo.h>
|
||||
#include <gui/waterfall.h>
|
||||
#include <gui/widgets/waterfall.h>
|
||||
#include <gui/gui.h>
|
||||
|
||||
class VFOManager {
|
||||
|
@ -7,8 +7,11 @@
|
||||
#include <thread>
|
||||
#include <ctime>
|
||||
#include <gui/gui.h>
|
||||
#include <filesystem>
|
||||
#include <signal_path/signal_path.h>
|
||||
#include <config.h>
|
||||
#include <gui/style.h>
|
||||
#include <regex>
|
||||
|
||||
#define CONCAT(a, b) ((std::string(a) + b).c_str())
|
||||
|
||||
@ -30,6 +33,11 @@ void sampleRateChanged(void* ctx, double sampleRate, int blockSize) {
|
||||
|
||||
}
|
||||
|
||||
std::string expandString(std::string input) {
|
||||
input = std::regex_replace(input, std::regex("%ROOT%"), ROOT_DIR);
|
||||
return std::regex_replace(input, std::regex("//"), "/");
|
||||
}
|
||||
|
||||
class RecorderModule {
|
||||
public:
|
||||
RecorderModule(std::string name) {
|
||||
@ -38,6 +46,7 @@ public:
|
||||
selectedStreamName = "";
|
||||
selectedStreamId = 0;
|
||||
lastNameList = "";
|
||||
strcpy(path, "%ROOT%/recordings");
|
||||
gui::menu.registerEntry(name, menuHandler, this);
|
||||
}
|
||||
|
||||
@ -77,6 +86,27 @@ private:
|
||||
}
|
||||
|
||||
ImGui::BeginGroup();
|
||||
if (_this->recording) { style::beginDisabled(); }
|
||||
ImGui::SetNextItemWidth(menuColumnWidth);
|
||||
bool lastPathValid = _this->pathValid;
|
||||
if (!lastPathValid) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.0f, 0.0f, 1.0f));
|
||||
}
|
||||
if (ImGui::InputText(CONCAT("##_recorder_path_", _this->name), _this->path, 4095)) {
|
||||
std::string expandedPath = expandString(_this->path);
|
||||
if (!std::filesystem::exists(expandedPath)) {
|
||||
_this->pathValid = false;
|
||||
}
|
||||
else if (!std::filesystem::is_directory(expandedPath)) {
|
||||
_this->pathValid = false;
|
||||
}
|
||||
else {
|
||||
_this->pathValid = true;
|
||||
}
|
||||
}
|
||||
if (!lastPathValid) {
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
|
||||
// TODO: Change VFO ref in signal path
|
||||
// TODO: Add VFO record
|
||||
@ -88,6 +118,7 @@ private:
|
||||
if (ImGui::RadioButton(CONCAT("Audio##_", _this->name), _this->recMode == 1) && _this->recMode != 1) {
|
||||
_this->recMode = 1;
|
||||
}
|
||||
if (_this->recording) { style::endDisabled(); }
|
||||
ImGui::Columns(1, CONCAT("EndRecordModeColumns##_", _this->name), false);
|
||||
|
||||
ImGui::EndGroup();
|
||||
@ -95,16 +126,19 @@ private:
|
||||
if (_this->recMode == 0) {
|
||||
ImGui::PushItemWidth(menuColumnWidth);
|
||||
if (!_this->recording) {
|
||||
if (!_this->pathValid) { style::beginDisabled(); }
|
||||
if (ImGui::Button("Record", ImVec2(menuColumnWidth, 0))) {
|
||||
std::string expandedPath = expandString(std::string(_this->path) + genFileName("/baseband_"));
|
||||
_this->samplesWritten = 0;
|
||||
_this->sampleRate = sigpath::signalPath.getSampleRate();
|
||||
_this->writer = new WavWriter(ROOT_DIR "/recordings/" + genFileName("baseband_"), 16, 2, _this->sampleRate);
|
||||
_this->writer = new WavWriter(expandedPath, 16, 2, _this->sampleRate);
|
||||
_this->iqStream = new dsp::stream<dsp::complex_t>;
|
||||
sigpath::signalPath.bindIQStream(_this->iqStream);
|
||||
_this->workerThread = std::thread(_iqWriteWorker, _this);
|
||||
_this->recording = true;
|
||||
_this->startTime = time(0);
|
||||
}
|
||||
if (!_this->pathValid) { style::endDisabled(); }
|
||||
ImGui::TextColored(ImGui::GetStyleColorVec4(ImGuiCol_Text), "Idle --:--:--");
|
||||
}
|
||||
else {
|
||||
@ -140,15 +174,18 @@ private:
|
||||
ImGui::PopStyleColor(3);
|
||||
}
|
||||
if (!_this->recording) {
|
||||
if (!_this->pathValid) { style::beginDisabled(); }
|
||||
if (ImGui::Button("Record", ImVec2(menuColumnWidth, 0))) {
|
||||
std::string expandedPath = expandString(std::string(_this->path) + genFileName("/audio_"));
|
||||
_this->samplesWritten = 0;
|
||||
_this->sampleRate = sigpath::sinkManager.getStreamSampleRate(_this->selectedStreamName);
|
||||
_this->writer = new WavWriter(ROOT_DIR "/recordings/" + genFileName("audio_"), 16, 2, _this->sampleRate);
|
||||
_this->writer = new WavWriter(expandedPath, 16, 2, _this->sampleRate);
|
||||
_this->audioStream = sigpath::sinkManager.bindStream(_this->selectedStreamName);
|
||||
_this->workerThread = std::thread(_audioWriteWorker, _this);
|
||||
_this->recording = true;
|
||||
_this->startTime = time(0);
|
||||
}
|
||||
if (!_this->pathValid) { style::endDisabled(); }
|
||||
ImGui::TextColored(ImGui::GetStyleColorVec4(ImGuiCol_Text), "Idle --:--:--");
|
||||
}
|
||||
else {
|
||||
@ -202,6 +239,8 @@ private:
|
||||
}
|
||||
|
||||
std::string name;
|
||||
char path[4096];
|
||||
bool pathValid = true;
|
||||
dsp::stream<dsp::stereo_t>* audioStream;
|
||||
dsp::stream<dsp::complex_t>* iqStream;
|
||||
WavWriter* writer;
|
||||
|
@ -21,11 +21,10 @@
|
||||
"fftHeight": 296,
|
||||
"frequency": 99000000,
|
||||
"max": 0.0,
|
||||
"maximized": true,
|
||||
"maximized": false,
|
||||
"menuOrder": [
|
||||
"Source",
|
||||
"Radio 1",
|
||||
"Radio 2",
|
||||
"Radio",
|
||||
"Recorder",
|
||||
"Sinks",
|
||||
"Audio",
|
||||
@ -34,10 +33,10 @@
|
||||
"Display"
|
||||
],
|
||||
"menuWidth": 300,
|
||||
"min": -53.676475524902344,
|
||||
"min": -72.05882263183594,
|
||||
"offset": 0.0,
|
||||
"showWaterfall": true,
|
||||
"source": "SoapySDR",
|
||||
"source": "PlutoSDR",
|
||||
"sourceSettings": {},
|
||||
"streams": {
|
||||
"Radio": {
|
||||
|
@ -1,6 +1,5 @@
|
||||
{
|
||||
"Radio 1": "./radio/Release/radio.dll",
|
||||
"Radio 2": "./radio/Release/radio.dll",
|
||||
"Radio": "./radio/Release/radio.dll",
|
||||
"Recorder": "./recorder/Release/recorder.dll",
|
||||
"Soapy": "./soapy/Release/soapy.dll",
|
||||
"RTLTCPSource": "./rtl_tcp_source/Release/rtl_tcp_source.dll",
|
||||
|
@ -2,5 +2,5 @@
|
||||
"IP": "192.168.2.1",
|
||||
"gain": 0.0,
|
||||
"gainMode": 2,
|
||||
"sampleRate": 4000000.0
|
||||
"sampleRate": 2000000.0
|
||||
}
|
Loading…
Reference in New Issue
Block a user