Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
quantize_options.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2019-2021 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __AUDIO_QUANTIZE_OPTIONS_H__
11#define __AUDIO_QUANTIZE_OPTIONS_H__
12
13#include "dsp/position.h"
14#include "dsp/snap_grid.h"
15#include "utils/yaml.h"
16
23#define QUANTIZE_OPTIONS_SCHEMA_VERSION 1
24
25#define QUANTIZE_OPTIONS_IS_EDITOR(qo) (PROJECT->quantize_opts_editor == qo)
26#define QUANTIZE_OPTIONS_IS_TIMELINE(qo) (PROJECT->quantize_opts_timeline == qo)
27#define QUANTIZE_OPTIONS_TIMELINE (PROJECT->quantize_opts_timeline)
28#define QUANTIZE_OPTIONS_EDITOR (PROJECT->quantize_opts_editor)
29
30#define MAX_SNAP_POINTS 120096
31
32typedef struct QuantizeOptions
33{
35 NoteLength note_length;
36
39
41 float amount;
42
46
50
52 float swing;
53
55 double rand_ticks;
56
66 Position q_points[MAX_SNAP_POINTS];
67 int num_q_points;
69
70void
71quantize_options_init (QuantizeOptions * self, NoteLength note_length);
72
76void
78
79float
80quantize_options_get_swing (QuantizeOptions * self);
81
82float
83quantize_options_get_amount (QuantizeOptions * self);
84
85float
86quantize_options_get_randomization (QuantizeOptions * self);
87
88void
89quantize_options_set_swing (QuantizeOptions * self, float swing);
90
91void
92quantize_options_set_amount (QuantizeOptions * self, float amount);
93
94void
95quantize_options_set_randomization (QuantizeOptions * self, float randomization);
96
102char *
103quantize_options_stringize (NoteLength note_length, NoteType note_type);
104
116double
118
124
126quantize_options_new (void);
127
131void
133
138#endif
Snap/grid information.
void quantize_options_update_quantize_points(QuantizeOptions *self)
Updates snap points.
NoteType
Definition snap_grid.h:53
void quantize_options_free(QuantizeOptions *self)
Free's the QuantizeOptions.
QuantizeOptions * quantize_options_clone(const QuantizeOptions *src)
Clones the QuantizeOptions.
double quantize_options_quantize_position(QuantizeOptions *self, Position *pos)
Quantizes the given Position using the given QuantizeOptions.
char * quantize_options_stringize(NoteLength note_length, NoteType note_type)
Returns the grid intensity as a human-readable string.
Position struct and API.
A Position is made up of bars.beats.sixteenths.ticks.
Definition position.h:124
NoteLength note_length
See SnapGrid.
float amount
Percentage to apply quantize (0-100).
int adj_start
Adjust start position or not (only applies to objects with length.
NoteType note_type
See SnapGrid.
float swing
Swing amount (0-100).
double rand_ticks
Number of ticks for randomization.
int adj_end
Adjust end position or not (only applies to objects with length.
Position q_points[MAX_SNAP_POINTS]
Quantize points.
YAML utils.