Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2019-2022 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __UTILS_TYPES_H__
11#define __UTILS_TYPES_H__
12
13#include <inttypes.h>
14#include <stdbool.h>
15#include <stdint.h>
16
17#include <gtk/gtk.h>
18
25#define TYPEDEF_STRUCT(s) typedef struct s s;
26
27#define TYPEDEF_STRUCT_UNDERSCORED(s) typedef struct _##s s;
28
29#define TYPEDEF_ENUM(s) typedef enum s s;
30
32typedef uint8_t midi_byte_t;
33
35typedef uint32_t nframes_t;
36
38typedef uint32_t sample_rate_t;
39
41typedef uint32_t midi_time_t;
42
44typedef unsigned int channels_t;
45
47typedef float sample_t;
48
50typedef float bpm_t;
51
52typedef double curviness_t;
53
55typedef int_fast64_t signed_frame_t;
56
57#define SIGNED_FRAME_FORMAT PRId64
58
60typedef uint_fast64_t unsigned_frame_t;
61
62#define UNSIGNED_FRAME_FORMAT PRIu64
63
66
69
73typedef float (*GenericFloatGetter) (void * object);
74
78typedef void (*GenericFloatSetter) (void * object, float val);
79
83typedef const char * (*GenericStringGetter) (void * object);
84
88typedef void (*GenericStringSetter) (void * object, const char * val);
89
94typedef void (*GenericStringCopyGetter) (void * object, char * buf);
95
99typedef void (*GenericCallback) (void * object);
100
104typedef int (*GenericCmpFunc) (const void * a, const void * b);
105
112typedef bool (
113 *GenericPredicateFunc) (const void * object, const void * user_data);
114
118typedef void (*ObjectFreeFunc) (void *);
119
131
155
156static inline void
157engine_process_time_info_print (const EngineProcessTimeInfo * self)
158{
159 g_message (
160 "Global start frame: %" PRIuFAST64 " (with offset %" PRIuFAST64
161 ") | local offset: %" PRIu32 " | num frames: %" PRIu32,
163 self->nframes);
164}
165
166typedef enum CacheTypes
167{
168 CACHE_TYPE_TRACK_NAME_HASHES = 1 << 0,
169 CACHE_TYPE_PLUGIN_PORTS = 1 << 1,
170 CACHE_TYPE_PLAYBACK_SNAPSHOTS = 1 << 2,
171 CACHE_TYPE_AUTOMATION_LANE_RECORD_MODES = 1 << 3,
172 CACHE_TYPE_AUTOMATION_LANE_PORTS = 1 << 4,
173} CacheTypes;
174
175#define CACHE_TYPE_ALL \
176 (CACHE_TYPE_TRACK_NAME_HASHES | CACHE_TYPE_PLUGIN_PORTS \
177 | CACHE_TYPE_PLAYBACK_SNAPSHOTS | CACHE_TYPE_AUTOMATION_LANE_RECORD_MODES \
178 | CACHE_TYPE_AUTOMATION_LANE_PORTS)
179
184#endif
void(* GenericStringSetter)(void *object, const char *val)
Setter prototype for float values.
Definition types.h:88
uint_fast64_t unsigned_frame_t
Unsigned type for frame index.
Definition types.h:60
uint32_t sample_rate_t
Sample rate.
Definition types.h:38
void(* GenericStringCopyGetter)(void *object, char *buf)
Getter prototype for strings to be saved in the given buffer.
Definition types.h:94
bool(* GenericPredicateFunc)(const void *object, const void *user_data)
Predicate function prototype.
Definition types.h:113
float(* GenericFloatGetter)(void *object)
Getter prototype for float values.
Definition types.h:73
signed_frame_t signed_sec_t
Signed second index.
Definition types.h:68
float bpm_t
The BPM type.
Definition types.h:50
int_fast64_t signed_frame_t
Signed type for frame index.
Definition types.h:55
signed_frame_t signed_ms_t
Signed millisecond index.
Definition types.h:65
uint32_t nframes_t
Frame count.
Definition types.h:35
void(* GenericCallback)(void *object)
Generic callback.
Definition types.h:99
void(* GenericFloatSetter)(void *object, float val)
Setter prototype for float values.
Definition types.h:78
uint32_t midi_time_t
MIDI time in global frames.
Definition types.h:41
uint8_t midi_byte_t
MIDI byte.
Definition types.h:32
void(* ObjectFreeFunc)(void *)
Function to call to free objects.
Definition types.h:118
float sample_t
The sample type.
Definition types.h:47
int(* GenericCmpFunc)(const void *a, const void *b)
Generic comparator.
Definition types.h:104
AudioValueFormat
Definition types.h:121
unsigned int channels_t
Number of channels.
Definition types.h:44
@ AUDIO_VALUE_DBFS
dbFS.
Definition types.h:126
@ AUDIO_VALUE_FADER
0 to 1, suitable for drawing.
Definition types.h:129
@ AUDIO_VALUE_AMPLITUDE
0 to 2, amplitude.
Definition types.h:123
Common struct to pass around during processing to avoid repeating the data in function arguments.
Definition types.h:138
unsigned_frame_t g_start_frame
Global position at the start of the processing cycle (no offset added).
Definition types.h:140
unsigned_frame_t g_start_frame_w_offset
Global position with EngineProcessTimeInfo.local_offset added, for convenience.
Definition types.h:144
nframes_t nframes
Number of frames to process in this call, starting from the offset.
Definition types.h:153
nframes_t local_offset
Offset in the current processing cycle, between 0 and the number of frames in AudioEngine....
Definition types.h:148