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

Read access to the values and meters a processor publishes for its UI. More...

#include <editor_host.hpp>

Public Member Functions

virtual ~VisualPort ()=default
virtual std::size_t channel_count () const noexcept=0
virtual VisualChannelInfo channel (std::size_t index) const noexcept=0
 Description of channel index (< channel_count()).
virtual bool read_scalar (std::size_t index, float &value) noexcept=0
 Latest value of a scalar channel.
virtual std::size_t read_meter (std::size_t index, std::span< float > rms, std::span< float > peak) noexcept=0
 Latest frame of a meter channel into rms and peak.
virtual std::size_t read_vector (std::size_t index, std::span< float > samples) noexcept=0
 Latest block of a vector channel into samples.
virtual std::size_t read_events (std::size_t index, std::span< VisualEvent > events) noexcept=0
 Occurrences of the latest published block of an events channel.
virtual std::uint32_t publish_count (std::size_t index) const noexcept=0
 Monotonic publish count of channel index.
std::optional< std::size_t > find (std::string_view name, VisualChannelShape shape) const noexcept
 Index of the channel called name with shape shape, or nullopt.

Detailed Description

Read access to the values and meters a processor publishes for its UI.

The audio thread publishes, lock-free; this port reads the latest value of each channel. Every channel is latest-wins: a reader that falls behind sees the newest publish, not a history. Reads are lock-free and allocation-free.

One reader thread: all reads through one VisualPort happen on the same thread (normally the editor's frame tick). The channel set is fixed before audio runs, so an index resolved once stays valid.

Constructor & Destructor Documentation

◆ ~VisualPort()

virtual pulp::format::VisualPort::~VisualPort ( )
virtualdefault

Member Function Documentation

◆ channel()

virtual VisualChannelInfo pulp::format::VisualPort::channel ( std::size_t index) const
pure virtualnoexcept

Description of channel index (< channel_count()).

Implemented in pulp::format::ValueChannelVisualPort.

◆ channel_count()

virtual std::size_t pulp::format::VisualPort::channel_count ( ) const
pure virtualnoexcept

◆ find()

std::optional< std::size_t > pulp::format::VisualPort::find ( std::string_view name,
VisualChannelShape shape ) const
inlinenoexcept

Index of the channel called name with shape shape, or nullopt.

◆ publish_count()

virtual std::uint32_t pulp::format::VisualPort::publish_count ( std::size_t index) const
pure virtualnoexcept

Monotonic publish count of channel index.

A reader compares it across ticks to tell "the writer stopped" from "the value held steady".

Implemented in pulp::format::ValueChannelVisualPort.

◆ read_events()

virtual std::size_t pulp::format::VisualPort::read_events ( std::size_t index,
std::span< VisualEvent > events )
pure virtualnoexcept

Occurrences of the latest published block of an events channel.

Returns the number written, or 0 if index is not an events channel.

Implemented in pulp::format::ValueChannelVisualPort.

◆ read_meter()

virtual std::size_t pulp::format::VisualPort::read_meter ( std::size_t index,
std::span< float > rms,
std::span< float > peak )
pure virtualnoexcept

Latest frame of a meter channel into rms and peak.

Returns the number of audio channels the frame carries (possibly more than the spans hold, which are filled up to their size), or 0 if index is not a meter channel.

Implemented in pulp::format::ValueChannelVisualPort.

◆ read_scalar()

virtual bool pulp::format::VisualPort::read_scalar ( std::size_t index,
float & value )
pure virtualnoexcept

Latest value of a scalar channel.

False if index is not a scalar channel or nothing has been published yet.

Implemented in pulp::format::ValueChannelVisualPort.

◆ read_vector()

virtual std::size_t pulp::format::VisualPort::read_vector ( std::size_t index,
std::span< float > samples )
pure virtualnoexcept

Latest block of a vector channel into samples.

Returns the number of samples written, or 0 if index is not a vector channel.

Implemented in pulp::format::ValueChannelVisualPort.


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