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

Reads a ValueChannelSet through the VisualPort contract. More...

#include <value_channel_visual_port.hpp>

Public Member Functions

 ValueChannelVisualPort (const dataplane::ValueChannelSet *channels)
 ValueChannelVisualPort (Processor &processor)
 The port over processor.value_channels(), or an empty port when the processor declares no channels.
 ValueChannelVisualPort (const ValueChannelVisualPort &)=delete
ValueChannelVisualPort & operator= (const ValueChannelVisualPort &)=delete
std::size_t channel_count () const noexcept override
VisualChannelInfo channel (std::size_t index) const noexcept override
 Description of channel index (< channel_count()).
bool read_scalar (std::size_t index, float &value) noexcept override
 Latest value of a scalar channel.
std::size_t read_meter (std::size_t index, std::span< float > rms, std::span< float > peak) noexcept override
 Latest frame of a meter channel into rms and peak.
std::size_t read_vector (std::size_t index, std::span< float > samples) noexcept override
 Latest block of a vector channel into samples.
std::size_t read_events (std::size_t index, std::span< VisualEvent > events) noexcept override
 Occurrences of the latest published block of an events channel.
std::uint32_t publish_count (std::size_t index) const noexcept override
 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

Reads a ValueChannelSet through the VisualPort contract.

The port resolves every declared channel once, at construction. That is valid because a set's channels are fixed before audio runs: an index the port hands out stays valid for the life of the set. Channel indices and order match ValueChannelSet::infos().

Lifetime: the set must outlive the port. A null set gives a port with no channels, which is what a processor that declares none exposes.

Threading: the same one-reader-thread contract as the sources behind it. Every read through one port, and every other read of the same set, happens on one thread, normally the editor's frame tick. Reads are lock-free and allocation-free; vector and event reads copy one frame on the stack.

Constructor & Destructor Documentation

◆ ValueChannelVisualPort() [1/3]

pulp::format::ValueChannelVisualPort::ValueChannelVisualPort ( const dataplane::ValueChannelSet * channels)
explicit

◆ ValueChannelVisualPort() [2/3]

pulp::format::ValueChannelVisualPort::ValueChannelVisualPort ( Processor & processor)
explicit

The port over processor.value_channels(), or an empty port when the processor declares no channels.

◆ ValueChannelVisualPort() [3/3]

pulp::format::ValueChannelVisualPort::ValueChannelVisualPort ( const ValueChannelVisualPort & )
delete

Member Function Documentation

◆ channel()

VisualChannelInfo pulp::format::ValueChannelVisualPort::channel ( std::size_t index) const
overridevirtualnoexcept

Description of channel index (< channel_count()).

Implements pulp::format::VisualPort.

◆ channel_count()

std::size_t pulp::format::ValueChannelVisualPort::channel_count ( ) const
overridevirtualnoexcept

◆ find()

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

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

◆ operator=()

ValueChannelVisualPort & pulp::format::ValueChannelVisualPort::operator= ( const ValueChannelVisualPort & )
delete

◆ publish_count()

std::uint32_t pulp::format::ValueChannelVisualPort::publish_count ( std::size_t index) const
overridevirtualnoexcept

Monotonic publish count of channel index.

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

Implements pulp::format::VisualPort.

◆ read_events()

std::size_t pulp::format::ValueChannelVisualPort::read_events ( std::size_t index,
std::span< VisualEvent > events )
overridevirtualnoexcept

Occurrences of the latest published block of an events channel.

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

Implements pulp::format::VisualPort.

◆ read_meter()

std::size_t pulp::format::ValueChannelVisualPort::read_meter ( std::size_t index,
std::span< float > rms,
std::span< float > peak )
overridevirtualnoexcept

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.

Implements pulp::format::VisualPort.

◆ read_scalar()

bool pulp::format::ValueChannelVisualPort::read_scalar ( std::size_t index,
float & value )
overridevirtualnoexcept

Latest value of a scalar channel.

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

Implements pulp::format::VisualPort.

◆ read_vector()

std::size_t pulp::format::ValueChannelVisualPort::read_vector ( std::size_t index,
std::span< float > samples )
overridevirtualnoexcept

Latest block of a vector channel into samples.

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

Implements pulp::format::VisualPort.


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