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

#include <standalone.hpp>

Public Member Functions

 StandaloneApp (ProcessorFactory factory)
 ~StandaloneApp ()
void set_config (const StandaloneConfig &config)
const StandaloneConfig & config () const
bool start ()
void stop ()
bool is_running () const
std::uint64_t audio_xrun_count () const
bool run_with_editor (bool use_gpu=false)
void set_open_files_handler (std::function< void(const std::vector< std::string > &)> handler)
 Install a handler for files the OS asks this app to open — a Finder double-click, a drag onto the app icon, or open -a.
bool apply_config (const StandaloneConfig &new_config)
 Restart audio with a new config (stop → reconfigure → start).
Processor * processor ()
state::StateStore & state ()
bool audio_skipped_for_capture () const
 True when this launch skipped the audio backend entirely because it is a screenshot-only capture (see StandaloneConfig::screenshot_keeps_audio).
TestSignalSource & test_signal ()
view::AudioBridge & input_meter_bridge ()
view::AudioBridge & output_meter_bridge ()
audio::AudioSystem * audio_system ()
midi::MidiSystem * midi_system ()
midi::MidiMessageCollector & ui_midi_collector ()
detail::StandaloneTestInputHost & test_input_host ()
const detail::StandaloneTestInputHost & test_input_host () const
void service_state_persistence (std::chrono::steady_clock::time_point now=std::chrono::steady_clock::now())
 Main thread only.
bool save_plugin_state_now ()
 Main thread only.
bool plugin_state_persistence_active () const noexcept
 True when this run restores and saves the plug-in state (see StandaloneConfig::persist_plugin_state).
std::uint32_t plugin_state_save_count () const noexcept
 How many times this run has written the plug-in state to the settings file.

Static Public Member Functions

static StandaloneConfig load_persisted_config (std::string_view app_name, StandaloneConfig base={})
static bool save_persisted_config (std::string_view app_name, const StandaloneConfig &config)
static std::optional< std::vector< uint8_t > > load_persisted_state (std::string_view app_name)
static bool save_persisted_state (std::string_view app_name, std::span< const uint8_t > blob)

Static Public Attributes

static constexpr std::size_t kMaxPersistedStateBytes = 8u * 1024u * 1024u

Friends

struct StandaloneRenderTestAccess
struct StandaloneAudioDeviceTestAccess

Constructor & Destructor Documentation

◆ StandaloneApp()

pulp::format::StandaloneApp::StandaloneApp ( ProcessorFactory factory)
explicit

◆ ~StandaloneApp()

pulp::format::StandaloneApp::~StandaloneApp ( )

Member Function Documentation

◆ apply_config()

bool pulp::format::StandaloneApp::apply_config ( const StandaloneConfig & new_config)

Restart audio with a new config (stop → reconfigure → start).

◆ audio_skipped_for_capture()

bool pulp::format::StandaloneApp::audio_skipped_for_capture ( ) const
inline

True when this launch skipped the audio backend entirely because it is a screenshot-only capture (see StandaloneConfig::screenshot_keeps_audio).

No audio system, no device, and no render callback exist for such a run, so a headless capture never opens an audio device on the host machine.

◆ audio_system()

audio::AudioSystem * pulp::format::StandaloneApp::audio_system ( )
inline

◆ audio_xrun_count()

std::uint64_t pulp::format::StandaloneApp::audio_xrun_count ( ) const
inline

◆ config()

const StandaloneConfig & pulp::format::StandaloneApp::config ( ) const
inline

◆ input_meter_bridge()

view::AudioBridge & pulp::format::StandaloneApp::input_meter_bridge ( )
inline

◆ is_running()

bool pulp::format::StandaloneApp::is_running ( ) const
inline

◆ load_persisted_config()

StandaloneConfig pulp::format::StandaloneApp::load_persisted_config ( std::string_view app_name,
StandaloneConfig base = {} )
static

