Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
tempo_track.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2019-2020 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __AUDIO_TEMPO_TRACK_H__
11#define __AUDIO_TEMPO_TRACK_H__
12
13#include <cstdint>
14
15#include "dsp/track.h"
16#include "utils/types.h"
17
18#include <magic_enum.hpp>
19
26#define TEMPO_TRACK_MAX_BPM 420.f
27#define TEMPO_TRACK_MIN_BPM 40.f
28#define TEMPO_TRACK_DEFAULT_BPM 140.f
29#define TEMPO_TRACK_DEFAULT_BEATS_PER_BAR 4
30#define TEMPO_TRACK_MIN_BEATS_PER_BAR 1
31#define TEMPO_TRACK_MAX_BEATS_PER_BAR 16
32#define TEMPO_TRACK_DEFAULT_BEAT_UNIT ZBeatUnit::Z_BEAT_UNIT_4
33#define TEMPO_TRACK_MIN_BEAT_UNIT ZBeatUnit::Z_BEAT_UNIT_2
34#define TEMPO_TRACK_MAX_BEAT_UNIT ZBeatUnit::Z_BEAT_UNIT_16
35
36#define P_TEMPO_TRACK (TRACKLIST->tempo_track)
37
41enum class ZBeatUnit
42{
43 Z_BEAT_UNIT_2,
44 Z_BEAT_UNIT_4,
45 Z_BEAT_UNIT_8,
46 Z_BEAT_UNIT_16
47};
48
52Track *
53tempo_track_default (int track_pos);
54
58void
60
66void
68
74
80
81const char *
82tempo_track_get_current_bpm_as_str (void * self);
83
95void
97 Track * self,
98 bpm_t bpm,
99 bpm_t start_bpm,
100 bool temporary,
101 bool fire_events);
102
103void
104tempo_track_set_bpm_from_str (void * _self, const char * str);
105
106int
107tempo_track_beat_unit_enum_to_int (ZBeatUnit ebeat_unit);
108
109void
110tempo_track_set_beat_unit_from_enum (Track * self, ZBeatUnit ebeat_unit);
111
113tempo_track_get_beat_unit_enum (Track * self);
114
116tempo_track_beat_unit_to_enum (int beat_unit);
117
118void
119tempo_track_set_beat_unit (Track * self, int beat_unit);
120
124void
125tempo_track_set_beats_per_bar (Track * self, int beats_per_bar);
126
127int
128tempo_track_get_beats_per_bar (Track * self);
129
130int
131tempo_track_get_beat_unit (Track * self);
132
137#endif
The backend for a timeline track.
ZBeatUnit
Beat unit.
Definition tempo_track.h:42
void tempo_track_clear(Track *self)
Removes all objects from the tempo track.
bpm_t tempo_track_get_bpm_at_pos(Track *track, Position *pos)
Returns the BPM at the given pos.
bpm_t tempo_track_get_current_bpm(Track *self)
Returns the current BPM.
void tempo_track_set_bpm(Track *self, bpm_t bpm, bpm_t start_bpm, bool temporary, bool fire_events)
Sets the BPM.
void tempo_track_init(Track *track)
Inits the tempo track.
Track * tempo_track_default(int track_pos)
Creates the default tempo track.
void tempo_track_set_beats_per_bar(Track *self, int beats_per_bar)
Updates beat unit and anything depending on it.
float bpm_t
The BPM type.
Definition types.h:54
A Position is made up of bars.beats.sixteenths.ticks.
Definition position.h:124
Track to be inserted into the Project's Tracklist.
Definition track.h:177
Custom types.