Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::engine::session::SampleProcessor Class Referencefinal

A processor to be used in the routing graph for playing samples independent of the timeline. More...

#include <src/engine/session/sample_processor.h>

Inheritance diagram for zrythm::engine::session::SampleProcessor:
Collaboration diagram for zrythm::engine::session::SampleProcessor:

Public Types

using PluginConfiguration = zrythm::plugins::PluginConfiguration

Public Member Functions

 SampleProcessor (engine::device_io::AudioEngine *engine)
void init_loaded (engine::device_io::AudioEngine *engine)
void load_instrument_if_empty ()
 Loads the instrument from the settings.
void process_block (dsp::graph::EngineProcessTimeInfo time_nfo, const dsp::ITransport &transport, const dsp::TempoMap &tempo_map) noexcept override
 Process the samples for the given number of frames.
utils::Utf8String get_node_name () const override
 Returns a human friendly name of the node.
void queue_sample_from_file (const char *path)
 Adds a sample to play to the queue from a file path.
void queue_file (const FileDescriptor &file)
 Adds a file (audio or MIDI) to the queue.
void queue_chord_preset (const ChordPreset &chord_pset)
 Adds a chord preset to the queue.
void stop_file_playback ()
 Stops playback of files (auditioning).
Public Member Functions inherited from zrythm::dsp::graph::IProcessable
virtual units::sample_u32_t get_single_playback_latency () const
 Returns the latency of only the given processable, without adding the previous/next latencies (zero latency by default).
virtual void prepare_for_processing (const GraphNode *node, units::sample_rate_t sample_rate, units::sample_u32_t max_block_length)
 Called to allocate resources required for processing.
virtual void release_resources ()
 Called to release resources allocated by prepare_for_processing().

Data Fields

std::unique_ptr< structure::tracks::Tracklisttracklist_
 Tracklist for file auditioning.
std::unique_ptr< zrythm::plugins::PluginConfigurationinstrument_setting_
 Instrument for MIDI auditioning.
std::unique_ptr< dsp::MidiEventsmidi_events_
std::unique_ptr< dsp::Faderfader_
 Fader connected to the main output.
bool roll_ = false
 Playhead for the tracklist (used when auditioning files).
engine::device_io::AudioEngine * audio_engine_ = nullptr
 Pointer to owner audio engine, if any.
moodycamel::LightweightSemaphore rebuilding_sem_ { 1 }
 Semaphore to be locked while rebuilding the sample processor tracklist and graph.

Friends

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

Detailed Description

A processor to be used in the routing graph for playing samples independent of the timeline.

Also used for auditioning files.

Definition at line 32 of file sample_processor.h.

Member Typedef Documentation

◆ PluginConfiguration

using zrythm::engine::session::SampleProcessor::PluginConfiguration = zrythm::plugins::PluginConfiguration

Definition at line 36 of file sample_processor.h.

Member Function Documentation

◆ get_node_name()

utils::Utf8String zrythm::engine::session::SampleProcessor::get_node_name ( ) const
inlineoverridevirtual

Returns a human friendly name of the node.

Implements zrythm::dsp::graph::IProcessable.

Definition at line 66 of file sample_processor.h.

◆ load_instrument_if_empty()

void zrythm::engine::session::SampleProcessor::load_instrument_if_empty ( )

Loads the instrument from the settings.

To be called when the engine is activated, once.

◆ process_block()

void zrythm::engine::session::SampleProcessor::process_block ( dsp::graph::EngineProcessTimeInfo time_nfo,
const dsp::ITransport & transport,
const dsp::TempoMap & tempo_map )
overridevirtualnoexcept

Process the samples for the given number of frames.

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

◆ from_json

void from_json ( const nlohmann::json & j,
SampleProcessor & sp )
friend

Definition at line 97 of file sample_processor.h.

◆ to_json

void to_json ( nlohmann::json & j,
const SampleProcessor & sp )
friend

Definition at line 93 of file sample_processor.h.

Field Documentation

◆ audio_engine_

engine::device_io::AudioEngine* zrythm::engine::session::SampleProcessor::audio_engine_ = nullptr

Pointer to owner audio engine, if any.

Definition at line 136 of file sample_processor.h.

◆ fader_

std::unique_ptr<dsp::Fader> zrythm::engine::session::SampleProcessor::fader_

Fader connected to the main output.

Definition at line 119 of file sample_processor.h.

◆ instrument_setting_

std::unique_ptr<zrythm::plugins::PluginConfiguration> zrythm::engine::session::SampleProcessor::instrument_setting_

Instrument for MIDI auditioning.

Definition at line 114 of file sample_processor.h.

◆ midi_events_

std::unique_ptr<dsp::MidiEvents> zrythm::engine::session::SampleProcessor::midi_events_

Definition at line 116 of file sample_processor.h.

◆ rebuilding_sem_

moodycamel::LightweightSemaphore zrythm::engine::session::SampleProcessor::rebuilding_sem_ { 1 }

Semaphore to be locked while rebuilding the sample processor tracklist and graph.

Definition at line 140 of file sample_processor.h.

◆ roll_

bool zrythm::engine::session::SampleProcessor::roll_ = false

Playhead for the tracklist (used when auditioning files).

Position the file ends at.

Once this position is reached, SampleProcessor.roll will be set to false. Whether to roll or not.

Definition at line 133 of file sample_processor.h.

◆ tracklist_

std::unique_ptr<structure::tracks::Tracklist> zrythm::engine::session::SampleProcessor::tracklist_

Tracklist for file auditioning.

Definition at line 111 of file sample_processor.h.


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