summaryrefslogtreecommitdiff
path: root/map65/main.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-09-26 23:24:28 +0200
committerChristoph Berg <myon@debian.org>2026-09-26 23:24:28 +0200
commit69344560ea394c06ca94acac46a2e4c3e8b7b229 (patch)
treeebc98370a697a9bbd6b973a14fa5113c475c6db7 /map65/main.cpp
parent3e9d10a67671d0bd5c7b8c3ca8088f1818322eff (diff)
parent059831534c7e884f0a607ed86b582fd00d821731 (diff)
Update upstream source from tag 'upstream/3.2.0_rc1+dfsg'
Update to upstream version '3.2.0~rc1+dfsg' with Debian dir dbff457fd2c3616d5c77b863c7bfb2186ed86047
Diffstat (limited to 'map65/main.cpp')
-rw-r--r--map65/main.cpp60
1 files changed, 55 insertions, 5 deletions
diff --git a/map65/main.cpp b/map65/main.cpp
index 55ef209a..5c8de1d7 100644
--- a/map65/main.cpp
+++ b/map65/main.cpp
@@ -9,18 +9,25 @@
#include <windows.h>
#endif
-
#include "revision_utils.hpp"
#include "mainwindow.h"
#include "fortran_mutex.hpp"
+#include "globals.h"
+#include "runtime_paths.h"
#include <cstdio>
+extern "C" void set_runtime_params_(int rate_hz, int nfft, int nfft_big);
+
extern "C" {
// Fortran procedures we need
void four2a_ (_Complex float *, int * nfft, int * ndim, int * isign, int * iform, int len);
}
+extern int g_sampleRate;
+extern int active_nfft;
+int g_activeNfft = 32768; // default
+
int main(int argc, char *argv[])
{
#ifdef _WIN32
@@ -37,12 +44,55 @@ int main(int argc, char *argv[])
# endif
#endif
QApplication a {argc, argv};
-
- // Override programs executable basename as application name.
a.setApplicationName ("MAP65");
- a.setApplicationVersion ("3.6");
- // switch off as we share an Info.plist file with WSJT-X
+ a.setApplicationVersion ("3.8.2");
a.setAttribute (Qt::AA_DontUseNativeMenuBar);
+
+ QString appDir = QApplication::applicationDirPath();
+ QString dataDir = writableMap65DataDir();
+ QSettings settings(map65SettingsFile(appDir, dataDir), QSettings::IniFormat);
+ settings.beginGroup("Common");
+ int srFlag = readFSam96000(settings, 1);
+ settings.endGroup();
+ if(srFlag <= 1) g_sampleRate = 96000;
+ else if(srFlag == 2) g_sampleRate = 192000;
+ if (g_sampleRate != 96000 && g_sampleRate != 192000)
+ g_sampleRate = 96000;
+
+// ------------------------------------------------------------
+// NEW: compute active FFT sizes for MAP65
+// ------------------------------------------------------------
+int active_rate = g_sampleRate;
+
+// Keep ~3 Hz bin resolution like WSJT-X/QMAP
+auto round_pow2 = [](int x) {
+ int p = 1;
+ while (p < x) p <<= 1;
+ return p;
+};
+
+// symspec FFT size
+active_nfft = round_pow2(
+ static_cast<int>(
+ static_cast<long long>(BASELINE_NFFT) * active_rate / BASELINE_RATE
+ )
+);
+
+g_activeNfft = active_nfft;
+
+// big FFT size (56 symbols * sample rate)
+int active_nfft_big = 56 * active_rate;
+
+// ------------------------------------------------------------
+// Push runtime parameters into Fortran BEFORE MainWindow starts
+// ------------------------------------------------------------
+set_runtime_params_(active_rate, active_nfft, active_nfft_big);
+
+// ------------------------------------------------------------
+// allocate buffers now that sample rate is known
+// ------------------------------------------------------------
+id.resize(4 * 60 * g_sampleRate);
+
MainWindow w;
w.show ();