Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::structure::arrangement::ClipRenderer Class Referencefinal

A class that converts clip data to serialized formats. More...

#include <src/structure/arrangement/clip_renderer.h>

Data Structures

struct  RenderedAutomationPoint
 A single control point in a rendered automation curve. More...

Public Types

using TimelineRange = std::pair<dsp::TimelineTick, dsp::TimelineTick>

Static Public Member Functions

static void serialize_to_sequence (const MidiClip &clip, juce::MidiMessageSequence &events, std::optional< TimelineRange > timeline_range_ticks=std::nullopt)
 Serializes a MIDI clip to a MIDI message sequence.
static void serialize_to_sequence (const ChordClip &clip, juce::MidiMessageSequence &events, std::optional< TimelineRange > timeline_range_ticks=std::nullopt)
 Serializes a Chord clip to a MIDI message sequence.
static void serialize_to_buffer (const AudioClip &clip, juce::AudioSampleBuffer &buffer, std::optional< TimelineRange > timeline_range_ticks=std::nullopt)
 Serializes an Audio clip to an audio sample buffer.
static void serialize_to_points (const AutomationClip &clip, std::vector< RenderedAutomationPoint > &points, std::optional< TimelineRange > timeline_range_ticks=std::nullopt)
 Serializes an AutomationClip to a list of control points in timeline-tick space (relative to clip start).

Detailed Description

A class that converts clip data to serialized formats.

This class provides methods to serialize both MIDI and Audio clips, handling looped playback and various constraints.

Definition at line 23 of file clip_renderer.h.

Member Typedef Documentation

◆ TimelineRange

using zrythm::structure::arrangement::ClipRenderer::TimelineRange = std::pair<dsp::TimelineTick, dsp::TimelineTick>

Definition at line 26 of file clip_renderer.h.

Member Function Documentation

◆ serialize_to_buffer()

void zrythm::structure::arrangement::ClipRenderer::serialize_to_buffer ( const AudioClip & clip,
juce::AudioSampleBuffer & buffer,
std::optional< TimelineRange > timeline_range_ticks = std::nullopt )
static

Serializes an Audio clip to an audio sample buffer.

The buffer represents the clip's audio as played back with looping and clip-start applied. Buffer index 0 corresponds to the clip start.

Parameters
clipThe Audio clip to serialize.
bufferOutput audio sample buffer.
timeline_range_ticksCurrently unused.

◆ serialize_to_points()

void zrythm::structure::arrangement::ClipRenderer::serialize_to_points ( const AutomationClip & clip,
std::vector< RenderedAutomationPoint > & points,
std::optional< TimelineRange > timeline_range_ticks = std::nullopt )
static

Serializes an AutomationClip to a list of control points in timeline-tick space (relative to clip start).

Uses the same serialize_clip loop walk as MIDI/Audio/Chord. When a loop iteration boundary falls between two automation points, an interpolated control point is inserted so the curve resumes correctly.

Points are sorted by position. Callers that need absolute timeline positions should add clip.position()->asTick() to each point's position (cf. MidiMessageSequence::addTimeToMessages).

Parameters
clipThe automation clip to serialize.
pointsOutput vector of control points.
timeline_range_ticksCurrently unused.

◆ serialize_to_sequence() [1/2]

void zrythm::structure::arrangement::ClipRenderer::serialize_to_sequence ( const ChordClip & clip,
juce::MidiMessageSequence & events,
std::optional< TimelineRange > timeline_range_ticks = std::nullopt )
static

Serializes a Chord clip to a MIDI message sequence.

Event timestamps are in ticks relative to the clip start (tick 0 = clip start). See the MidiClip overload for details.

Parameters
clipThe Chord clip to serialize.
EventsOutput MIDI message sequence.
timeline_range_ticksCurrently unused.

◆ serialize_to_sequence() [2/2]

void zrythm::structure::arrangement::ClipRenderer::serialize_to_sequence ( const MidiClip & clip,
juce::MidiMessageSequence & events,
std::optional< TimelineRange > timeline_range_ticks = std::nullopt )
static

Serializes a MIDI clip to a MIDI message sequence.

Event timestamps are in ticks relative to the clip start (tick 0 = clip start). Looping and clip-start offsets are applied. Callers that need absolute timeline positions should add clip.position()->ticks() to each event timestamp (e.g. via events.addTimeToMessages()).

Parameters
clipThe MIDI clip to serialize.
EventsOutput MIDI message sequence.
timeline_range_ticksCurrently unused.

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