Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::gpu_audio::GpuAudioNode Class Referenceabstract

A unit of audio work the transport schedules onto a non-real-time worker. More...

#include <gpu_audio_node.hpp>

Public Member Functions

virtual ~GpuAudioNode ()=default
virtual GpuAudioNodeDescriptor descriptor () const =0
virtual bool prepare ()=0
 Non-RT. Allocate/compile/upload static data here.
virtual bool cpu_fallback_prepared () const noexcept
 Host-thread witness that the realtime CPU fallback is already built before prepare() returns.
virtual void process_block (const audio::BufferView< const float > &input, audio::BufferView< float > &output, uint32_t n)=0
 Non-RT worker context. Process exactly one block (n == block_size).
virtual void prime_fallback (const audio::BufferView< const float > &, uint32_t) noexcept
 RT-safe.
virtual void process_cpu_fallback (const audio::BufferView< const float > &input, audio::BufferView< float > &output, uint32_t n) noexcept
 RT-safe fallback.
virtual GpuAudioStatus status_snapshot () const noexcept
 Host/UI thread.
virtual bool release_bounded (std::uint64_t) noexcept
 Host thread, audio stopped.
virtual bool bind_realtime_path (detail::RealtimeGpuNodeBinding &) noexcept
 Private transport hook, not for node authors: a node that the GPU audio transport drives through a stamped realtime path describes that path here.

Detailed Description

A unit of audio work the transport schedules onto a non-real-time worker.

Lifecycle:

  • descriptor() / prepare() / release(): host thread, audio stopped.
  • process_block(): the NON-real-time worker thread. May touch the GPU, allocate scratch prepared in prepare(), and block on readback. It must NOT be called from the audio callback.
  • process_cpu_fallback(): real-time-safe; used by the transport for the CpuFallback miss policy. Required when the descriptor opts into that policy and cpu_fallback_prepared() witnesses a prepared fallback.

Constructor & Destructor Documentation

◆ ~GpuAudioNode()

virtual pulp::gpu_audio::GpuAudioNode::~GpuAudioNode ( )
virtualdefault

Member Function Documentation

◆ bind_realtime_path()

virtual bool pulp::gpu_audio::GpuAudioNode::bind_realtime_path ( detail::RealtimeGpuNodeBinding & )
inlinevirtualnoexcept

Private transport hook, not for node authors: a node that the GPU audio transport drives through a stamped realtime path describes that path here.

Returns false for a node the transport drives through its staged worker path, which is the default.

Reimplemented in pulp::gpu_audio::GpuConvolver, pulp::gpu_audio::GpuNeuralRealtimeNode, and pulp::gpu_audio::GpuWaveNetRealtimeNode.

◆ cpu_fallback_prepared()

virtual bool pulp::gpu_audio::GpuAudioNode::cpu_fallback_prepared ( ) const
inlinevirtualnoexcept

Host-thread witness that the realtime CPU fallback is already built before prepare() returns.

A descriptor's supports_cpu_fallback bit is only a declaration; the transport admits MissPolicy::CpuFallback after both the declaration and this prepared witness are true. Nodes with no verified fallback remain fail-closed and must use silence on a miss.

Reimplemented in pulp::gpu_audio::GpuConvolver, and pulp::gpu_audio::GpuNeuralRealtimeNode.

◆ descriptor()

◆ prepare()

virtual bool pulp::gpu_audio::GpuAudioNode::prepare ( )
pure virtual

◆ prime_fallback()

virtual void pulp::gpu_audio::GpuAudioNode::prime_fallback ( const audio::BufferView< const float > & ,
uint32_t  )
inlinevirtualnoexcept

RT-safe.

Called by the transport on EVERY block (not just misses) for a CpuFallback node, BEFORE the output-ring read, so the node's CPU fallback can be kept continuously fed and its convolution history is always current the moment a miss makes it take over. A node whose fallback needs no live priming (the default) does nothing. MUST NOT allocate, lock, or block.

Reimplemented in pulp::gpu_audio::GpuConvolver.

◆ process_block()

virtual void pulp::gpu_audio::GpuAudioNode::process_block ( const audio::BufferView< const float > & input,
audio::BufferView< float > & output,
uint32_t n )
pure virtual

Non-RT worker context. Process exactly one block (n == block_size).

Implemented in pulp::gpu_audio::GpuConvolver, and pulp::gpu_audio::GpuMultiConvolver.

◆ process_cpu_fallback()

virtual void pulp::gpu_audio::GpuAudioNode::process_cpu_fallback ( const audio::BufferView< const float > & input,
audio::BufferView< float > & output,
uint32_t n )
inlinevirtualnoexcept

RT-safe fallback.

MUST NOT allocate, lock, or block — it runs on the audio thread for the CpuFallback miss policy (hence noexcept). The default copies the current dry input to the output. The transport's output is delayed by latency_blocks, so that dry block breaks the timeline; it is not a safe fallback. A CpuFallback node should override this with a primed, latency-aligned fallback, or declare Silence. When paired with prime_fallback(), this emits the latency-aligned block the continuously-fed fallback has already computed.

Reimplemented in pulp::gpu_audio::GpuConvolver, and pulp::gpu_audio::GpuMultiConvolver.

◆ release_bounded()

virtual bool pulp::gpu_audio::GpuAudioNode::release_bounded ( std::uint64_t )
inlinevirtualnoexcept

Host thread, audio stopped.

Release provider resources within budget_ns, returning false if teardown had to be abandoned to stay in budget. The default holds nothing to release.

Reimplemented in pulp::gpu_audio::GpuWaveNetRealtimeNode.

◆ status_snapshot()

virtual GpuAudioStatus pulp::gpu_audio::GpuAudioNode::status_snapshot ( ) const
inlinevirtualnoexcept

Host/UI thread.

Allocation-free health snapshot. The default reports an uninitialized provider; nodes that track their provider override it.

Reimplemented in pulp::gpu_audio::GpuConvolver, pulp::gpu_audio::GpuMultiConvolver, pulp::gpu_audio::GpuNeuralRealtimeNode, and pulp::gpu_audio::GpuWaveNetRealtimeNode.


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