mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-01-28 02:24:45 +01:00
Fixed wrong bandwidth when zooming
This commit is contained in:
parent
68b3eb9b21
commit
012903fbf4
@ -78,7 +78,7 @@ namespace core {
|
|||||||
gui::waterfall.setViewOffset(0);
|
gui::waterfall.setViewOffset(0);
|
||||||
gui::waterfall.setViewBandwidth(effectiveSr);
|
gui::waterfall.setViewBandwidth(effectiveSr);
|
||||||
sigpath::signalPath.setSampleRate(effectiveSr);
|
sigpath::signalPath.setSampleRate(effectiveSr);
|
||||||
gui::mainWindow.setViewBandwidthSlider(effectiveSr);
|
gui::mainWindow.setViewBandwidthSlider(1.0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ void MainWindow::init() {
|
|||||||
gui::freqSelect.frequencyChanged = false;
|
gui::freqSelect.frequencyChanged = false;
|
||||||
sigpath::sourceManager.tune(frequency);
|
sigpath::sourceManager.tune(frequency);
|
||||||
gui::waterfall.setCenterFrequency(frequency);
|
gui::waterfall.setCenterFrequency(frequency);
|
||||||
bw = gui::waterfall.getBandwidth();
|
bw = 1.0;
|
||||||
gui::waterfall.vfoFreqChanged = false;
|
gui::waterfall.vfoFreqChanged = false;
|
||||||
gui::waterfall.centerFreqMoved = false;
|
gui::waterfall.centerFreqMoved = false;
|
||||||
gui::waterfall.selectFirstVFO();
|
gui::waterfall.selectFirstVFO();
|
||||||
@ -598,12 +598,14 @@ void MainWindow::draw() {
|
|||||||
ImGui::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - (ImGui::CalcTextSize("Zoom").x / 2.0));
|
ImGui::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - (ImGui::CalcTextSize("Zoom").x / 2.0));
|
||||||
ImGui::Text("Zoom");
|
ImGui::Text("Zoom");
|
||||||
ImGui::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - 10);
|
ImGui::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - 10);
|
||||||
float minSliderBw = 1000.0;
|
if (ImGui::VSliderFloat("##_7_", ImVec2(20.0, 150.0), &bw, 1.0, 0.0, "")) {
|
||||||
float maxSliderBw = gui::waterfall.getBandwidth();
|
double factor = (double)bw * (double)bw;
|
||||||
if (ImGui::VSliderFloat("##_7_", ImVec2(20.0, 150.0), &bw, maxSliderBw, minSliderBw, "")) {
|
|
||||||
float normBw = bw / (maxSliderBw - minSliderBw);
|
// Map 0.0 -> 1.0 to 1000.0 -> bandwidth
|
||||||
float factor = normBw * normBw;
|
double delta = gui::waterfall.getBandwidth() - 1000.0;
|
||||||
float finalBw = minSliderBw + bw * factor;
|
double finalBw = 1000.0 + (factor * delta);
|
||||||
|
|
||||||
|
spdlog::warn("{0} {1} {2}", bw, factor, finalBw);
|
||||||
|
|
||||||
gui::waterfall.setViewBandwidth(finalBw);
|
gui::waterfall.setViewBandwidth(finalBw);
|
||||||
if (vfo != NULL) {
|
if (vfo != NULL) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user