Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::view::AudioInspectorWindow Class Reference

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 &registry)
 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".

Detailed Description

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.

Member Typedef Documentation

◆ HostFactory

Initial value:
std::function<std::unique_ptr<WindowHost>(View& root, const WindowOptions& options)>
Definition view.hpp:73
Definition window_host.hpp:29

Constructor & Destructor Documentation

◆ AudioInspectorWindow() [1/2]

pulp::view::AudioInspectorWindow::AudioInspectorWindow ( WindowManager * mgr = nullptr,
WindowHost * parent = nullptr,
HostFactory host_factory = {},
std::string app_name = "Pulp" )
explicit
Parameters
mgrOptional WindowManager for registration.
parentOptional parent WindowHost (positions relative to it).
host_factoryOptional host creation override for tests / embedders.

◆ ~AudioInspectorWindow()

pulp::view::AudioInspectorWindow::~AudioInspectorWindow ( )

◆ AudioInspectorWindow() [2/2]

pulp::view::AudioInspectorWindow::AudioInspectorWindow ( const AudioInspectorWindow & )
delete

Member Function Documentation

◆ hide()

void pulp::view::AudioInspectorWindow::hide ( )

◆ is_visible()

bool pulp::view::AudioInspectorWindow::is_visible ( ) const

◆ mode()

AudioInspectorMode pulp::view::AudioInspectorWindow::mode ( ) const
inline

◆ operator=()

AudioInspectorWindow & pulp::view::AudioInspectorWindow::operator= ( const AudioInspectorWindow & )
delete

◆ panel()

const AudioInspectorPanel & pulp::view::AudioInspectorWindow::panel ( ) const
inline

Panel accessor — for headless state assertions.

◆ poll()

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).

◆ probe()

audio::AudioProbe * pulp::view::AudioInspectorWindow::probe ( ) const
inline

◆ register_command_handler()

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).

◆ set_device_stats()

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.

◆ set_mode()

void pulp::view::AudioInspectorWindow::set_mode ( AudioInspectorMode mode)

◆ set_preferences()

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.

◆ set_probe()

void pulp::view::AudioInspectorWindow::set_probe ( audio::AudioProbe * probe)

Point the window at a probe to observe.

May be null (clears the source and the next poll() shows the "no probe" state). The probe must outlive this window, or be cleared first. Resets stale tracking so the first poll() after a swap is judged fresh.

◆ show()

void pulp::view::AudioInspectorWindow::show ( )

◆ toggle()

void pulp::view::AudioInspectorWindow::toggle ( )

◆ window_host()

WindowHost * pulp::view::AudioInspectorWindow::window_host ( ) const
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.

Member Data Documentation

◆ kToggleAudioInspector

CommandID pulp::view::AudioInspectorWindow::kToggleAudioInspector = 0x504C4149
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.


The documentation for this class was generated from the following file: