mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-01-12 19:27:11 +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.setViewBandwidth(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;
|
||||
sigpath::sourceManager.tune(frequency);
|
||||
gui::waterfall.setCenterFrequency(frequency);
|
||||
bw = gui::waterfall.getBandwidth();
|
||||
bw = 1.0;
|
||||
gui::waterfall.vfoFreqChanged = false;
|
||||
gui::waterfall.centerFreqMoved = false;
|
||||
gui::waterfall.selectFirstVFO();
|
||||
@ -598,12 +598,14 @@ void MainWindow::draw() {
|
||||
ImGui::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - (ImGui::CalcTextSize("Zoom").x / 2.0));
|
||||
ImGui::Text("Zoom");
|
||||
ImGui::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - 10);
|
||||
float minSliderBw = 1000.0;
|
||||
float maxSliderBw = gui::waterfall.getBandwidth();
|
||||
if (ImGui::VSliderFloat("##_7_", ImVec2(20.0, 150.0), &bw, maxSliderBw, minSliderBw, "")) {
|
||||
float normBw = bw / (maxSliderBw - minSliderBw);
|
||||
float factor = normBw * normBw;
|
||||
float finalBw = minSliderBw + bw * factor;
|
||||
if (ImGui::VSliderFloat("##_7_", ImVec2(20.0, 150.0), &bw, 1.0, 0.0, "")) {
|
||||
double factor = (double)bw * (double)bw;
|
||||
|
||||
// Map 0.0 -> 1.0 to 1000.0 -> bandwidth
|
||||
double delta = gui::waterfall.getBandwidth() - 1000.0;
|
||||
double finalBw = 1000.0 + (factor * delta);
|
||||
|
||||
spdlog::warn("{0} {1} {2}", bw, factor, finalBw);
|
||||
|
||||
gui::waterfall.setViewBandwidth(finalBw);
|
||||
if (vfo != NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user