◆ load_persisted_state()

std::optional< std::vector< uint8_t > > pulp::format::StandaloneApp::load_persisted_state ( std::string_view app_name)
static

◆ midi_system()

midi::MidiSystem * pulp::format::StandaloneApp::midi_system ( )
inline

◆ output_meter_bridge()

view::AudioBridge & pulp::format::StandaloneApp::output_meter_bridge ( )
inline

◆ plugin_state_persistence_active()

bool pulp::format::StandaloneApp::plugin_state_persistence_active ( ) const
inlinenoexcept

True when this run restores and saves the plug-in state (see StandaloneConfig::persist_plugin_state).

Valid after start().

◆ plugin_state_save_count()

std::uint32_t pulp::format::StandaloneApp::plugin_state_save_count ( ) const
inlinenoexcept

How many times this run has written the plug-in state to the settings file.

◆ processor()

Processor * pulp::format::StandaloneApp::processor ( )
inline

◆ run_with_editor()

bool pulp::format::StandaloneApp::run_with_editor ( bool use_gpu = false)

◆ save_persisted_config()

bool pulp::format::StandaloneApp::save_persisted_config ( std::string_view app_name,
const StandaloneConfig & config )
static

◆ save_persisted_state()

bool pulp::format::StandaloneApp::save_persisted_state ( std::string_view app_name,
std::span< const uint8_t > blob )
static

◆ save_plugin_state_now()

bool pulp::format::StandaloneApp::save_plugin_state_now ( )

Main thread only.

Saves the plug-in state now when persistence is active. Returns true when it wrote the file. Called on quit.

◆ service_state_persistence()

void pulp::format::StandaloneApp::service_state_persistence ( std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now())

Main thread only.

Saves the plug-in state when it has changed and then stayed unchanged for state_save_debounce_ms. The built-in editors call this from their idle loop; a host that runs its own loop calls it a few times a second. Cheap when nothing changed. now is a test seam.

◆ set_config()

void pulp::format::StandaloneApp::set_config ( const StandaloneConfig & config)
inline

◆ set_open_files_handler()

void pulp::format::StandaloneApp::set_open_files_handler ( std::function< void(const std::vector< std::string > &)> handler)
inline

Install a handler for files the OS asks this app to open — a Finder double-click, a drag onto the app icon, or open -a.

Paths arrive on the UI thread.

Set it BEFORE run_with_editor(). The file that launched the app is reported while the event loop is still starting, so a handler installed afterwards would miss the common case; paths that arrive early are held until a handler exists.

Routing is the other half of this. Nothing reaches here unless the app bundle declares the document type — pulp_declare_standalone_document_type() in CMake — so an app that only installs a handler still never opens a file.

◆ start()

bool pulp::format::StandaloneApp::start ( )

◆ state()

state::StateStore & pulp::format::StandaloneApp::state ( )
inline

◆ stop()

void pulp::format::StandaloneApp::stop ( )

◆ test_input_host() [1/2]

detail::StandaloneTestInputHost & pulp::format::StandaloneApp::test_input_host ( )
inline

◆ test_input_host() [2/2]

const detail::StandaloneTestInputHost & pulp::format::StandaloneApp::test_input_host ( ) const
inline

◆ test_signal()

TestSignalSource & pulp::format::StandaloneApp::test_signal ( )
inline

◆ ui_midi_collector()

midi::MidiMessageCollector & pulp::format::StandaloneApp::ui_midi_collector ( )
inline

◆ StandaloneAudioDeviceTestAccess

friend struct StandaloneAudioDeviceTestAccess
friend

◆ StandaloneRenderTestAccess

friend struct StandaloneRenderTestAccess
friend

Member Data Documentation

◆ kMaxPersistedStateBytes

std::size_t pulp::format::StandaloneApp::kMaxPersistedStateBytes = 8u * 1024u * 1024u
staticconstexpr

The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/format/include/pulp/format/standalone.hpp