Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
AudioPort Class Referencefinal

Audio port specifics. More...

#include <src/gui/dsp/audio_port.h>

Inheritance diagram for AudioPort:
Collaboration diagram for AudioPort:

Public Member Functions

 AudioPort (utils::Utf8String label, PortFlow flow)
bool has_sound () const override
 If MIDI port, returns if there are any events, if audio port, returns if there is sound in the buffer.
void apply_fader (float amp, nframes_t start_frame, nframes_t nframes)
 Applies the fader to the audio buffer.
void apply_pan (float pan, zrythm::dsp::PanLaw pan_law, zrythm::dsp::PanAlgorithm pan_algo, nframes_t start_frame, nframes_t nframes)
 Applies the pan to the audio buffer.
float get_peak () const
 Returns the peak amplitude of the audio buffer.
void reset_peak ()
 Resets the peak amplitude to 0.
void process_block (EngineProcessTimeInfo time_nfo) override
void clear_buffer (std::size_t block_length) override
 Clears the port buffer.
bool is_stereo_port () const
Public Member Functions inherited from Port
void init_loaded (IPortOwner &owner)
 This function finds the Ports corresponding to the PortIdentifiers for srcs and dests.
void set_owner (IPortOwner &owner)
utils::Utf8String get_label () const
bool is_control () const
bool is_audio () const
bool is_cv () const
bool is_event () const
bool is_midi () const
bool is_input () const
bool is_output () const
utils::Utf8String get_node_name () const override
 Returns a human friendly name of the node.
nframes_t get_single_playback_latency () const override
 Ports have no latency.
utils::Utf8String get_full_designation () const
 Gets a full designation of the port in the format "Track/Port" or "Track/Plugin/Port".
void change_track (IPortOwner::TrackUuid new_track_id)
 Updates the owner track identifier.
bool has_label () const
PortType get_type () const
PortFlow get_flow () const
Public Member Functions inherited from zrythm::utils::UuidIdentifiableObject< Port >
UuidIdentifiableObjectoperator= (const UuidIdentifiableObject &other)=default
auto get_uuid () const
Public Member Functions inherited from AudioAndCVPortMixin
void prepare_for_processing (sample_rate_t sample_rate, nframes_t max_block_length) final
 Called to allocate resources required for processing.
void release_resources () final
 Called to release resources allocated by prepare_for_processing().

Static Public Attributes

static constexpr size_t AUDIO_RING_SIZE = 65536

Friends

void init_from (AudioPort &obj, const AudioPort &other, utils::ObjectCloneType clone_type)
void to_json (nlohmann::json &j, const AudioPort &port)
void from_json (const nlohmann::json &j, AudioPort &port)

Additional Inherited Members

Public Types inherited from Port
using PortIdentifier = dsp::PortIdentifier
using PortType = dsp::PortType
using PortFlow = dsp::PortFlow
using PortConnection = dsp::PortConnection
Data Fields inherited from Port
std::unique_ptr< PortIdentifierid_
 Owned pointer.
IPortOwnerowner_ {}
PortRange range_
Data Fields inherited from AudioAndCVPortMixin
std::vector< float > buf_
 Audio-like data buffer.
std::unique_ptr< RingBuffer< float > > audio_ring_
 Ring buffer for saving the contents of the audio buffer to be used in the UI instead of directly accessing the buffer.
Data Fields inherited from RingBufferOwningPortMixin
std::atomic< int > num_ring_buffer_readers_ { 0 }
 Number of entities that want ring buffers to be written.
Data Fields inherited from PortConnectionsCacheMixin< AudioPort >
std::vector< ElementType > port_sources_
 Caches filled when recalculating the graph.
Protected Member Functions inherited from Port
 Port (utils::Utf8String label, PortType type={}, PortFlow flow={}, float minf=0.f, float maxf=1.f, float zerof=0.f)

Detailed Description

Audio port specifics.

Definition at line 20 of file audio_port.h.

Member Function Documentation

◆ apply_fader()

void AudioPort::apply_fader ( float amp,
nframes_t start_frame,
nframes_t nframes )

Applies the fader to the audio buffer.

Parameters
ampThe fader amplitude (0.0 to 1.0).
start_frameThe start frame offset from 0 in this cycle.
nframesThe number of frames to process.

◆ apply_pan()

void AudioPort::apply_pan ( float pan,
zrythm::dsp::PanLaw pan_law,
zrythm::dsp::PanAlgorithm pan_algo,
nframes_t start_frame,
nframes_t nframes )

Applies the pan to the audio buffer.

Parameters
panThe pan value (-1.0 to 1.0).
pan_lawThe pan law to use.
pan_algoThe pan algorithm to use.
start_frameThe start frame offset from 0 in this cycle.
nframesThe number of frames to process.

◆ clear_buffer()

void AudioPort::clear_buffer ( std::size_t block_length)
overridevirtual

Clears the port buffer.

Implements Port.

◆ get_peak()

float AudioPort::get_peak ( ) const
inline

Returns the peak amplitude of the audio buffer.

Returns
The peak amplitude (0.0 to 1.0).

Definition at line 70 of file audio_port.h.

◆ has_sound()

bool AudioPort::has_sound ( ) const
overridevirtual

If MIDI port, returns if there are any events, if audio port, returns if there is sound in the buffer.

Reimplemented from Port.

◆ is_stereo_port()

bool AudioPort::is_stereo_port ( ) const
inline

Definition at line 81 of file audio_port.h.

◆ process_block()

void AudioPort::process_block ( EngineProcessTimeInfo time_nfo)
overridevirtual

Reimplemented from zrythm::dsp::graph::IProcessable.

◆ reset_peak()

void AudioPort::reset_peak ( )
inline

Resets the peak amplitude to 0.

Definition at line 75 of file audio_port.h.

◆ from_json

void from_json ( const nlohmann::json & j,
AudioPort & port )
friend

Definition at line 97 of file audio_port.h.

◆ to_json

void to_json ( nlohmann::json & j,
const AudioPort & port )
friend

Definition at line 93 of file audio_port.h.

Field Documentation

◆ AUDIO_RING_SIZE

size_t AudioPort::AUDIO_RING_SIZE = 65536
staticconstexpr

Definition at line 38 of file audio_port.h.


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