How andruxa-smirnov/signalhound_spectrum_analyzer works
Project Type and Purpose
• This is a Windows-only, Qt5 C++ desktop application (“Spike Spectrum Analysis Software”) that drives Signal Hound spectrum analyzers.
• It provides a rich GUI (Qt widgets and OpenGL views), interacts with the hardware via the Signal Hound C++ API (sa_api.dll), and performs DSP (FFT via kiss_fft) to render spectrum, phase noise, demodulation, and other plots.
High-Level Components
a. External Hardware & API
• Signal Hound Spectrum Analyzer Device
• sa_api.dll / sa_api.lib (C++ DLL interface)
b. Core Library Layer (BBApp/src/lib)
• bb_lib.cpp/h, device_traits, threadsafe_queue, time_type, etc.
• Wraps sa_api calls, manages raw IQ/sample data, threading, queuing
c. DSP Engine (BBApp/src/src/kiss_fft)
• kiss_fft routines, test harnesses, tools
d. Application Model (BBApp/src/model)
• Domain objects: Device, Session, TraceManager, Settings, Persistence
• Encapsulates application state, audio/demodulation/sweep parameters
e. Presentation Layer
• Views (BBApp/src/views): OpenGL plots, central “controllers” for each measurement type
• Widgets (BBApp/src/widgets): dialog panels, controls, toolbars, status bar
f. Entry Point & Qt Integration
• main.cpp and MainWindow (BBApp/src/main.cpp, mainwindow.cpp/h)
g. Build System
• Qt .pro file, generated Makefiles, link against sa_api.lib and bb_api.lib
Relationships and Data Flows
• On startup, main() and MainWindow initialize the Model and UI
• User interacts with Widgets → Model settings update (e.g., sweep_settings, demod_settings)
• Model instructs Core Library to open device via sa_api
• Core Library spawns data‐acquisition thread → continuous raw samples from hardware
• Raw data sent through threadsafe_queue → DSP Engine (kiss_fft) transforms to frequency domain
• Processed data pushed to TraceManager → notifies Views to repaint OpenGL widgets
• Views pull data from TraceManager & Model, render plots, and send user commands back to Model
Architectural Patterns & Principles
• MVC / MVVM-style separation:
• Model layer holds state and business logic
• Views/widgets present data and capture user input
• Core Library abstracts hardware and DSP details
• Threading & Concurrency
• Data acquisition and UI run in separate threads
• threadsafe_queue ensures lock-free data exchange
• Plugin-like extensibility
• Adding new measurement types only requires new Model + View components