8#include "dsp/midi_event.h"
9#include "structure/tracks/tracklist.h"
10#include "utils/types.h"
12#include <moodycamel/lightweightsemaphore.h>
17namespace zrythm::engine::device_io
22#define SAMPLE_PROCESSOR (AUDIO_ENGINE->sample_processor_)
24namespace zrythm::engine::session
39 SampleProcessor () =
default;
40 SampleProcessor (engine::device_io::AudioEngine * engine);
41 Q_DISABLE_COPY_MOVE (SampleProcessor)
42 ~SampleProcessor ()
override;
44 friend void init_from (
46 const SampleProcessor &other,
49 void init_loaded (engine::device_io::AudioEngine * engine);
64 const dsp::TempoMap &tempo_map)
noexcept override;
68 return u8
"Sample Processor";
92 static constexpr auto kFaderKey =
"fader"sv;
93 friend void to_json (nlohmann::json &j,
const SampleProcessor &sp)
105 void queue_file_or_chord_preset (
106 const FileDescriptor * file,
116 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 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.
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.
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::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.
Common struct to pass around during processing to avoid repeating the data in function arguments.