Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
sample_processor.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2019-2024 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __AUDIO_SAMPLE_PROCESSOR_H__
11#define __AUDIO_SAMPLE_PROCESSOR_H__
12
13#include "dsp/fader.h"
14#include "dsp/port.h"
15#include "dsp/position.h"
16#include "dsp/sample_playback.h"
17#include "utils/types.h"
18
19#include <zix/sem.h>
20
21typedef enum MetronomeType MetronomeType;
22typedef struct SupportedFile SupportedFile;
23typedef struct Tracklist Tracklist;
24typedef struct PluginSetting PluginSetting;
25typedef struct MidiEvents MidiEvents;
26typedef struct ChordPreset ChordPreset;
27TYPEDEF_STRUCT (Graph);
28
35#define SAMPLE_PROCESSOR (AUDIO_ENGINE->sample_processor)
36
37#define sample_processor_is_in_active_project(self) \
38 (self->audio_engine && engine_is_in_active_project (self->audio_engine))
39
87
92COLD WARN_UNUSED_RESULT SampleProcessor *
94
95COLD void
96sample_processor_init_loaded (SampleProcessor * self, AudioEngine * engine);
97
101void
103 SampleProcessor * self,
104 const nframes_t nframes);
105
112void
114 SampleProcessor * self,
115 const nframes_t offset,
116 const nframes_t nframes);
117
121void
123 SampleProcessor * self,
124 SamplePlayback * sp);
125
131void
133
140void
142 SampleProcessor * self,
143 MetronomeType type,
144 nframes_t offset);
145
150void
152 SampleProcessor * self,
153 const char * path);
154
158void
160
164void
166 SampleProcessor * self,
167 const ChordPreset * chord_pset);
168
172void
174
175void
176sample_processor_disconnect (SampleProcessor * self);
177
183
184void
185sample_processor_free (SampleProcessor * self);
186
191#endif
Backend for faders or other volume/gain controls.
Ports that transfer audio/midi/other signals to one another.
MetronomeType
The type of the metronome sound.
Definition metronome.h:31
void sample_processor_prepare_process(SampleProcessor *self, const nframes_t nframes)
Clears the buffers.
void sample_processor_queue_metronome_countin(SampleProcessor *self)
Queues a metronomem tick at the given offset.
void sample_processor_queue_file(SampleProcessor *self, const SupportedFile *file)
Adds a file (audio or MIDI) to the queue.
void sample_processor_remove_sample_playback(SampleProcessor *self, SamplePlayback *sp)
Removes a SamplePlayback from the array.
SampleProcessor * sample_processor_clone(const SampleProcessor *src)
To be used for serialization.
void sample_processor_queue_chord_preset(SampleProcessor *self, const ChordPreset *chord_pset)
Adds a chord preset to the queue.
void sample_processor_queue_sample_from_file(SampleProcessor *self, const char *path)
Adds a sample to play to the queue from a file path.
void sample_processor_stop_file_playback(SampleProcessor *self)
Stops playback of files (auditioning).
void sample_processor_queue_metronome(SampleProcessor *self, MetronomeType type, nframes_t offset)
Queues a metronomem tick at the given local offset.
COLD WARN_UNUSED_RESULT SampleProcessor * sample_processor_new(AudioEngine *engine)
Initializes a SamplePlayback with a sample to play back.
void sample_processor_process(SampleProcessor *self, const nframes_t offset, const nframes_t nframes)
Process the samples for the given number of frames.
uint32_t nframes_t
Frame count.
Definition types.h:35
Position struct and API.
A framework from playing back samples independent of the timeline, such as metronomes and samples fro...
The audio engine.
Definition engine.h:364
A preset of chord descriptors.
A Fader is a processor that is used for volume controls and pan.
Definition fader.h:118
Graph.
Definition graph.h:71
Container for passing midi events through ports.
Definition midi_event.h:68
A setting for a specific plugin descriptor.
A Position is made up of bars.beats.sixteenths.ticks.
Definition position.h:129
A sample playback handle to be used by the engine.
A processor to be used in the routing graph for playing samples independent of the timeline.
PluginSetting * instrument_setting
Instrument for MIDI auditioning.
Fader * fader
Fader connected to the main output.
Tracklist * tracklist
Tracklist for file auditioning.
SamplePlayback current_samples[256]
An array of samples currently being played.
AudioEngine * audio_engine
Pointer to owner audio engin, if any.
bool roll
Whether to roll or not.
Position file_end_pos
Position the file ends at.
Graph * graph
Temp processing graph.
ZixSem rebuilding_sem
Semaphore to be locked while rebuilding the sample processor tracklist and graph.
Position playhead
Playhead for the tracklist (used when auditioning files).
Metadata for a supported file.
The Tracklist contains all the tracks in the Project.
Definition tracklist.h:61
Custom types.