10#ifndef __UTILS_TYPES_H__
11#define __UTILS_TYPES_H__
15#include "gtk_wrapper.h"
18#pragma GCC diagnostic push
19#pragma GCC diagnostic ignored "-Wshadow"
20#include <magic_enum_all.hpp>
21#pragma GCC diagnostic pop
23using namespace magic_enum::bitwise_operators;
31#define TYPEDEF_STRUCT(s) typedef struct s s
33#define TYPEDEF_STRUCT_UNDERSCORED(s) typedef struct _##s s
56typedef double curviness_t;
61#define SIGNED_FRAME_FORMAT PRId64
66#define UNSIGNED_FRAME_FORMAT PRIu64
87typedef const char * (*GenericStringGetter) (
void * object);
164 "Global start frame: %" PRIuFAST64
" (with offset %" PRIuFAST64
165 ") | local offset: %" PRIu32
" | num frames: %" PRIu32,
170typedef enum CacheTypes
172 CACHE_TYPE_TRACK_NAME_HASHES = 1 << 0,
173 CACHE_TYPE_PLUGIN_PORTS = 1 << 1,
174 CACHE_TYPE_PLAYBACK_SNAPSHOTS = 1 << 2,
175 CACHE_TYPE_AUTOMATION_LANE_RECORD_MODES = 1 << 3,
176 CACHE_TYPE_AUTOMATION_LANE_PORTS = 1 << 4,
179#define CACHE_TYPE_ALL \
180 (CACHE_TYPE_TRACK_NAME_HASHES | CACHE_TYPE_PLUGIN_PORTS \
181 | CACHE_TYPE_PLAYBACK_SNAPSHOTS | CACHE_TYPE_AUTOMATION_LANE_RECORD_MODES \
182 | CACHE_TYPE_AUTOMATION_LANE_PORTS)
184#define ENUM_INT_TO_VALUE_CONST(_enum, _int) \
185 (magic_enum::enum_value<_enum, _int> ())
186#define ENUM_INT_TO_VALUE(_enum, _int) (magic_enum::enum_value<_enum> (_int))
187#define ENUM_VALUE_TO_INT(_val) (magic_enum::enum_integer (_val))
189#define ENUM_ENABLE_BITSET(_enum) \
190 template <> struct magic_enum::customize::enum_range<_enum> \
192 static constexpr bool is_flags = true; \
194#define ENUM_BITSET(_enum, _val) (magic_enum::containers::bitset<_enum> (_val))
195#define ENUM_BITSET_TEST(_enum, _val, _other_val) \
197 (static_cast<int> (_val) & static_cast<int> (_other_val))
201#define ENUM_BITSET_TO_STRING(_enum, _val) \
202 (ENUM_BITSET (_enum, _val).to_string ().data ())
201#define ENUM_BITSET_TO_STRING(_enum, _val) \ …
204#define ENUM_COUNT(_enum) (magic_enum::enum_count<_enum> ())
205#define ENUM_NAME(_val) (magic_enum::enum_name (_val).data ())
206#define ENUM_NAME_FROM_INT(_enum, _int) \
207 ENUM_NAME (ENUM_INT_TO_VALUE (_enum, _int))
void(* GenericStringSetter)(void *object, const char *val)
Setter prototype for float values.
uint_fast64_t unsigned_frame_t
Unsigned type for frame index.
uint32_t sample_rate_t
Sample rate.
void(* GenericStringCopyGetter)(void *object, char *buf)
Getter prototype for strings to be saved in the given buffer.
bool(* GenericPredicateFunc)(const void *object, const void *user_data)
Predicate function prototype.
float(* GenericFloatGetter)(void *object)
Getter prototype for float values.
signed_frame_t signed_sec_t
Signed second index.
int_fast64_t signed_frame_t
Signed type for frame index.
signed_frame_t signed_ms_t
Signed millisecond index.
uint32_t nframes_t
Frame count.
void(* GenericCallback)(void *object)
Generic callback.
void(* GenericFloatSetter)(void *object, float val)
Setter prototype for float values.
uint32_t midi_time_t
MIDI time in global frames.
uint8_t midi_byte_t
MIDI byte.
void(* ObjectFreeFunc)(void *)
Function to call to free objects.
float sample_t
The sample type.
int(* GenericCmpFunc)(const void *a, const void *b)
Generic comparator.
unsigned int channels_t
Number of channels.
@ AUDIO_VALUE_FADER
0 to 1, suitable for drawing.
@ AUDIO_VALUE_AMPLITUDE
0 to 2, amplitude.
Common struct to pass around during processing to avoid repeating the data in function arguments.
unsigned_frame_t g_start_frame
Global position at the start of the processing cycle (no offset added).
unsigned_frame_t g_start_frame_w_offset
Global position with EngineProcessTimeInfo.local_offset added, for convenience.
nframes_t nframes
Number of frames to process in this call, starting from the offset.
nframes_t local_offset
Offset in the current processing cycle, between 0 and the number of frames in AudioEngine....