8#include "dsp/midi_event.h"
10#include "structure/tracks/tracklist.h"
11#include "utils/types.h"
13#include <moodycamel/lightweightsemaphore.h>
18namespace zrythm::engine::device_io
23#define SAMPLE_PROCESSOR (AUDIO_ENGINE->sample_processor_)
25namespace zrythm::engine::session
40 SampleProcessor () =
default;
41 SampleProcessor (engine::device_io::AudioEngine * engine);
42 Z_DISABLE_COPY_MOVE (SampleProcessor)
43 ~SampleProcessor ()
override;
45 friend void init_from (
47 const SampleProcessor &other,
50 void init_loaded (engine::device_io::AudioEngine * engine);
68 return u8
"Sample Processor";
99 static constexpr auto kFaderKey =
"fader"sv;
100 friend void to_json (nlohmann::json &j,
const SampleProcessor &sp)
112 void queue_file_or_chord_preset (
126 std::unique_ptr<dsp::MidiEvents> midi_events_;
A preset of chord descriptors.
Interface for objects that can be processed in the DSP graph.
A processor to be used in the routing graph for playing samples independent of the timeline.
utils::Utf8String get_node_name() const override
Returns a human friendly name of the node.
void stop_file_playback()
Stops playback of files (auditioning).
void load_instrument_if_empty()
Loads the instrument from the settings.
void queue_file(const FileDescriptor &file)
Adds a file (audio or MIDI) to the queue.
void remove_sample_playback(SamplePlayback &sp)
Removes a SamplePlayback from the array.
moodycamel::LightweightSemaphore rebuilding_sem_
Semaphore to be locked while rebuilding the sample processor tracklist and graph.
std::unique_ptr< dsp::Fader > fader_
Fader connected to the main output.
nframes_t get_single_playback_latency() const override
Returns the latency of only the given processable, without adding the previous/next latencies.
std::unique_ptr< structure::tracks::Tracklist > tracklist_
Tracklist for file auditioning.
engine::device_io::AudioEngine * audio_engine_
Pointer to owner audio engine, if any.
void queue_sample_from_file(const char *path)
Adds a sample to play to the queue from a file path.
void queue_chord_preset(const ChordPreset &chord_pset)
Adds a chord preset to the queue.
std::vector< SamplePlayback > current_samples_
An array of samples currently being played.
void process_block(EngineProcessTimeInfo time_nfo, const dsp::ITransport &transport) noexcept override
Process the samples for the given number of frames.
std::unique_ptr< zrythm::plugins::PluginConfiguration > instrument_setting_
Instrument for MIDI auditioning.
bool roll_
Playhead for the tracklist (used when auditioning files).
Configuration for instantiating a plugin descriptor.
Lightweight UTF-8 string wrapper with safe conversions.
uint32_t nframes_t
Frame count.
A framework from playing back samples independent of the timeline, such as metronomes and samples fro...
Common struct to pass around during processing to avoid repeating the data in function arguments.
A sample playback handle to be used by the engine.