Floating Audio Inspector window. More...
#include <audio_inspector_window.hpp>
Public Types | |
| using | HostFactory |
Public Member Functions | |
| AudioInspectorWindow (WindowManager *mgr=nullptr, WindowHost *parent=nullptr, HostFactory host_factory={}, std::string app_name="Pulp") | |
| ~AudioInspectorWindow () | |
| AudioInspectorWindow (const AudioInspectorWindow &)=delete | |
| AudioInspectorWindow & | operator= (const AudioInspectorWindow &)=delete |
| void | set_probe (audio::AudioProbe *probe) |
| Point the window at a probe to observe. | |
| audio::AudioProbe * | probe () const |
| void | set_device_stats (const audio::AudioStats &device_stats) |
| Mirror device/backend counters the probe must NOT shadow (xruns, overloads). | |
| void | poll () |
| Poll the probe once: read the latest snapshot, detect stale (sequence not advancing), copy any captured waveform, and refresh the panel. | |
| void | show () |
| void | hide () |
| void | toggle () |
| bool | is_visible () const |
| void | register_command_handler (CommandRegistry ®istry) |
| Register the toggle command (kToggleAudioInspector, default chord Cmd+Shift+A / Ctrl+Shift+A) with a caller-owned CommandRegistry. | |
| const AudioInspectorPanel & | panel () const |
| Panel accessor — for headless state assertions. | |
| void | set_mode (AudioInspectorMode mode) |
| AudioInspectorMode | mode () const |
| void | set_preferences (state::PropertiesFile *preferences) |
| Optional test/embedding hook. | |
| WindowHost * | window_host () const |
| The window's own WindowHost, or null until show() has created one (and after a host_factory that returned null). | |
Static Public Attributes | |
| static constexpr CommandID | kToggleAudioInspector = 0x504C4149 |
| Command id for "Toggle Audio Inspector". | |
Floating Audio Inspector window.
Construct, point it at an AudioProbe (optional — without one it shows the honest "no probe" state), register its toggle command, and call poll() from the UI timer to refresh.
|
explicit |
| mgr | Optional WindowManager for registration. |
| parent | Optional parent WindowHost (positions relative to it). |
| host_factory | Optional host creation override for tests / embedders. |
| pulp::view::AudioInspectorWindow::~AudioInspectorWindow | ( | ) |
|
delete |
| void pulp::view::AudioInspectorWindow::hide | ( | ) |
| bool pulp::view::AudioInspectorWindow::is_visible | ( | ) | const |
|
inline |
|
delete |
|
inline |
Panel accessor — for headless state assertions.
| void pulp::view::AudioInspectorWindow::poll | ( | ) |
Poll the probe once: read the latest snapshot, detect stale (sequence not advancing), copy any captured waveform, and refresh the panel.
Safe to call when hidden or when no probe is set. Reads AudioProbe::latest() exactly once per call (single-consumer TripleBuffer contract).
|
inline |
| void pulp::view::AudioInspectorWindow::register_command_handler | ( | CommandRegistry & | registry | ) |
Register the toggle command (kToggleAudioInspector, default chord Cmd+Shift+A / Ctrl+Shift+A) with a caller-owned CommandRegistry.
RAII: the handler is removed in the destructor, so dispatch after this window is destroyed finds no handler and returns false. The registry must outlive this window. Re-registering moves the handler to the new registry. Does NOT touch on_global_key — the shell routes the root key path once with route_global_keys(root, registry).
| void pulp::view::AudioInspectorWindow::set_device_stats | ( | const audio::AudioStats & | device_stats | ) |
Mirror device/backend counters the probe must NOT shadow (xruns, overloads).
The host owns these (see audio_stats.hpp); the window just displays them alongside the probe-owned signal counters.
| void pulp::view::AudioInspectorWindow::set_mode | ( | AudioInspectorMode | mode | ) |
| void pulp::view::AudioInspectorWindow::set_preferences | ( | state::PropertiesFile * | preferences | ) |
Optional test/embedding hook.
Production windows use ApplicationProperties, but tests can inject an in-memory PropertiesFile to assert persistence without touching user preference paths.
| void pulp::view::AudioInspectorWindow::set_probe | ( | audio::AudioProbe * | probe | ) |
| void pulp::view::AudioInspectorWindow::show | ( | ) |
| void pulp::view::AudioInspectorWindow::toggle | ( | ) |
|
inline |
The window's own WindowHost, or null until show() has created one (and after a host_factory that returned null).
Exposed so a headless host can capture_png() the inspector's surface for a screenshot proof, the same way the standalone host captures its main window. Ownership stays with this window — the caller must not retain the pointer past the window's lifetime.
|
staticconstexpr |
Command id for "Toggle Audio Inspector".
Stable so apps can reference it from menus or a KeyMappingEditor. ASCII 'PLAI' — distinct from the layout inspector's 'PLPI' so the two tools never collide.