mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-11-10 04:37:37 +01:00
Fixed VFO alignment
This commit is contained in:
parent
6e5450ed24
commit
71f6be8d08
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
namespace sourecmenu {
|
namespace sourecmenu {
|
||||||
int sourceId = 0;
|
int sourceId = 0;
|
||||||
|
double freqOffset = 0.0;
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
// Select default
|
// Select default
|
||||||
@ -13,6 +14,7 @@ namespace sourecmenu {
|
|||||||
if (sigpath::sourceManager.sourceNames.size() > 0) {
|
if (sigpath::sourceManager.sourceNames.size() > 0) {
|
||||||
sigpath::sourceManager.selectSource(sigpath::sourceManager.sourceNames[0]);
|
sigpath::sourceManager.selectSource(sigpath::sourceManager.sourceNames[0]);
|
||||||
}
|
}
|
||||||
|
sigpath::sourceManager.setTuningOffset(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw(void* ctx) {
|
void draw(void* ctx) {
|
||||||
@ -29,5 +31,9 @@ namespace sourecmenu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sigpath::sourceManager.showSelectedMenu();
|
sigpath::sourceManager.showSelectedMenu();
|
||||||
|
ImGui::SetNextItemWidth(itemWidth - ImGui::CalcTextSize("Offset (Hz)").x - 10);
|
||||||
|
if (ImGui::InputDouble("Offset (Hz)##freq_offset", &freqOffset, 1.0, 100.0)) {
|
||||||
|
sigpath::sourceManager.setTuningOffset(freqOffset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -230,7 +230,9 @@ namespace ImGui {
|
|||||||
int refCenter = mousePos.x - (widgetPos.x + 50);
|
int refCenter = mousePos.x - (widgetPos.x + 50);
|
||||||
if (refCenter >= 0 && refCenter < dataWidth && mousePos.y > widgetPos.y && mousePos.y < (widgetPos.y + widgetSize.y)) {
|
if (refCenter >= 0 && refCenter < dataWidth && mousePos.y > widgetPos.y && mousePos.y < (widgetPos.y + widgetSize.y)) {
|
||||||
double off = ((((double)refCenter / ((double)dataWidth / 2.0)) - 1.0) * (viewBandwidth / 2.0)) + viewOffset;
|
double off = ((((double)refCenter / ((double)dataWidth / 2.0)) - 1.0) * (viewBandwidth / 2.0)) + viewOffset;
|
||||||
vfo->setOffset(round(off / vfo->snapInterval) * vfo->snapInterval);
|
off += centerFreq;
|
||||||
|
off = (round(off / vfo->snapInterval) * vfo->snapInterval) - centerFreq;
|
||||||
|
vfo->setOffset(off);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +241,9 @@ namespace ImGui {
|
|||||||
int refCenter = mousePos.x - (widgetPos.x + 50);
|
int refCenter = mousePos.x - (widgetPos.x + 50);
|
||||||
if (refCenter >= 0 && refCenter < dataWidth && mousePos.y > widgetPos.y && mousePos.y < (widgetPos.y + widgetSize.y)) {
|
if (refCenter >= 0 && refCenter < dataWidth && mousePos.y > widgetPos.y && mousePos.y < (widgetPos.y + widgetSize.y)) {
|
||||||
double off = ((((double)refCenter / ((double)dataWidth / 2.0)) - 1.0) * (viewBandwidth / 2.0)) + viewOffset;
|
double off = ((((double)refCenter / ((double)dataWidth / 2.0)) - 1.0) * (viewBandwidth / 2.0)) + viewOffset;
|
||||||
vfo->setOffset(round(off / vfo->snapInterval) * vfo->snapInterval);
|
off += centerFreq;
|
||||||
|
off = (round(off / vfo->snapInterval) * vfo->snapInterval) - centerFreq;
|
||||||
|
vfo->setOffset(off);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -797,5 +801,9 @@ namespace ImGui {
|
|||||||
void WaterFall::hideBandplan() {
|
void WaterFall::hideBandplan() {
|
||||||
bandplanVisible = false;
|
bandplanVisible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WaterfallVFO::setSnapInterval(double interval) {
|
||||||
|
snapInterval = interval;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ namespace ImGui {
|
|||||||
void setCenterOffset(double offset);
|
void setCenterOffset(double offset);
|
||||||
void setBandwidth(double bw);
|
void setBandwidth(double bw);
|
||||||
void setReference(int ref);
|
void setReference(int ref);
|
||||||
|
void setSnapInterval(double interval);
|
||||||
void updateDrawingVars(double viewBandwidth, float dataWidth, double viewOffset, ImVec2 widgetPos, int fftHeight); // NOTE: Datawidth double???
|
void updateDrawingVars(double viewBandwidth, float dataWidth, double viewOffset, ImVec2 widgetPos, int fftHeight); // NOTE: Datawidth double???
|
||||||
void draw(ImGuiWindow* window, bool selected);
|
void draw(ImGuiWindow* window, bool selected);
|
||||||
|
|
||||||
|
@ -54,5 +54,11 @@ void SourceManager::tune(double freq) {
|
|||||||
if (selectedHandler == NULL) {
|
if (selectedHandler == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
selectedHandler->tuneHandler(freq, selectedHandler->ctx);
|
selectedHandler->tuneHandler(freq + tuneOffset, selectedHandler->ctx);
|
||||||
|
currentFreq = freq;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SourceManager::setTuningOffset(double offset) {
|
||||||
|
tuneOffset = offset;
|
||||||
|
tune(currentFreq);
|
||||||
}
|
}
|
@ -26,6 +26,7 @@ public:
|
|||||||
void start();
|
void start();
|
||||||
void stop();
|
void stop();
|
||||||
void tune(double freq);
|
void tune(double freq);
|
||||||
|
void setTuningOffset(double offset);
|
||||||
|
|
||||||
std::vector<std::string> sourceNames;
|
std::vector<std::string> sourceNames;
|
||||||
|
|
||||||
@ -33,5 +34,7 @@ private:
|
|||||||
std::map<std::string, SourceHandler*> sources;
|
std::map<std::string, SourceHandler*> sources;
|
||||||
std::string selectedName;
|
std::string selectedName;
|
||||||
SourceHandler* selectedHandler = NULL;
|
SourceHandler* selectedHandler = NULL;
|
||||||
|
double tuneOffset;
|
||||||
|
double currentFreq;
|
||||||
|
|
||||||
};
|
};
|
@ -124,6 +124,10 @@ private:
|
|||||||
ImGui::SliderFloat(CONCAT("##_squelch_select_", _this->name), &_this->sigPath.squelch.level, -100, 0);
|
ImGui::SliderFloat(CONCAT("##_squelch_select_", _this->name), &_this->sigPath.squelch.level, -100, 0);
|
||||||
|
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
|
|
||||||
|
ImGui::Text("Snap Interval");
|
||||||
|
ImGui::SetNextItemWidth(menuColumnWidth - ImGui::GetCursorPosX());
|
||||||
|
if (ImGui:)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void scriptCreateHandler(void* ctx, duk_context* dukCtx, duk_idx_t objId) {
|
static void scriptCreateHandler(void* ctx, duk_context* dukCtx, duk_idx_t objId) {
|
||||||
@ -315,6 +319,7 @@ private:
|
|||||||
int bandWidth;
|
int bandWidth;
|
||||||
int bandWidthMin;
|
int bandWidthMin;
|
||||||
int bandWidthMax;
|
int bandWidthMax;
|
||||||
|
double snapInterval = 100000.0;
|
||||||
SigPath sigPath;
|
SigPath sigPath;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -1,43 +1,43 @@
|
|||||||
{
|
{
|
||||||
"audio": {
|
"audio": {
|
||||||
"Radio": {
|
"Radio": {
|
||||||
"device": "Speakers (Realtek High Definiti",
|
"device": "Speakers (Realtek High Definiti",
|
||||||
"sampleRate": 48000.0,
|
"sampleRate": 48000.0,
|
||||||
"volume": 0.60546875
|
"volume": 0.60546875
|
||||||
},
|
},
|
||||||
"Radio 1": {
|
"Radio 1": {
|
||||||
"device": "CABLE-A Input (VB-Audio Cable A)",
|
"device": "CABLE-A Input (VB-Audio Cable A)",
|
||||||
"sampleRate": 48000.0,
|
"sampleRate": 48000.0,
|
||||||
"volume": 1.0
|
"volume": 1.0
|
||||||
},
|
},
|
||||||
"Radio 2": {
|
"Radio 2": {
|
||||||
"device": "CABLE Input (VB-Audio Virtual Cable)",
|
"device": "CABLE Input (VB-Audio Virtual Cable)",
|
||||||
"sampleRate": 48000.0,
|
"sampleRate": 48000.0,
|
||||||
"volume": 1.0
|
"volume": 1.0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"bandPlan": "General",
|
"bandPlan": "General",
|
||||||
"bandPlanEnabled": true,
|
"bandPlanEnabled": true,
|
||||||
"fftHeight": 300,
|
"fftHeight": 300,
|
||||||
"frequency": 98983691,
|
"frequency": 99015000,
|
||||||
"max": 0.0,
|
"max": 0.0,
|
||||||
"maximized": false,
|
"maximized": false,
|
||||||
"menuOrder": [
|
"menuOrder": [
|
||||||
"Source",
|
"Source",
|
||||||
"Radio",
|
"Radio",
|
||||||
"Recorder",
|
"Recorder",
|
||||||
"Audio",
|
"Audio",
|
||||||
"Scripting",
|
"Scripting",
|
||||||
"Band Plan",
|
"Band Plan",
|
||||||
"Display"
|
"Display"
|
||||||
],
|
],
|
||||||
"menuWidth": 300,
|
"menuWidth": 300,
|
||||||
"min": -72.05882263183594,
|
"min": -72.05882263183594,
|
||||||
"showWaterfall": true,
|
"showWaterfall": true,
|
||||||
"source": "",
|
"source": "",
|
||||||
"sourceSettings": {},
|
"sourceSettings": {},
|
||||||
"windowSize": {
|
"windowSize": {
|
||||||
"h": 720,
|
"h": 1053,
|
||||||
"w": 1280
|
"w": 959
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"Radio": "./radio/Release/radio.dll",
|
"Radio": "./radio/radio.so",
|
||||||
"Recorder": "./recorder/Release/recorder.dll",
|
"Recorder": "./recorder/recorder.so",
|
||||||
"Soapy": "./soapy/Release/soapy.dll",
|
"Soapy": "./soapy/soapy.so",
|
||||||
"RTLTCPSource": "./rtl_tcp_source/Release/rtl_tcp_source.dll",
|
"RTLTCPSource": "./rtl_tcp_source/rtl_tcp_source.so"
|
||||||
"FileSource": "./file_source/Release/file_source.dll"
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user