Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
Utilities

Various utilities. More...

Files

file  resources.h
 Helpers for loading and using resources such as icons.
 

Data Structures

struct  SupportedFile
 Metadata for a supported file. More...
 
struct  CairoCaches
 Caches for cairo. More...
 
struct  ZGObjectImpl
 GObject struct (from GObject source code), used where hacks are needed. More...
 
struct  Log
 
struct  cell_t
 
struct  MPMCQueue
 Multiple Producer Multiple Consumer lock-free queue. More...
 
struct  Resampler
 Resampler. More...
 
struct  Stack
 Stack implementation. More...
 
class  StringArray
 String array that auto-converts given char pointers to UTF8 (so JUCE doesn't complain. More...
 
struct  EngineProcessTimeInfo
 Common struct to pass around during processing to avoid repeating the data in function arguments. More...
 
struct  UiColors
 Commonly used UI colors. More...
 
struct  UiTextures
 Commonly used UI textures. More...
 
struct  UiCursor
 Specification for a cursor. More...
 
struct  UiCaches
 Caches. More...
 
struct  ZVampFeature
 
struct  ZVampOutputDescriptor
 
struct  ZVampOutputList
 
struct  ZVampFeatureList
 
struct  ZVampFeatureSet
 

Macros

#define SUPPORTED_FILE_DND_PREFIX   Z_DND_STRING_PREFIX "SupportedFile::"
 
#define STRIP_SIZE   9
 Number of plugin slots per channel.
 
#define backtrace_get(prefix, max_lines, write_to_file)    _backtrace_get (NULL, prefix, max_lines, false, write_to_file)
 
#define backtrace_get_with_lines(prefix, max_lines, write_to_file)
 
#define CAIRO_CACHES   (gZrythm->cairo_caches)
 
#define Z_CAIRO_FONT   "Bold 9"
 Default font for drawing pango text.
 
#define Z_CAIRO_TEXT_PADDING   2
 Padding to leave from the top/left edges when drawing text.
 
#define z_cairo_get_text_extents_for_widget(_widget, _layout, _text, _width, _height)
 
#define z_cairo_draw_text(cr, widget, layout, text)
 Draw text with default padding.
 
#define COLOR_DEFAULT_BRIGHTEN_VAL   0.1f
 
#define z_return_val_if_fail_cmp(a, comparator, b, val)
 
#define z_return_if_fail_cmp(a, comparator, b)    z_return_val_if_fail_cmp (a, comparator, b, )
 
#define z_warn_if_fail_cmp(a, comparator, b)
 
#define file_exists(file)   g_file_test (file, G_FILE_TEST_EXISTS)
 Returns 1 if the file/dir exists.
 
#define RETURN_OK   return 0;
 
#define RETURN_ERROR   return 1;
 
#define DEFAULT_CLIPBOARD   gdk_display_get_clipboard (gdk_display_get_default ())
 
#define CREATE_MIDI_LEARN_MENU_ITEM(action)    z_gtk_create_menu_item (_ ("MIDI learn"), "signal-midi", action)
 
#define CREATE_CUT_MENU_ITEM(action)    z_gtk_create_menu_item (_ ("Cu_t"), "edit-cut", action)
 
#define CREATE_COPY_MENU_ITEM(action)    z_gtk_create_menu_item (_ ("_Copy"), "edit-copy", action)
 
#define CREATE_PASTE_MENU_ITEM(action)    z_gtk_create_menu_item (_ ("_Paste"), "edit-paste", action)
 
#define CREATE_DELETE_MENU_ITEM(action)    z_gtk_create_menu_item (_ ("_Delete"), "edit-delete", action)
 
#define CREATE_CLEAR_SELECTION_MENU_ITEM(action)
 
#define CREATE_SELECT_ALL_MENU_ITEM(action)    z_gtk_create_menu_item (_ ("Select A_ll"), "edit-select-all", action)
 
#define CREATE_DUPLICATE_MENU_ITEM(action)    z_gtk_create_menu_item (_ ("Duplicate"), "edit-duplicate", action)
 
#define CREATE_MUTE_MENU_ITEM(action)    z_gtk_create_menu_item (_ ("Mute"), "mute", action)
 
#define CREATE_UNMUTE_MENU_ITEM(action)    z_gtk_create_menu_item (_ ("Unmute"), NULL, action)
 
#define z_gtk_assistant_set_current_page_complete(assistant, complete)
 
#define Z_GDK_RGBA_INIT(r, g, b, a)
 
#define Z_GDK_RECTANGLE_INIT(_x, _y, _w, _h)
 
#define Z_GDK_RECTANGLE_INIT_UNIT(_x, _y)
 
#define Z_GRAPHENE_RECT_INIT(_x, _y, _w, _h)
 
#define Z_GRAPHENE_POINT_INIT(_x, _y)    GRAPHENE_POINT_INIT (static_cast<float> (_x), static_cast<float> (_y))
 
#define z_gtk_create_menu_item(lbl_name, icn_name, action_name)    z_gtk_create_menu_item_full (lbl_name, icn_name, action_name)
 
#define io_path_get_basename(filename)   g_path_get_basename (filename)
 
#define io_get_files_in_dir(dir, allow_empty)    io_get_files_in_dir_ending_in (dir, 0, NULL, allow_empty)
 Returns a list of the files in the given directory.
 
#define io_write_file   g_file_set_contents
 
#define LOG   (zlog)
 
#define MATH_RMS_FRAMES   1
 Frames to skip when calculating the RMS.
 
#define MATH_TINY_NUMBER   (0.0000001)
 Tiny number to be used for denormaml prevention (-140dB).
 
#define MATH_MINUS_INFINITY   (-HUGE_VAL)
 
#define math_floats_equal_epsilon(a, b, e)    ((a) > (b) ? (a) - (b) < e : (b) - (a) < e)
 Checks if 2 doubles are equal.
 
#define math_doubles_equal_epsilon   math_floats_equal_epsilon
 
#define math_floats_equal(a, b)    ((a) > (b) ? (a) - (b) < FLT_EPSILON : (b) - (a) < FLT_EPSILON)
 Checks if 2 doubles are equal.
 
#define math_doubles_equal(a, b)    ((a) > (b) ? (a) - (b) < DBL_EPSILON : (b) - (a) < DBL_EPSILON)
 
#define math_round_double_to_signed_32(x)   (lround (x))
 Rounds a double to a (minimum) signed 32-bit integer.
 
#define math_round_double_to_signed_64(x)   (llround (x))
 Rounds a double to a (minimum) signed 64-bit integer.
 
#define math_round_double_to_signed_frame_t(x)    math_round_double_to_signed_64 (x)
 
#define math_round_float_to_signed_32(x)   (lroundf (x))
 Rounds a float to a (minimum) signed 32-bit integer.
 
#define math_round_float_to_signed_64(x)   (llroundf (x))
 Rounds a float to a (minimum) signed 64-bit integer.
 
#define math_round_float_to_signed_frame_t(x)   math_round_float_to_signed_64 (x)
 
#define object_new(type)   (type *) g_malloc0 (sizeof (type))
 Allocates memory for an object of type type.
 
#define object_new_unresizable(type)   object_new (type)
 Allocates memory for an object of type type.
 
#define object_new_n_sizeof(n, sz)   g_malloc0_n (n, sz)
 Calloc equivalent.
 
#define object_new_n(n, type)    (static_cast<type *> (object_new_n_sizeof (n, sizeof (type))))
 Calloc n blocks for type type.
 
#define object_realloc_n_sizeof(obj, prev_sz, sz)    realloc_zero (obj, prev_sz, sz)
 
#define object_realloc_n(obj, prev_n, n, type)
 Reallocate memory for obj.
 
#define object_set_to_zero(ptr)   memset (ptr, 0, sizeof (*(ptr)))
 Zero's out the struct pointed to by ptr.
 
#define object_free_unresizable(type, obj)   free (obj)
 Frees memory for objects created with object_new().
 
#define object_zero_and_free(ptr)    _object_zero_and_free ((void **) &(ptr), sizeof (*(ptr)))
 Zero's out a struct pointed to by ptr and frees the object.
 
#define object_zero_and_free_unresizable(type, ptr)    _object_zero_and_free_unresizable ((void **) &(ptr), sizeof (type))
 
#define object_free_w_func_and_null(_func, _obj)
 Call the function _func to free _obj and set _obj to NULL.
 
#define object_delete_and_null(_obj)
 
#define object_zero_and_free_if_nonnull(ptr)    object_free_w_func_and_null (object_zero_and_free, ptr)
 
#define g_object_unref_and_null(ptr)    object_free_w_func_and_null (g_object_unref, ptr)
 Convenience wrapper.
 
#define g_free_and_null(ptr)   object_free_w_func_and_null (g_free, ptr)
 Convenience wrapper.
 
#define g_error_free_and_null(ptr)    object_free_w_func_and_null (g_error_free, ptr)
 Convenience wrapper.
 
#define object_free_w_func_and_null_cast(_func, _cast, _obj)
 Convenience wrapper.
 
#define g_source_remove_and_zero(src_id)
 
#define RESOURCES_PATH_TOP   "/org/zrythm/Zrythm"
 
#define RESOURCES_PATH   RESOURCES_PATH_TOP "/app"
 
#define RESOURCES_TEMPLATE_PATH   RESOURCES_PATH "/ui"
 
#define RESOURCES_GL_SHADERS_PATH   RESOURCES_PATH "/gl/shaders"
 
#define STACK_PUSH(s, element)   stack_push (s, (void *) element)
 
#define string_is_equal(str1, str2)   (!g_strcmp0 (str1, str2))
 Returns if the two strings are exactly equal.
 
#define TYPEDEF_STRUCT(s)   typedef struct s s
 
#define TYPEDEF_STRUCT_UNDERSCORED(s)   typedef struct _##s s
 
#define SIGNED_FRAME_FORMAT   PRId64
 
#define UNSIGNED_FRAME_FORMAT   PRIu64
 
#define CACHE_TYPE_ALL
 
#define ENUM_INT_TO_VALUE_CONST(_enum, _int)    (magic_enum::enum_value<_enum, _int> ())
 
#define ENUM_INT_TO_VALUE(_enum, _int)   (magic_enum::enum_value<_enum> (_int))
 
#define ENUM_VALUE_TO_INT(_val)   (magic_enum::enum_integer (_val))
 
#define ENUM_ENABLE_BITSET(_enum)
 
#define ENUM_BITSET(_enum, _val)   (magic_enum::containers::bitset<_enum> (_val))
 
#define ENUM_BITSET_TEST(_enum, _val, _other_val)
 
#define ENUM_BITSET_TO_STRING(_enum, _val)    (ENUM_BITSET (_enum, _val).to_string ().data ())
 
#define ENUM_COUNT(_enum)   (magic_enum::enum_count<_enum> ())
 
#define ENUM_NAME(_val)   (magic_enum::enum_name (_val).data ())
 
#define ENUM_NAME_FROM_INT(_enum, _int)    ENUM_NAME (ENUM_INT_TO_VALUE (_enum, _int))
 
#define UI_MAX_CURSORS   400
 
#define UI_CACHES   (zrythm_app->ui_caches)
 
#define UI_COLORS   (&UI_CACHES->colors)
 
#define UI_COLOR_DARK_TEXT   "#323232"
 
#define UI_COLOR_BRIGHT_TEXT   "#cdcdcd"
 
#define UI_COLOR_YELLOW   "#F9CA1B"
 
#define UI_COLOR_PURPLE   "#9D3955"
 
#define UI_COLOR_BUTTON_NORMAL   "#343434"
 
#define UI_COLOR_BUTTON_HOVER   "#444444"
 
#define UI_COLOR_RECORD_CHECKED   "#ED2939"
 
#define UI_COLOR_RECORD_ACTIVE   "#FF2400"
 
#define UI_COLOR_BRIGHT_GREEN   "#1DD169"
 
#define UI_COLOR_DARKISH_GREEN   "#19664c"
 
#define UI_COLOR_DARK_ORANGE   "#D68A0C"
 
#define UI_COLOR_Z_YELLOW   "#F9CA1B"
 
#define UI_COLOR_BRIGHT_ORANGE   "#F79616"
 
#define UI_COLOR_Z_PURPLE   "#9D3955"
 
#define UI_COLOR_MATCHA   "#2eb398"
 
#define UI_COLOR_LIGHT_BLUEISH   "#1aa3ffcc"
 
#define UI_COLOR_PREFADER_SEND   "#D21E6D"
 
#define UI_COLOR_POSTFADER_SEND   "#901ed2"
 
#define UI_COLOR_SOLO_ACTIVE   UI_COLOR_MATCHA
 
#define UI_COLOR_SOLO_CHECKED   UI_COLOR_DARKISH_GREEN
 
#define UI_COLOR_HIGHLIGHT_SCALE_BG   "#662266"
 
#define UI_COLOR_HIGHLIGHT_CHORD_BG   "#BB22BB"
 
#define UI_COLOR_HIGHLIGHT_BASS_BG   UI_COLOR_LIGHT_BLUEISH
 
#define UI_COLOR_HIGHLIGHT_BOTH_BG   "#FF22FF"
 
#define UI_COLOR_HIGHLIGHT_SCALE_FG   "#F79616"
 
#define UI_COLOR_HIGHLIGHT_CHORD_FG   UI_COLOR_HIGHLIGHT_SCALE_FG
 
#define UI_COLOR_HIGHLIGHT_BASS_FG   "white"
 
#define UI_COLOR_HIGHLIGHT_BOTH_FG   "white"
 
#define UI_COLOR_FADER_FILL_END   UI_COLOR_Z_YELLOW
 
#define UI_DELETE_ICON_NAME   "z-edit-delete"
 
#define UI_RESIZE_CURSOR_SPACE   8
 Space on the edges to show resize cursors.
 
#define TARGET_ENTRY_PLUGIN_DESCR   "PLUGIN_DESCR"
 Plugin descriptor, used to instantiate plugins.
 
#define TARGET_ENTRY_SUPPORTED_FILE   "SUPPORTED_FILE"
 For SupportedFile pointers.
 
#define TARGET_ENTRY_PLUGIN   "PLUGIN"
 Plugin ID, used to move/copy plugins.
 
#define TARGET_ENTRY_FILE_PATH   "FILE_PATH"
 
#define TARGET_ENTRY_URI_LIST   "text/uri-list"
 URI list.
 
#define TARGET_ENTRY_TRACK   "TRACK"
 Track target entry.
 
#define TARGET_ENTRY_CHORD_DESCR   "CHORD_DESCR"
 Chord descriptor target entry.
 
#define TARGET_ENTRY_TL_SELECTIONS   "TL_SELECTIONS"
 
#define GET_ATOM(x)   gdk_atom_intern (x, 1)
 
#define ui_add_widget_tooltip(widget, txt)    gtk_widget_set_tooltip_text (GTK_WIDGET (widget), txt)
 
#define ui_set_hover_status_bar_signals(w, t)
 
#define ui_show_notification_idle_printf(fmt, ...)
 Shows the notification when idle.
 
#define ui_show_notification_idle(msg)    ui_show_notification_idle_printf ("%s", msg)
 
#define ui_is_widget_revealed(widget)
 
#define ui_set_pencil_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "edit-cursor", 2, 3);
 
#define ui_set_brush_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "brush-cursor", 2, 3);
 
#define ui_set_cut_clip_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "cut-cursor", 9, 7);
 
#define ui_set_eraser_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "eraser-cursor", 4, 2);
 
#define ui_set_line_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "ramp-cursor", 2, 3);
 
#define ui_set_speaker_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "audition-cursor", 10, 12);
 
#define ui_set_hand_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "move-cursor", 12, 11);
 
#define ui_set_left_resize_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "w-resize-cursor", 14, 11);
 
#define ui_set_left_stretch_cursor(widget)
 
#define ui_set_left_resize_loop_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "w-loop-cursor", 14, 11);
 
#define ui_set_right_resize_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "e-resize-cursor", 10, 11);
 
#define ui_set_right_stretch_cursor(widget)
 
#define ui_set_right_resize_loop_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "e-loop-cursor", 10, 11);
 
#define ui_set_time_select_cursor(widget)
 
#define ui_set_fade_in_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "fade-in-cursor", 3, 1);
 
#define ui_set_fade_out_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "fade-out-cursor", 3, 1);
 
#define UI_ACTIVE_WINDOW_OR_NULL
 
#define ui_show_message_printf(title, fmt, ...)
 Type can be GTK_MESSAGE_ERROR, etc.
 
#define ui_show_message_literal(title, str)    ui_show_message_full (GTK_WIDGET (UI_ACTIVE_WINDOW_OR_NULL), title, "%s", str)
 Type can be GTK_MESSAGE_ERROR, etc.
 
#define ui_show_error_message_printf(title, fmt, ...)    ui_show_message_printf (title, fmt, __VA_ARGS__);
 Wrapper to show error message so that no casting of the window is needed on the caller side.
 
#define ui_show_error_message(title, msg)   ui_show_message_literal (title, msg)
 

Typedefs

typedef struct ProgressInfo ProgressInfo
 
typedef uint8_t midi_byte_t
 MIDI byte.
 
typedef uint32_t nframes_t
 Frame count.
 
typedef uint32_t sample_rate_t
 Sample rate.
 
typedef uint32_t midi_time_t
 MIDI time in global frames.
 
typedef unsigned int channels_t
 Number of channels.
 
typedef float sample_t
 The sample type.
 
typedef float bpm_t
 The BPM type.
 
typedef double curviness_t
 
typedef int_fast64_t signed_frame_t
 Signed type for frame index.
 
typedef uint_fast64_t unsigned_frame_t
 Unsigned type for frame index.
 
typedef signed_frame_t signed_ms_t
 Signed millisecond index.
 
typedef signed_frame_t signed_sec_t
 Signed second index.
 
typedef float(* GenericFloatGetter) (void *object)
 Getter prototype for float values.
 
typedef void(* GenericFloatSetter) (void *object, float val)
 Setter prototype for float values.
 
typedef const char *(* GenericStringGetter) (void *object)
 Getter prototype for strings.
 
typedef void(* GenericStringSetter) (void *object, const char *val)
 Setter prototype for float values.
 
typedef void(* GenericStringCopyGetter) (void *object, char *buf)
 Getter prototype for strings to be saved in the given buffer.
 
typedef void(* GenericCallback) (void *object)
 Generic callback.
 
typedef int(* GenericCmpFunc) (const void *a, const void *b)
 Generic comparator.
 
typedef bool(* GenericPredicateFunc) (const void *object, const void *user_data)
 Predicate function prototype.
 
typedef void(* ObjectFreeFunc) (void *)
 Function to call to free objects.
 
typedef void ZVampPlugin
 

Enumerations

enum class  ZFileType {
  FILE_TYPE_MIDI , FILE_TYPE_MP3 , FILE_TYPE_FLAC , FILE_TYPE_OGG ,
  FILE_TYPE_WAV , FILE_TYPE_DIR , ZFileType::FILE_TYPE_PARENT_DIR , FILE_TYPE_OTHER ,
  NUM_FILE_TYPES
}
 File type. More...
 
enum class  BitDepth { BIT_DEPTH_16 , BIT_DEPTH_24 , BIT_DEPTH_32 }
 Bit depth. More...
 
enum  ZGtkResize { Z_GTK_NO_RESIZE , Z_GTK_RESIZE }
 
enum  ZGtkShrink { Z_GTK_NO_SHRINK , Z_GTK_SHRINK }
 
enum  HashAlgorithm { HASH_ALGORITHM_XXH32 , HASH_ALGORITHM_XXH3_64 }
 
enum  ProgressStatus { PROGRESS_STATUS_PENDING_START , PROGRESS_STATUS_PENDING_CANCELLATION , PROGRESS_STATUS_RUNNING , PROGRESS_STATUS_COMPLETED }
 
enum  ProgressCompletionType { PROGRESS_COMPLETED_CANCELLED , PROGRESS_COMPLETED_HAS_WARNING , PROGRESS_COMPLETED_HAS_ERROR , PROGRESS_COMPLETED_SUCCESS }
 
enum  ResamplerQuality {
  RESAMPLER_QUALITY_QUICK , RESAMPLER_QUALITY_LOW , RESAMPLER_QUALITY_MEDIUM , RESAMPLER_QUALITY_HIGH ,
  RESAMPLER_QUALITY_VERY_HIGH
}
 
enum  AudioValueFormat { AUDIO_VALUE_AMPLITUDE , AUDIO_VALUE_DBFS , AUDIO_VALUE_FADER }
 
enum  CacheTypes {
  CACHE_TYPE_TRACK_NAME_HASHES = 1 << 0 , CACHE_TYPE_PLUGIN_PORTS = 1 << 1 , CACHE_TYPE_PLAYBACK_SNAPSHOTS = 1 << 2 , CACHE_TYPE_AUTOMATION_LANE_RECORD_MODES = 1 << 3 ,
  CACHE_TYPE_AUTOMATION_LANE_PORTS = 1 << 4
}
 
enum  UiDetail { UI_DETAIL_HIGH , UI_DETAIL_NORMAL , UI_DETAIL_LOW , UI_DETAIL_ULTRA_LOW }
 
enum  UiCursorState {
  UI_CURSOR_STATE_DEFAULT , UI_CURSOR_STATE_RESIZE_L , UI_CURSOR_STATE_REPEAT_L , UI_CURSOR_STATE_RESIZE_R ,
  UI_CURSOR_STATE_REPEAT_R , UI_CURSOR_STATE_RESIZE_UP
}
 Various cursor states to be shared. More...
 
enum  UiOverlayAction {
  UI_OVERLAY_ACTION_NONE , UI_OVERLAY_ACTION_CREATING_RESIZING_R , UI_OVERLAY_ACTION_CREATING_MOVING , UI_OVERLAY_ACTION_RESIZING_L ,
  UI_OVERLAY_ACTION_RESIZING_L_LOOP , UI_OVERLAY_ACTION_RESIZING_L_FADE , UI_OVERLAY_ACTION_RESIZING_R , UI_OVERLAY_ACTION_RESIZING_R_LOOP ,
  UI_OVERLAY_ACTION_RESIZING_R_FADE , UI_OVERLAY_ACTION_RESIZING_UP , UI_OVERLAY_ACTION_RESIZING_UP_FADE_IN , UI_OVERLAY_ACTION_RESIZING_UP_FADE_OUT ,
  UI_OVERLAY_ACTION_STRETCHING_L , UI_OVERLAY_ACTION_STRETCHING_R , UI_OVERLAY_ACTION_STARTING_AUDITIONING , UI_OVERLAY_ACTION_AUDITIONING ,
  UI_OVERLAY_ACTION_AUTOFILLING , UI_OVERLAY_ACTION_ERASING , UI_OVERLAY_ACTION_STARTING_ERASING , UI_OVERLAY_ACTION_STARTING_MOVING ,
  UI_OVERLAY_ACTION_STARTING_MOVING_COPY , UI_OVERLAY_ACTION_STARTING_MOVING_LINK , UI_OVERLAY_ACTION_MOVING , UI_OVERLAY_ACTION_MOVING_COPY ,
  UI_OVERLAY_ACTION_MOVING_LINK , UI_OVERLAY_ACTION_STARTING_CHANGING_CURVE , UI_OVERLAY_ACTION_CHANGING_CURVE , UI_OVERLAY_ACTION_STARTING_SELECTION ,
  UI_OVERLAY_ACTION_SELECTING , UI_OVERLAY_ACTION_STARTING_DELETE_SELECTION , UI_OVERLAY_ACTION_DELETE_SELECTING , UI_OVERLAY_ACTION_STARTING_RAMP ,
  UI_OVERLAY_ACTION_RAMPING , UI_OVERLAY_ACTION_CUTTING , UI_OVERLAY_ACTION_RENAMING , UI_OVERLAY_ACTION_STARTING_PANNING ,
  UI_OVERLAY_ACTION_PANNING , NUM_UI_OVERLAY_ACTIONS
}
 Various overlay actions to be shared. More...
 
enum  UiDragMode { UI_DRAG_MODE_CURSOR , UI_DRAG_MODE_RELATIVE , UI_DRAG_MODE_RELATIVE_WITH_MULTIPLIER }
 Dragging modes for widgets that have click&drag. More...
 
enum  ZVampPluginType { Z_VAMP_PLUGIN_BEAT_TRACKER , Z_VAMP_PLUGIN_FIXED_TEMPO_ESTIMATOR }
 

Functions

SupportedFilesupported_file_new_from_path (const char *path)
 Creates a new SupportedFile from the given absolute path.
 
SupportedFilesupported_file_new_from_uri (const char *uri, GError **error)
 
char * supported_file_type_get_description (ZFileType type)
 Returns a human readable description of the given file type.
 
SupportedFilesupported_file_clone (const SupportedFile *src)
 Clones the given SupportedFile.
 
int supported_file_type_is_supported (ZFileType type)
 Returns if the given type is supported.
 
int supported_file_type_is_audio (ZFileType type)
 Returns if the SupportedFile is an audio file.
 
int supported_file_type_is_midi (ZFileType type)
 Returns if the SupportedFile is a midi file.
 
const char * supported_file_type_get_ext (ZFileType type)
 Returns the most common extension for the given filetype.
 
NONNULL ZFileType supported_file_get_type (const char *file)
 Returns the file type of the given file path.
 
NONNULL bool supported_file_should_autoplay (const SupportedFile *self)
 Returns whether the given file should auto-play (shorter than 1 min).
 
const char * supported_file_get_icon_name (const SupportedFile *const self)
 Gets the corresponding icon name for the given SupportedFile's type.
 
NONNULL char * supported_file_get_info_text_for_label (const SupportedFile *self)
 Returns a pango markup to be used in GTK labels.
 
void supported_file_free (SupportedFile *self)
 Frees the instance and all its members.
 
BitDepth audio_bit_depth_from_pretty_str (const char *str)
 
const char * audio_bit_depth_to_pretty_str (BitDepth depth)
 
WARN_UNUSED_RESULT bool audio_write_raw_file (float *buff, size_t frames_already_written, size_t nframes, uint32_t samplerate, bool flac, BitDepth bit_depth, channels_t channels, const char *filename, GError **error)
 Writes the buffer as a raw file to the given path.
 
unsigned_frame_t audio_get_num_frames (const char *filepath)
 Returns the number of frames in the given audio file.
 
bool audio_frames_equal (const float *src1, const float *src2, size_t num_frames, float epsilon)
 Returns whether the frame buffers are equal.
 
bool audio_files_equal (const char *f1, const char *f2, size_t num_frames, float epsilon)
 Returns whether the file contents are equal.
 
bool audio_frames_empty (float *src, size_t num_frames)
 Returns whether the frame buffer is empty (zero).
 
float audio_detect_bpm (float *src, size_t num_frames, unsigned int samplerate, GArray *candidates)
 Detect BPM.
 
bool audio_file_is_silent (const char *filepath)
 
int audio_get_num_cores (void)
 Returns the number of CPU cores.
 
char * _backtrace_get (const char *exe_path, const char *prefix, int max_lines, bool with_lines, bool write_to_file)
 Returns the backtrace with max_lines number of lines and a string prefix.
 
void z_cairo_draw_horizontal_line (cairo_t *cr, double y, double from_x, double to_x, double line_width, double alpha)
 
void z_cairo_draw_vertical_line (cairo_t *cr, double x, double from_y, double to_y, double line_width)
 
void _z_cairo_get_text_extents_for_widget (GtkWidget *widget, PangoLayout *layout, const char *text, int *width, int *height)
 Gets the width of the given text in pixels for the given widget.
 
void z_cairo_draw_text_full (cairo_t *cr, GtkWidget *widget, PangoLayout *layout, const char *text, int start_x, int start_y)
 Draws the given text using the given font starting at the given position.
 
cairo_surface_t * z_cairo_get_surface_from_icon_name (const char *icon_name, int size, int scale)
 Returns a surface for the icon name.
 
PangoLayout * z_cairo_create_pango_layout_from_string (GtkWidget *widget, const char *font, PangoEllipsizeMode ellipsize_mode, int ellipsize_padding)
 Creates a PangoLayout to be cached in widgets based on the given settings.
 
PangoLayout * z_cairo_create_pango_layout_from_description (GtkWidget *widget, PangoFontDescription *descr, PangoEllipsizeMode ellipsize_mode, int ellipsize_padding)
 Creates a PangoLayout to be cached in widgets based on the given settings.
 
PangoLayout * z_cairo_create_default_pango_layout (GtkWidget *widget)
 Creates a PangoLayout with default settings.
 
void z_cairo_reset_caches (cairo_t **cr_cache, cairo_surface_t **surface_cache, int width, int height, cairo_t *new_cr)
 Resets a surface and cairo_t with a new surface and cairo_t based on the given rectangle and cairo_t.
 
CairoCachesz_cairo_caches_new (void)
 
void z_cairo_caches_free (CairoCaches *self)
 
void color_brighten (GdkRGBA *src, float val)
 Brightens the color by the given amount.
 
void color_brighten_default (GdkRGBA *src)
 Brightens the color by the default amount.
 
void color_darken (GdkRGBA *src, float val)
 Darkens the color by the given amount.
 
void color_darken_default (GdkRGBA *src)
 Darkens the color by the default amount.
 
bool color_is_same (GdkRGBA *src, GdkRGBA *dest)
 Returns whether the color is the same.
 
bool color_is_bright (GdkRGBA *src)
 Returns if the color is bright or not.
 
bool color_is_very_bright (GdkRGBA *src)
 Returns if the color is very bright or not.
 
bool color_is_very_very_bright (GdkRGBA *src)
 Returns if the color is very very bright or not.
 
bool color_is_very_dark (GdkRGBA *src)
 Returns if the color is very dark or not.
 
bool color_is_very_very_dark (GdkRGBA *src)
 Returns if the color is very very dark or not.
 
void color_get_opposite (GdkRGBA *src, GdkRGBA *dest)
 
float color_get_brightness (GdkRGBA *color)
 
float color_get_darkness (GdkRGBA *color)
 
void color_morph (GdkRGBA *a, GdkRGBA *b, float amt, GdkRGBA *result)
 Morphs from a to b, depending on the given amount.
 
char * z_curl_get_page_contents (const char *url, int timeout, GError **error)
 Returns the contents of the page in a newly allocated string.
 
char * z_curl_get_page_contents_default (const char *url)
 Returns the contents of the page in a newly allocated string.
 
int z_curl_post_json_no_auth (const char *url, const char *data, int timeout, GError **error,...) G_GNUC_NULL_TERMINATED
 Posts the given JSON to the URL without any authentication.
 
char * z_curl_get_page_contents_finish (GAsyncResult *res, GError **error)
 
void z_curl_get_page_contents_async (const char *url, int timeout_sec, GAsyncReadyCallback callback, gpointer callback_data)
 
char * datetime_get_current_as_string (void)
 Returns the current datetime as a string.
 
char * datetime_epoch_to_str (gint64 epoch, const char *format)
 
char * datetime_get_for_filename (void)
 Get the current datetime to be used in filenames, eg, for the log file.
 
char * env_get_string (const char *key, const char *def)
 Returns a newly allocated string.
 
int env_get_int (const char *key, int def)
 Returns an int for the given environment variable if it exists and is valid, otherwise returns the default int.
 
char * file_path_relative_to (const char *path, const char *base)
 
int file_symlink (const char *old_path, const char *new_path)
 
int file_reflink (const char *dest, const char *src)
 Do cp –reflink from src to dest.
 
unsigned int utils_get_uint_from_bitfield_val (unsigned int bitfield)
 From https://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightLinear.
 
GdkMonitor * z_gtk_get_primary_monitor (void)
 
int z_gtk_get_primary_monitor_scale_factor (void)
 
int z_gtk_get_primary_monitor_refresh_rate (void)
 
bool z_gtk_is_wayland (void)
 
void z_gtk_tree_view_remove_all_columns (GtkTreeView *treeview)
 
void z_gtk_column_view_remove_all_columnes (GtkColumnView *column_view)
 
GListStore * z_gtk_column_view_get_list_store (GtkColumnView *column_view)
 
void z_gtk_list_store_splice (GListStore *store, GPtrArray *ptr_array)
 Removes all items and re-populates the list store.
 
void z_gtk_widget_remove_all_children (GtkWidget *widget)
 
void z_gtk_widget_destroy_all_children (GtkWidget *widget)
 
void z_gtk_widget_remove_children_of_type (GtkWidget *widget, GType type)
 
void z_gtk_overlay_add_if_not_exists (GtkOverlay *overlay, GtkWidget *widget)
 
void z_gtk_button_set_icon_name_and_text (GtkButton *btn, const char *name, const char *text, bool icon_first, GtkOrientation orientation, int spacing)
 Sets the icon name and optionally text.
 
GtkToggleButton * z_gtk_toggle_button_new_with_icon (const char *name)
 Creates a toggle button with the given icon name.
 
GtkToggleButton * z_gtk_toggle_button_new_with_icon_and_text (const char *name, const char *text, bool icon_first, GtkOrientation orientation, int spacing)
 Creates a toggle button with the given icon name.
 
GtkButton * z_gtk_button_new_with_icon_and_text (const char *name, const char *text, bool icon_first, GtkOrientation orientation, int spacing)
 Creates a button with the given icon name and text.
 
GMenuItem * z_gtk_create_menu_item_full (const gchar *label_name, const gchar *icon_name, const char *detailed_action)
 Creates a menu item.
 
char * z_gtk_get_tooltip_for_action (const char *detailed_action, const char *tooltip)
 Gets the tooltip for the given action on the given widget.
 
void z_gtk_widget_set_tooltip_for_action (GtkWidget *widget, const char *detailed_action, const char *tooltip)
 Sets the tooltip for the given action on the given widget.
 
void z_gtk_set_tooltip_for_actionable (GtkActionable *actionable, const char *tooltip)
 Sets the tooltip and finds the accel keys and appends them to the tooltip in small text.
 
GtkWidget * z_gtk_widget_get_nth_child (GtkWidget *widget, int index)
 Returns the nth child of a container.
 
void z_gtk_button_set_emblem (GtkButton *btn, const char *emblem_icon)
 Sets the given emblem to the button, or unsets the emblem if emblem_icon is NULL.
 
void z_gtk_setup_foldable_notebook (GtkNotebook *notebook)
 Makes the given notebook foldable.
 
void z_gtk_widget_set_margin (GtkWidget *widget, int margin)
 Sets the margin on all 4 sides on the widget.
 
GtkFlowBoxChild * z_gtk_flow_box_get_selected_child (GtkFlowBox *self)
 
bool z_gtk_activate_dir_link_func (GtkLabel *label, char *uri, void *data)
 Callback to use for simple directory links.
 
GtkSourceLanguageManager * z_gtk_source_language_manager_get (void)
 
void z_gtk_notebook_make_detachable (GtkNotebook *notebook, GtkWindow *parent_window)
 Makes the given GtkNotebook detachable to a new window.
 
char * z_gtk_text_buffer_get_full_text (GtkTextBuffer *buffer)
 Returns the full text contained in the text buffer.
 
void z_gtk_generate_screenshot_image (GtkWidget *widget, const char *type, char **option_keys, char **option_values, char **ret_dir, char **ret_path, bool accept_fallback)
 Generates a screenshot image for the given widget.
 
void z_gtk_actionable_set_action_from_setting (GtkActionable *actionable, GSettings *settings, const char *key)
 Sets the action target of the given GtkActionable to be binded to the given setting.
 
bool z_gtk_is_event_button (GdkEvent *ev)
 
void z_gtk_scrolled_window_get_visible_rect (GtkScrolledWindow *scroll, graphene_rect_t *rect)
 Gets the visible rectangle from the scrolled window's adjustments.
 
void z_gtk_graphene_rect_t_to_gdk_rectangle (GdkRectangle *rect, graphene_rect_t *grect)
 
void z_gdk_rectangle_to_graphene_rect_t (graphene_rect_t *grect, GdkRectangle *rect)
 
void z_gdk_rectangle_print (const GdkRectangle *rect)
 
int z_gtk_dialog_run (GtkDialog *dialog, bool destroy_on_close)
 Mimics the blocking behavior.
 
void z_gtk_show_context_menu_from_g_menu (GtkPopoverMenu *popover_menu, double x, double y, GMenu *menu)
 The popover must already exist as a children of its intended widget (or a common parent).
 
GdkDragAction z_gtk_drop_target_get_selected_action (GtkDropTarget *drop_target)
 Returns the bitmask of the selected action during a drop (eg, GDK_ACTION_COPY).
 
GtkIconTheme * z_gtk_icon_theme_get_default (void)
 
char * z_gdk_clipboard_get_text (GdkClipboard *clipboard)
 Returns the text on the clipboard, or NULL if there is nothing or the content is not text.
 
GdkPixbuf * z_gdk_pixbuf_new_from_icon_name (const char *icon_name, int width, int height, int scale, GError **error)
 Creates a new pixbuf for the given icon scaled at the given width/height.
 
GdkTexture * z_gdk_texture_new_from_icon_name (const char *icon_name, int width, int height, int scale)
 Creates a new texture for the given icon scaled at the given width/height.
 
void z_gtk_print_graphene_rect (graphene_rect_t *rect)
 
void z_gtk_widget_print_hierarchy (GtkWidget *widget)
 Prints the widget's hierarchy (parents).
 
const char * z_gtk_get_gsk_renderer_type (void)
 
gboolean z_gtk_simple_action_shortcut_func (GtkWidget *widget, GVariant *args, gpointer user_data)
 A shortcut callback to use for simple actions.
 
GtkWidget * z_gtk_widget_find_child_of_type (GtkWidget *widget, GType type)
 Recursively searches the children of widget for a child of type type.
 
void z_gtk_list_box_remove_all_children (GtkListBox *list_box)
 
void z_graphene_rect_print (const graphene_rect_t *rect)
 
GtkStringList * z_gtk_string_list_new_from_string_array (const char **strvals, size_t num_vals, bool localized)
 
GtkWidget * z_gtk_get_first_focusable_child (GtkWidget *parent)
 
bool z_gtk_descendant_has_focus (GtkWidget *parent)
 
void z_gtk_window_make_escapable (GtkWindow *self)
 
void z_gtk_drop_down_list_item_header_setup_common (GtkSignalListItemFactory *factory, GObject *list_item, gpointer user_data)
 A common "setup" signal handler for GtkDropDown header factories.
 
void z_gtk_drop_down_factory_setup_common (GtkSignalListItemFactory *factory, GObject *list_item, gpointer user_data)
 
void z_gtk_drop_down_factory_setup_common_ellipsized (GtkSignalListItemFactory *factory, GObject *list_item, gpointer user_data)
 
const char * z_gtk_get_enum_nick (GType type, gint value)
 
char * hash_get_from_file (const char *filepath, HashAlgorithm algo)
 
uint32_t hash_get_from_file_simple (const char *filepath)
 
void * hash_create_state (void)
 
void hash_free_state (void *in_state)
 
uint32_t hash_get_for_struct_full (XXH32_state_t *state, const void *const obj, size_t size)
 
uint32_t hash_get_for_struct (const void *const obj, size_t size)
 
NONNULL char * io_get_dir (const char *filename)
 Gets directory part of filename.
 
WARN_UNUSED_RESULT NONNULL_ARGS (1) bool io_mkdir(const char *dir
 Makes directory if doesn't exist.
 
NONNULL FILE * io_create_file (const char *filename)
 Creates the file if doesn't exist.
 
void io_touch_file (const char *filename)
 Touches a file similar to UNIX touch.
 
NONNULL char * io_path_get_parent_dir (const char *path)
 
NONNULL char * io_file_strip_ext (const char *filename)
 Strips extensions from given filename.
 
NONNULL const char * io_file_get_ext (const char *file)
 Returns file extension or NULL.
 
NONNULL char * io_path_get_basename_without_ext (const char *filename)
 Strips path from given filename.
 
NONNULL char * io_file_get_creation_datetime (const char *filename)
 
NONNULL gint64 io_file_get_last_modified_datetime (const char *filename)
 Returns the number of seconds since the epoch, or -1 if failed.
 
NONNULL char * io_file_get_last_modified_datetime_as_str (const char *filename)
 
NONNULL int io_remove (const char *path)
 Removes the given file.
 
NONNULL int io_rmdir (const char *path, bool force)
 Removes a dir, optionally forcing deletion.
 
char ** io_get_files_in_dir_as_basenames (const char *dir, bool allow_empty, bool with_ext)
 
char ** io_get_files_in_dir_ending_in (const char *_dir, const int recursive, const char *end_string, bool allow_empty)
 Returns a list of the files in the given directory.
 
WARN_UNUSED_RESULT bool io_copy_dir (const char *destdir_str, const char *srcdir_str, bool follow_symlinks, bool recursive, GError **error)
 Copies a directory.
 
NONNULL char * io_get_next_available_filepath (const char *filepath)
 Returns a newly allocated path that is either a copy of the original path if the path does not exist, or the original path appended with (n), where n is a number.
 
NONNULL void io_open_directory (const char *path)
 Opens the given directory using the default program.
 
NONNULL void io_escape_dir_name (char *dest, const char *dir)
 Returns a clone of the given string after removing forbidden characters.
 
NONNULL char * io_traverse_path (const char *abs_path)
 Returns the new path after traversing any symlinks (using readlink()).
 
NONNULL void log_init_writer_idle (Log *self, unsigned int secs)
 Initializes logging to a file.
 
NONNULL int log_idle_cb (Log *self)
 Idle callback.
 
NONNULL char * log_get_last_n_lines (Log *self, int n)
 Returns the last n lines as a newly allocated string.
 
bool log_generate_compressed_file (Log *self, char **ret_dir, char **ret_path, GError **error)
 Generates a compressed log file (for sending with bug reports).
 
WARN_UNUSED_RESULT bool log_init_with_file (Log *self, const char *filepath, GError **error)
 Initializes logging to a file.
 
CONST WARN_UNUSED_RESULT Log ** log_get (void)
 Returns a pointer to the global zlog.
 
Loglog_new (void)
 Creates the logger and sets the writer func.
 
NONNULL void log_free (Log *self)
 Stops logging and frees any allocated memory.
 
sample_t math_calculate_rms_amp (sample_t *buf, const nframes_t nframes)
 
sample_t math_calculate_rms_db (sample_t *buf, const nframes_t nframes)
 Calculate db using RMS method.
 
bool math_assert_nonnann (float x)
 Asserts that the value is non-nan.
 
bool math_is_string_valid_float (const char *str, float *ret)
 Returns whether the given string is a valid float.
 
MPMCQueuempmc_queue_new (void)
 
NONNULL void mpmc_queue_reserve (MPMCQueue *self, size_t buffer_size)
 
NONNULL void mpmc_queue_free (MPMCQueue *self)
 
NONNULL void mpmc_queue_clear (MPMCQueue *self)
 
HOT NONNULL int mpmc_queue_push_back (MPMCQueue *self, void *const data)
 
HOT NONNULL int mpmc_queue_dequeue (MPMCQueue *self, void **data)
 
PangoLayout * z_pango_create_layout_from_description (GtkWidget *widget, PangoFontDescription *descr)
 
ProgressInfo * progress_info_new (void)
 
ProgressStatus progress_info_get_status (ProgressInfo *self)
 
ProgressCompletionType progress_info_get_completion_type (ProgressInfo *self)
 
void progress_info_request_cancellation (ProgressInfo *self)
 To be called by the task caller.
 
void progress_info_mark_completed (ProgressInfo *self, ProgressCompletionType type, const char *msg)
 To be called by the task itself.
 
char * progress_info_get_message (ProgressInfo *self)
 Returns a newly allocated string.
 
void progress_info_get_progress (ProgressInfo *self, double *progress, char **str)
 To be called by the task caller.
 
void progress_info_update_progress (ProgressInfo *self, double progress, const char *msg)
 To be called by the task itself.
 
bool progress_info_pending_cancellation (ProgressInfo *self)
 
void progress_info_free (ProgressInfo *self)
 
Resamplerresampler_new (const float *in_frames, const size_t num_in_frames, const double input_rate, const double output_rate, const unsigned int num_channels, const ResamplerQuality quality, GError **error)
 Creates a new instance of a Resampler with the given settings.
 
NONNULL bool resampler_is_done (Resampler *self)
 Indicates whether resampling is finished.
 
NONNULL void resampler_free (Resampler *self)
 
void resources_set_class_template (GtkWidgetClass *klass, const char *filename)
 Sets class template from resource.
 
GBytes * resources_get_gl_shader_data (const char *path)
 Returns the bytes of the specified OpenGL shader in RESOURCES_GL_SHADERS_PATH.
 
int sort_alphabetical_func (const void *a, const void *b)
 Alphabetical sort func.
 
Stackstack_new (int length)
 Creates a new stack of the given size.
 
int stack_size (Stack *s)
 
int stack_is_empty (Stack *s)
 
int stack_is_full (Stack *s)
 
void * stack_peek (Stack *s)
 
void * stack_peek_last (Stack *s)
 
void stack_push (Stack *s, void *element)
 
void * stack_pop (Stack *s)
 
void * stack_pop_last (Stack *s)
 Pops the last element and moves everything back.
 
void stack_free_members (Stack *s)
 
void stack_free (Stack *s)
 
int string_is_ascii (const char *string)
 Returns if the string is ASCII.
 
char * string_array_contains_substr (char **str_array, int num_str, const char *substr)
 Returns the matched string if the string array contains the given substring.
 
bool string_contains_substr (const char *str, const char *substr)
 Returns if the given string contains the given substring.
 
bool string_contains_substr_case_insensitive (const char *str, const char *substr)
 
void string_to_upper (const char *in, char *out)
 Converts the given string to uppercase in out.
 
void string_to_lower (const char *in, char *out)
 Converts the given string to lowercase in out.
 
bool string_is_equal_ignore_case (const char *str1, const char *str2)
 Returns if the two strings are equal ignoring case.
 
NONNULL char * string_convert_to_filename (const char *str)
 Returns a newly allocated string that is a filename version of the given string.
 
MALLOC NONNULL char * string_get_substr_before_suffix (const char *str, const char *suffix)
 Removes the suffix starting from suffix from full_str and returns a newly allocated string.
 
char * string_remove_until_after_first_match (const char *str, const char *match)
 Removes everything up to and including the first match of match from the start of the string and returns a newly allocated string.
 
void string_replace_regex (char **str, const char *regex, const char *replace_str)
 Replaces src_str with replace_str in all instances matched by regex.
 
char * string_replace (const char *str, const char *from, const char *to)
 
char * string_get_regex_group (const char *str, const char *regex, int group)
 Gets the string in the given regex group.
 
int string_get_regex_group_as_int (const char *str, const char *regex, int group, int def)
 Gets the string in the given regex group as an integer.
 
int string_get_int_after_last_space (const char *str, char *str_without_num)
 Returns the integer found at the end of a string like "My String 3" -> 3, or -1 if no number is found.
 
char ** string_array_sort_and_remove_duplicates (char **str_arr)
 TODO Sorts the given string array and removes duplicates.
 
void string_copy_w_realloc (char **dest, const char *src)
 Copies the string src to the buffer in dest after reallocating the buffer in dest to the length of src.
 
char * string_symbolify (const char *in)
 Returns a new string with only ASCII alphanumeric characters and replaces the rest with underscore.
 
bool string_is_empty (const char *str)
 Returns whether the string is NULL or empty.
 
int string_utf8_strcasecmp (const char *s1, const char *s2)
 Compares two UTF-8 strings using approximate case-insensitive ordering.
 
char * string_expand_env_vars (const char *src)
 Expands environment variables enclosed in ${} in the given string.
 
void string_print_strv (const char *prefix, char **strv)
 
char ** string_array_clone (const char **src)
 Clones the given string array.
 
char * system_get_cmd_output (char **argv, long ms_timer, bool always_wait)
 Runs the command and returns the output, or NULL.
 
void ui_set_pointer_cursor (GtkWidget *widget)
 
void ui_set_cursor_from_icon_name (GtkWidget *widget, const char *name, int offset_x, int offset_y)
 Sets cursor from icon name.
 
void ui_set_cursor_from_name (GtkWidget *widget, const char *name)
 Sets cursor from standard cursor name.
 
gboolean ui_on_motion_set_status_bar_text_cb (GtkWidget *widget, GdkEvent *event, char *text)
 
AdwDialog * ui_show_message_full (GtkWidget *parent, const char *title, const char *format,...) G_GNUC_PRINTF(3
 Shows a popup message of the given type with the given message.
 
bool ui_is_point_in_rect_hit (GdkRectangle *rect, const bool check_x, const bool check_y, double x, double y, double x_padding, double y_padding)
 Returns if rect is hit or not by the given coordinate.
 
NONNULL int ui_is_child_hit (GtkWidget *parent, GtkWidget *child, const int check_x, const int check_y, const double x, const double y, const double x_padding, const double y_padding)
 Returns if the child is hit or not by the coordinates in parent.
 
GtkWidget * ui_get_hit_child (GtkWidget *parent, double x, double y, GType type)
 Returns the matching hit child, or NULL.
 
UiDetail ui_get_detail_level (void)
 
NONNULL void ui_px_to_pos_timeline (double px, Position *pos, bool has_padding)
 Converts from pixels to position.
 
signed_frame_t ui_px_to_frames_timeline (double px, bool has_padding)
 Converts from pixels to frames.
 
signed_frame_t ui_px_to_frames_editor (double px, bool has_padding)
 Converts from pixels to frames.
 
NONNULL int ui_pos_to_px_timeline (const Position *pos, int use_padding)
 Converts position to px, optionally adding the ruler padding.
 
NONNULL int ui_pos_to_px_editor (const Position *pos, bool use_padding)
 Converts position to px, optionally adding the ruler padding.
 
NONNULL void ui_px_to_pos_editor (double px, Position *pos, bool has_padding)
 Converts from pixels to position.
 
void ui_rgb_to_hex (double red, double green, double blue, char *buf)
 Converts RGB to hex string.
 
void ui_gdk_rgba_to_hex (GdkRGBA *color, char *buf)
 
void ui_show_notification (const char *msg)
 Shows a notification in the revealer.
 
int ui_show_notification_idle_func (char *msg)
 Show notification from non-GTK threads.
 
void ui_setup_language_combo_row (AdwComboRow *combo_row)
 Sets up a combo box to have a selection of languages.
 
AdwComboRow * ui_gen_audio_backends_combo_row (bool with_signal)
 Generates a combo row for selecting the audio backend.
 
AdwComboRow * ui_gen_midi_backends_combo_row (bool with_signal)
 Generates a combo row for selecting the MIDI backend.
 
void ui_setup_audio_device_name_combo_row (AdwComboRow *combo_row, bool populate, bool with_signal)
 Sets up a combo row for selecting the audio device name.
 
void ui_setup_vst_paths_entry (GtkEntry *entry)
 Sets up the VST paths entry.
 
void ui_update_vst_paths_from_entry (GtkEntry *entry)
 Updates the the VST paths in the gsettings from the text in the entry.
 
char * ui_get_locale_not_available_string (LocalizationLanguage lang)
 Returns the "a locale for the language you have selected..." text based on the given language.
 
void ui_show_warning_for_tempo_track_experimental_feature (void)
 
void ui_get_contrast_color (GdkRGBA *src, GdkRGBA *dest)
 Returns the contrasting color (variation of black or white) based on if the given color is dark enough or not.
 
void ui_get_mid_color (GdkRGBA *dest, const GdkRGBA *c1, const GdkRGBA *c2, const float transition)
 Returns the color in-between two colors.
 
void ui_get_arranger_object_color (GdkRGBA *color, const bool is_hovered, const bool is_selected, const bool is_transient, const bool is_muted)
 Gets the color the widget should be.
 
double ui_get_normalized_draggable_value (double size, double cur_val, double start_px, double cur_px, double last_px, double multiplier, UiDragMode mode)
 Gets a draggable value as a normalized value between 0 and 1.
 
void ui_get_db_value_as_string (float val, char *buf)
 Returns an appropriate string representation of the given dB value.
 
UiCachesui_caches_new (void)
 
void ui_caches_free (UiCaches *self)
 
void vamp_print_all (void)
 Prints detected vamp plugins.
 
const VampPluginDescriptor * vamp_get_simple_fixed_tempo_estimator_descriptor (void)
 
ZVampPlugin * vamp_get_plugin (ZVampPluginType type, float samplerate)
 
void vamp_plugin_initialize (ZVampPlugin *plugin, size_t channels, size_t step_size, size_t block_size)
 
ZVampFeatureSetvamp_plugin_process (ZVampPlugin *plugin, const float *const *input_buffers, long timestamp, unsigned int samplerate)
 
ZVampFeatureSetvamp_plugin_get_remaining_features (ZVampPlugin *plugin, unsigned int samplerate)
 
size_t vamp_plugin_get_preferred_step_size (ZVampPlugin *plugin)
 
size_t vamp_plugin_get_preferred_block_size (ZVampPlugin *plugin)
 
ZVampOutputListvamp_plugin_get_output_descriptors (ZVampPlugin *plugin)
 
ZVampOutputDescriptorvamp_output_descriptor_new (const char *identifier, const char *name, const char *description, const char *unit, bool hasFixedBinCount, bool hasKnownExtents, float minValue, float maxValue, int sampleType, float sampleRate, bool hasDuration)
 
ZVampFeaturevamp_feature_new (bool has_timestamp, long timestamp, bool hasDuration, size_t duration, float *values, size_t num_values, const char *label)
 
const ZVampFeatureListvamp_feature_set_get_list_for_output (ZVampFeatureSet *self, int output_idx)
 
void vamp_feature_list_print (const ZVampFeatureList *self)
 
void vamp_feature_set_print (const ZVampFeatureSet *self)
 
void vamp_feature_print (ZVampFeature *self)
 
void vamp_plugin_output_print (ZVampOutputDescriptor *self)
 
void vamp_plugin_output_list_print (ZVampOutputList *self)
 
void vamp_feature_free (void *self)
 
void vamp_feature_list_free (void *list)
 
void vamp_output_descriptor_free (void *descr)
 
void vamp_feature_set_free (ZVampFeatureSet *self)
 
void vamp_plugin_output_list_free (ZVampOutputList *self)
 

Variables

WARN_UNUSED_RESULT GError ** error
 
Logzlog
 Global variable, available to all files.
 
GError ** error
 

Detailed Description

Various utilities.

Macro Definition Documentation

◆ backtrace_get

#define backtrace_get ( prefix,
max_lines,
write_to_file )    _backtrace_get (NULL, prefix, max_lines, false, write_to_file)

Definition at line 39 of file backtrace.h.

◆ backtrace_get_with_lines

#define backtrace_get_with_lines ( prefix,
max_lines,
write_to_file )
Value:
(gZrythm && gZrythm->exe_path_) ? gZrythm->exe_path_ : NULL, prefix, \
max_lines, gZrythm && gZrythm->exe_path_ ? true : false, write_to_file)
std::unique_ptr< Zrythm > gZrythm
Global variable, should be available to all files.
char * _backtrace_get(const char *exe_path, const char *prefix, int max_lines, bool with_lines, bool write_to_file)
Returns the backtrace with max_lines number of lines and a string prefix.

Definition at line 42 of file backtrace.h.

◆ CACHE_TYPE_ALL

#define CACHE_TYPE_ALL
Value:
(CACHE_TYPE_TRACK_NAME_HASHES | CACHE_TYPE_PLUGIN_PORTS \
| CACHE_TYPE_PLAYBACK_SNAPSHOTS | CACHE_TYPE_AUTOMATION_LANE_RECORD_MODES \
| CACHE_TYPE_AUTOMATION_LANE_PORTS)

Definition at line 179 of file types.h.

◆ CAIRO_CACHES

#define CAIRO_CACHES   (gZrythm->cairo_caches)

Definition at line 37 of file cairo.h.

◆ COLOR_DEFAULT_BRIGHTEN_VAL

#define COLOR_DEFAULT_BRIGHTEN_VAL   0.1f

Definition at line 22 of file color.h.

◆ CREATE_CLEAR_SELECTION_MENU_ITEM

#define CREATE_CLEAR_SELECTION_MENU_ITEM ( action)
Value:
z_gtk_create_menu_item (/* TRANSLATORS: deselects everything */ \
_ ("Cle_ar Selection"), "edit-clear", action)

Definition at line 44 of file gtk.h.

◆ CREATE_COPY_MENU_ITEM

#define CREATE_COPY_MENU_ITEM ( action)     z_gtk_create_menu_item (_ ("_Copy"), "edit-copy", action)

Definition at line 35 of file gtk.h.

◆ CREATE_CUT_MENU_ITEM

#define CREATE_CUT_MENU_ITEM ( action)     z_gtk_create_menu_item (_ ("Cu_t"), "edit-cut", action)

Definition at line 32 of file gtk.h.

◆ CREATE_DELETE_MENU_ITEM

#define CREATE_DELETE_MENU_ITEM ( action)     z_gtk_create_menu_item (_ ("_Delete"), "edit-delete", action)

Definition at line 41 of file gtk.h.

◆ CREATE_DUPLICATE_MENU_ITEM

#define CREATE_DUPLICATE_MENU_ITEM ( action)     z_gtk_create_menu_item (_ ("Duplicate"), "edit-duplicate", action)

Definition at line 51 of file gtk.h.

◆ CREATE_MIDI_LEARN_MENU_ITEM

#define CREATE_MIDI_LEARN_MENU_ITEM ( action)     z_gtk_create_menu_item (_ ("MIDI learn"), "signal-midi", action)

Definition at line 29 of file gtk.h.

◆ CREATE_MUTE_MENU_ITEM

#define CREATE_MUTE_MENU_ITEM ( action)     z_gtk_create_menu_item (_ ("Mute"), "mute", action)

Definition at line 54 of file gtk.h.

◆ CREATE_PASTE_MENU_ITEM

#define CREATE_PASTE_MENU_ITEM ( action)     z_gtk_create_menu_item (_ ("_Paste"), "edit-paste", action)

Definition at line 38 of file gtk.h.

◆ CREATE_SELECT_ALL_MENU_ITEM

#define CREATE_SELECT_ALL_MENU_ITEM ( action)     z_gtk_create_menu_item (_ ("Select A_ll"), "edit-select-all", action)

Definition at line 48 of file gtk.h.

◆ CREATE_UNMUTE_MENU_ITEM

#define CREATE_UNMUTE_MENU_ITEM ( action)     z_gtk_create_menu_item (_ ("Unmute"), NULL, action)

Definition at line 57 of file gtk.h.

◆ DEFAULT_CLIPBOARD

#define DEFAULT_CLIPBOARD   gdk_display_get_clipboard (gdk_display_get_default ())

Definition at line 27 of file gtk.h.

◆ ENUM_BITSET

#define ENUM_BITSET ( _enum,
_val )   (magic_enum::containers::bitset<_enum> (_val))

Definition at line 194 of file types.h.

◆ ENUM_BITSET_TEST

#define ENUM_BITSET_TEST ( _enum,
_val,
_other_val )
Value:
/* (ENUM_BITSET (_enum, _val).test (_other_val)) */ \
(static_cast<int> (_val) & static_cast<int> (_other_val))

Definition at line 195 of file types.h.

◆ ENUM_BITSET_TO_STRING

#define ENUM_BITSET_TO_STRING ( _enum,
_val )    (ENUM_BITSET (_enum, _val).to_string ().data ())
Important
ENUM_ENABLE_BITSET must be called on the enum that this is used on.

Definition at line 201 of file types.h.

◆ ENUM_COUNT

#define ENUM_COUNT ( _enum)    (magic_enum::enum_count<_enum> ())

Definition at line 204 of file types.h.

◆ ENUM_ENABLE_BITSET

#define ENUM_ENABLE_BITSET ( _enum)
Value:
template <> struct magic_enum::customize::enum_range<_enum> \
{ \
static constexpr bool is_flags = true; \
}

Definition at line 189 of file types.h.

◆ ENUM_INT_TO_VALUE

#define ENUM_INT_TO_VALUE ( _enum,
_int )   (magic_enum::enum_value<_enum> (_int))

Definition at line 186 of file types.h.

◆ ENUM_INT_TO_VALUE_CONST

#define ENUM_INT_TO_VALUE_CONST ( _enum,
_int )    (magic_enum::enum_value<_enum, _int> ())

Definition at line 184 of file types.h.

◆ ENUM_NAME

#define ENUM_NAME ( _val)    (magic_enum::enum_name (_val).data ())

Definition at line 205 of file types.h.

◆ ENUM_NAME_FROM_INT

#define ENUM_NAME_FROM_INT ( _enum,
_int )    ENUM_NAME (ENUM_INT_TO_VALUE (_enum, _int))

Definition at line 206 of file types.h.

◆ ENUM_VALUE_TO_INT

#define ENUM_VALUE_TO_INT ( _val)    (magic_enum::enum_integer (_val))

Definition at line 187 of file types.h.

◆ file_exists

#define file_exists ( file)    g_file_test (file, G_FILE_TEST_EXISTS)

Returns 1 if the file/dir exists.

Definition at line 24 of file file.h.

◆ g_error_free_and_null

#define g_error_free_and_null ( ptr)     object_free_w_func_and_null (g_error_free, ptr)

Convenience wrapper.

Definition at line 138 of file objects.h.

◆ g_free_and_null

#define g_free_and_null ( ptr)    object_free_w_func_and_null (g_free, ptr)

Convenience wrapper.

Definition at line 135 of file objects.h.

◆ g_object_unref_and_null

#define g_object_unref_and_null ( ptr)     object_free_w_func_and_null (g_object_unref, ptr)

Convenience wrapper.

Definition at line 131 of file objects.h.

◆ g_source_remove_and_zero

#define g_source_remove_and_zero ( src_id)
Value:
{ \
g_source_remove (src_id); \
src_id = 0; \
}

Definition at line 149 of file objects.h.

◆ GET_ATOM

#define GET_ATOM ( x)    gdk_atom_intern (x, 1)

Definition at line 200 of file ui.h.

◆ io_get_files_in_dir

#define io_get_files_in_dir ( dir,
allow_empty )    io_get_files_in_dir_ending_in (dir, 0, NULL, allow_empty)

Returns a list of the files in the given directory.

Returns
a NULL terminated array of strings that must be free'd with g_strfreev(), or NULL if no files were found.

Definition at line 119 of file io.h.

◆ io_path_get_basename

#define io_path_get_basename ( filename)    g_path_get_basename (filename)

Definition at line 67 of file io.h.

◆ io_write_file

#define io_write_file   g_file_set_contents

Definition at line 183 of file io.h.

◆ LOG

#define LOG   (zlog)

Definition at line 19 of file log.h.

◆ math_doubles_equal

#define math_doubles_equal ( a,
b )    ((a) > (b) ? (a) - (b) < DBL_EPSILON : (b) - (a) < DBL_EPSILON)

Definition at line 81 of file math.h.

◆ math_doubles_equal_epsilon

#define math_doubles_equal_epsilon   math_floats_equal_epsilon

Definition at line 73 of file math.h.

◆ math_floats_equal

#define math_floats_equal ( a,
b )    ((a) > (b) ? (a) - (b) < FLT_EPSILON : (b) - (a) < FLT_EPSILON)

Checks if 2 doubles are equal.

Definition at line 78 of file math.h.

◆ math_floats_equal_epsilon

#define math_floats_equal_epsilon ( a,
b,
e )    ((a) > (b) ? (a) - (b) < e : (b) - (a) < e)

Checks if 2 doubles are equal.

Parameters
eThe allowed difference (epsilon).

Definition at line 70 of file math.h.

◆ MATH_MINUS_INFINITY

#define MATH_MINUS_INFINITY   (-HUGE_VAL)

Definition at line 63 of file math.h.

◆ MATH_RMS_FRAMES

#define MATH_RMS_FRAMES   1

Frames to skip when calculating the RMS.

The lower the more CPU intensive.

Definition at line 57 of file math.h.

◆ math_round_double_to_signed_32

#define math_round_double_to_signed_32 ( x)    (lround (x))

Rounds a double to a (minimum) signed 32-bit integer.

Definition at line 88 of file math.h.

◆ math_round_double_to_signed_64

#define math_round_double_to_signed_64 ( x)    (llround (x))

Rounds a double to a (minimum) signed 64-bit integer.

Definition at line 94 of file math.h.

◆ math_round_double_to_signed_frame_t

#define math_round_double_to_signed_frame_t ( x)     math_round_double_to_signed_64 (x)

Definition at line 96 of file math.h.

◆ math_round_float_to_signed_32

#define math_round_float_to_signed_32 ( x)    (lroundf (x))

Rounds a float to a (minimum) signed 32-bit integer.

Definition at line 103 of file math.h.

◆ math_round_float_to_signed_64

#define math_round_float_to_signed_64 ( x)    (llroundf (x))

Rounds a float to a (minimum) signed 64-bit integer.

Definition at line 109 of file math.h.

◆ math_round_float_to_signed_frame_t

#define math_round_float_to_signed_frame_t ( x)    math_round_float_to_signed_64 (x)

Definition at line 111 of file math.h.

◆ MATH_TINY_NUMBER

#define MATH_TINY_NUMBER   (0.0000001)

Tiny number to be used for denormaml prevention (-140dB).

Definition at line 61 of file math.h.

◆ object_delete_and_null

#define object_delete_and_null ( _obj)
Value:
if (_obj) \
{ \
delete _obj; \
_obj = nullptr; \
}

Definition at line 120 of file objects.h.

◆ object_free_unresizable

#define object_free_unresizable ( type,
obj )   free (obj)

Frees memory for objects created with object_new().

Note
Prefer object_zero_and_free_unresizable().

Definition at line 97 of file objects.h.

◆ object_free_w_func_and_null

#define object_free_w_func_and_null ( _func,
_obj )
Value:
if (_obj) \
{ \
_func (_obj); \
_obj = NULL; \
}

Call the function _func to free _obj and set _obj to NULL.

Definition at line 113 of file objects.h.

◆ object_free_w_func_and_null_cast

#define object_free_w_func_and_null_cast ( _func,
_cast,
_obj )
Value:
if (_obj) \
{ \
_func ((_cast) _obj); \
_obj = NULL; \
}

Convenience wrapper.

Definition at line 142 of file objects.h.

◆ object_new

#define object_new ( type)    (type *) g_malloc0 (sizeof (type))

Allocates memory for an object of type type.

Definition at line 46 of file objects.h.

◆ object_new_n

#define object_new_n ( n,
type )    (static_cast<type *> (object_new_n_sizeof (n, sizeof (type))))

Calloc n blocks for type type.

Definition at line 69 of file objects.h.

◆ object_new_n_sizeof

#define object_new_n_sizeof ( n,
sz )   g_malloc0_n (n, sz)

Calloc equivalent.

Definition at line 64 of file objects.h.

◆ object_new_unresizable

#define object_new_unresizable ( type)    object_new (type)

Allocates memory for an object of type type.

This is more efficient than object_new() but does not support resizing.

Must be free'd with object_free_unresizable().

Note
g_slice_*() API was removed from glib so use the same mechanism as above for now.

Definition at line 59 of file objects.h.

◆ object_realloc_n

#define object_realloc_n ( obj,
prev_n,
n,
type )
Value:
static_cast<type *> ( \
object_realloc_n_sizeof (obj, prev_n * sizeof (type), n * sizeof (type)))

Reallocate memory for obj.

Parameters
prev_nPrevious number of blocks.
nNew number of blocks.

Definition at line 81 of file objects.h.

◆ object_realloc_n_sizeof

#define object_realloc_n_sizeof ( obj,
prev_sz,
sz )    realloc_zero (obj, prev_sz, sz)

Definition at line 72 of file objects.h.

◆ object_set_to_zero

#define object_set_to_zero ( ptr)    memset (ptr, 0, sizeof (*(ptr)))

Zero's out the struct pointed to by ptr.

Parameters
ptrA pointer to a struct.

Definition at line 90 of file objects.h.

◆ object_zero_and_free

#define object_zero_and_free ( ptr)     _object_zero_and_free ((void **) &(ptr), sizeof (*(ptr)))

Zero's out a struct pointed to by ptr and frees the object.

Definition at line 103 of file objects.h.

◆ object_zero_and_free_if_nonnull

#define object_zero_and_free_if_nonnull ( ptr)     object_free_w_func_and_null (object_zero_and_free, ptr)

Definition at line 127 of file objects.h.

◆ object_zero_and_free_unresizable

#define object_zero_and_free_unresizable ( type,
ptr )    _object_zero_and_free_unresizable ((void **) &(ptr), sizeof (type))

Definition at line 106 of file objects.h.

◆ RESOURCES_GL_SHADERS_PATH

#define RESOURCES_GL_SHADERS_PATH   RESOURCES_PATH "/gl/shaders"

Definition at line 24 of file resources.h.

◆ RESOURCES_PATH

#define RESOURCES_PATH   RESOURCES_PATH_TOP "/app"

Definition at line 22 of file resources.h.

◆ RESOURCES_PATH_TOP

#define RESOURCES_PATH_TOP   "/org/zrythm/Zrythm"

Definition at line 21 of file resources.h.

◆ RESOURCES_TEMPLATE_PATH

#define RESOURCES_TEMPLATE_PATH   RESOURCES_PATH "/ui"

Definition at line 23 of file resources.h.

◆ RETURN_ERROR

#define RETURN_ERROR   return 1;

Definition at line 23 of file general.h.

◆ RETURN_OK

#define RETURN_OK   return 0;

Definition at line 22 of file general.h.

◆ SIGNED_FRAME_FORMAT

#define SIGNED_FRAME_FORMAT   PRId64

Definition at line 61 of file types.h.

◆ STACK_PUSH

#define STACK_PUSH ( s,
element )   stack_push (s, (void *) element)

Definition at line 25 of file stack.h.

◆ string_is_equal

#define string_is_equal ( str1,
str2 )   (!g_strcmp0 (str1, str2))

Returns if the two strings are exactly equal.

Definition at line 132 of file string.h.

◆ STRIP_SIZE

#define STRIP_SIZE   9

Number of plugin slots per channel.

Definition at line 75 of file audio.h.

◆ SUPPORTED_FILE_DND_PREFIX

#define SUPPORTED_FILE_DND_PREFIX   Z_DND_STRING_PREFIX "SupportedFile::"

Definition at line 25 of file supported_file.h.

◆ TARGET_ENTRY_CHORD_DESCR

#define TARGET_ENTRY_CHORD_DESCR   "CHORD_DESCR"

Chord descriptor target entry.

Definition at line 195 of file ui.h.

◆ TARGET_ENTRY_FILE_PATH

#define TARGET_ENTRY_FILE_PATH   "FILE_PATH"

Definition at line 179 of file ui.h.

◆ TARGET_ENTRY_PLUGIN

#define TARGET_ENTRY_PLUGIN   "PLUGIN"

Plugin ID, used to move/copy plugins.

Definition at line 176 of file ui.h.

◆ TARGET_ENTRY_PLUGIN_DESCR

#define TARGET_ENTRY_PLUGIN_DESCR   "PLUGIN_DESCR"

Plugin descriptor, used to instantiate plugins.

Definition at line 170 of file ui.h.

◆ TARGET_ENTRY_SUPPORTED_FILE

#define TARGET_ENTRY_SUPPORTED_FILE   "SUPPORTED_FILE"

For SupportedFile pointers.

Definition at line 173 of file ui.h.

◆ TARGET_ENTRY_TL_SELECTIONS

#define TARGET_ENTRY_TL_SELECTIONS   "TL_SELECTIONS"

Definition at line 198 of file ui.h.

◆ TARGET_ENTRY_TRACK

#define TARGET_ENTRY_TRACK   "TRACK"

Track target entry.

This is just the identifier. The TracklistSelections will be used.

Definition at line 190 of file ui.h.

◆ TARGET_ENTRY_URI_LIST

#define TARGET_ENTRY_URI_LIST   "text/uri-list"

URI list.

Definition at line 182 of file ui.h.

◆ TYPEDEF_STRUCT

#define TYPEDEF_STRUCT ( s)    typedef struct s s

Definition at line 31 of file types.h.

◆ TYPEDEF_STRUCT_UNDERSCORED

#define TYPEDEF_STRUCT_UNDERSCORED ( s)    typedef struct _##s s

Definition at line 33 of file types.h.

◆ UI_ACTIVE_WINDOW_OR_NULL

#define UI_ACTIVE_WINDOW_OR_NULL
Value:
(gtk_application_get_active_window (GTK_APPLICATION (zrythm_app)) \
? GTK_WIDGET ( \
gtk_application_get_active_window (GTK_APPLICATION (zrythm_app))) \
: NULL)
ZrythmApp * zrythm_app
Global variable, should be available to all files.

Definition at line 470 of file ui.h.

◆ ui_add_widget_tooltip

#define ui_add_widget_tooltip ( widget,
txt )    gtk_widget_set_tooltip_text (GTK_WIDGET (widget), txt)

Definition at line 202 of file ui.h.

◆ UI_CACHES

#define UI_CACHES   (zrythm_app->ui_caches)

Definition at line 33 of file ui.h.

◆ UI_COLOR_BRIGHT_GREEN

#define UI_COLOR_BRIGHT_GREEN   "#1DD169"

Definition at line 45 of file ui.h.

◆ UI_COLOR_BRIGHT_ORANGE

#define UI_COLOR_BRIGHT_ORANGE   "#F79616"

Definition at line 49 of file ui.h.

◆ UI_COLOR_BRIGHT_TEXT

#define UI_COLOR_BRIGHT_TEXT   "#cdcdcd"

Definition at line 38 of file ui.h.

◆ UI_COLOR_BUTTON_HOVER

#define UI_COLOR_BUTTON_HOVER   "#444444"

Definition at line 42 of file ui.h.

◆ UI_COLOR_BUTTON_NORMAL

#define UI_COLOR_BUTTON_NORMAL   "#343434"

Definition at line 41 of file ui.h.

◆ UI_COLOR_DARK_ORANGE

#define UI_COLOR_DARK_ORANGE   "#D68A0C"

Definition at line 47 of file ui.h.

◆ UI_COLOR_DARK_TEXT

#define UI_COLOR_DARK_TEXT   "#323232"

Definition at line 37 of file ui.h.

◆ UI_COLOR_DARKISH_GREEN

#define UI_COLOR_DARKISH_GREEN   "#19664c"

Definition at line 46 of file ui.h.

◆ UI_COLOR_FADER_FILL_END

#define UI_COLOR_FADER_FILL_END   UI_COLOR_Z_YELLOW

Definition at line 65 of file ui.h.

◆ UI_COLOR_HIGHLIGHT_BASS_BG

#define UI_COLOR_HIGHLIGHT_BASS_BG   UI_COLOR_LIGHT_BLUEISH

Definition at line 59 of file ui.h.

◆ UI_COLOR_HIGHLIGHT_BASS_FG

#define UI_COLOR_HIGHLIGHT_BASS_FG   "white"

Definition at line 63 of file ui.h.

◆ UI_COLOR_HIGHLIGHT_BOTH_BG

#define UI_COLOR_HIGHLIGHT_BOTH_BG   "#FF22FF"

Definition at line 60 of file ui.h.

◆ UI_COLOR_HIGHLIGHT_BOTH_FG

#define UI_COLOR_HIGHLIGHT_BOTH_FG   "white"

Definition at line 64 of file ui.h.

◆ UI_COLOR_HIGHLIGHT_CHORD_BG

#define UI_COLOR_HIGHLIGHT_CHORD_BG   "#BB22BB"

Definition at line 58 of file ui.h.

◆ UI_COLOR_HIGHLIGHT_CHORD_FG

#define UI_COLOR_HIGHLIGHT_CHORD_FG   UI_COLOR_HIGHLIGHT_SCALE_FG

Definition at line 62 of file ui.h.

◆ UI_COLOR_HIGHLIGHT_SCALE_BG

#define UI_COLOR_HIGHLIGHT_SCALE_BG   "#662266"

Definition at line 57 of file ui.h.

◆ UI_COLOR_HIGHLIGHT_SCALE_FG

#define UI_COLOR_HIGHLIGHT_SCALE_FG   "#F79616"

Definition at line 61 of file ui.h.

◆ UI_COLOR_LIGHT_BLUEISH

#define UI_COLOR_LIGHT_BLUEISH   "#1aa3ffcc"

Definition at line 52 of file ui.h.

◆ UI_COLOR_MATCHA

#define UI_COLOR_MATCHA   "#2eb398"

Definition at line 51 of file ui.h.

◆ UI_COLOR_POSTFADER_SEND

#define UI_COLOR_POSTFADER_SEND   "#901ed2"

Definition at line 54 of file ui.h.

◆ UI_COLOR_PREFADER_SEND

#define UI_COLOR_PREFADER_SEND   "#D21E6D"

Definition at line 53 of file ui.h.

◆ UI_COLOR_PURPLE

#define UI_COLOR_PURPLE   "#9D3955"

Definition at line 40 of file ui.h.

◆ UI_COLOR_RECORD_ACTIVE

#define UI_COLOR_RECORD_ACTIVE   "#FF2400"

Definition at line 44 of file ui.h.

◆ UI_COLOR_RECORD_CHECKED

#define UI_COLOR_RECORD_CHECKED   "#ED2939"

Definition at line 43 of file ui.h.

◆ UI_COLOR_SOLO_ACTIVE

#define UI_COLOR_SOLO_ACTIVE   UI_COLOR_MATCHA

Definition at line 55 of file ui.h.

◆ UI_COLOR_SOLO_CHECKED

#define UI_COLOR_SOLO_CHECKED   UI_COLOR_DARKISH_GREEN

Definition at line 56 of file ui.h.

◆ UI_COLOR_YELLOW

#define UI_COLOR_YELLOW   "#F9CA1B"

Definition at line 39 of file ui.h.

◆ UI_COLOR_Z_PURPLE

#define UI_COLOR_Z_PURPLE   "#9D3955"

Definition at line 50 of file ui.h.

◆ UI_COLOR_Z_YELLOW

#define UI_COLOR_Z_YELLOW   "#F9CA1B"

Definition at line 48 of file ui.h.

◆ UI_COLORS

#define UI_COLORS   (&UI_CACHES->colors)

Definition at line 34 of file ui.h.

◆ UI_DELETE_ICON_NAME

#define UI_DELETE_ICON_NAME   "z-edit-delete"

Definition at line 67 of file ui.h.

◆ ui_is_widget_revealed

#define ui_is_widget_revealed ( widget)
Value:
(gtk_widget_get_height (GTK_WIDGET (widget)) > 1 \
|| gtk_widget_get_width (GTK_WIDGET (widget)) > 1)

Definition at line 225 of file ui.h.

◆ UI_MAX_CURSORS

#define UI_MAX_CURSORS   400

Definition at line 31 of file ui.h.

◆ UI_RESIZE_CURSOR_SPACE

#define UI_RESIZE_CURSOR_SPACE   8

Space on the edges to show resize cursors.

Definition at line 161 of file ui.h.

◆ ui_set_brush_cursor

#define ui_set_brush_cursor ( widget)     ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "brush-cursor", 2, 3);

Definition at line 385 of file ui.h.

◆ ui_set_cut_clip_cursor

#define ui_set_cut_clip_cursor ( widget)     ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "cut-cursor", 9, 7);

Definition at line 388 of file ui.h.

◆ ui_set_eraser_cursor

#define ui_set_eraser_cursor ( widget)     ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "eraser-cursor", 4, 2);

Definition at line 391 of file ui.h.

◆ ui_set_fade_in_cursor

#define ui_set_fade_in_cursor ( widget)     ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "fade-in-cursor", 3, 1);

Definition at line 427 of file ui.h.

◆ ui_set_fade_out_cursor

#define ui_set_fade_out_cursor ( widget)     ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "fade-out-cursor", 3, 1);

Definition at line 430 of file ui.h.

◆ ui_set_hand_cursor

#define ui_set_hand_cursor ( widget)     ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "move-cursor", 12, 11);

Definition at line 400 of file ui.h.

◆ ui_set_hover_status_bar_signals

#define ui_set_hover_status_bar_signals ( w,
t )
Value:
g_signal_connect ( \
G_OBJECT (w), "enter-notify-event", \
G_CALLBACK (ui_on_motion_set_status_bar_text_cb), g_strdup (t)); \
g_signal_connect ( \
G_OBJECT (w), "leave-notify-event", \
G_CALLBACK (ui_on_motion_set_status_bar_text_cb), g_strdup (t));

Definition at line 205 of file ui.h.

◆ ui_set_left_resize_cursor

#define ui_set_left_resize_cursor ( widget)     ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "w-resize-cursor", 14, 11);

Definition at line 403 of file ui.h.

◆ ui_set_left_resize_loop_cursor

#define ui_set_left_resize_loop_cursor ( widget)     ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "w-loop-cursor", 14, 11);

Definition at line 410 of file ui.h.

◆ ui_set_left_stretch_cursor

#define ui_set_left_stretch_cursor ( widget)
Value:
GTK_WIDGET (widget), "w-stretch-cursor", 14, 11);
void ui_set_cursor_from_icon_name(GtkWidget *widget, const char *name, int offset_x, int offset_y)
Sets cursor from icon name.

Definition at line 406 of file ui.h.

◆ ui_set_line_cursor

#define ui_set_line_cursor ( widget)     ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "ramp-cursor", 2, 3);

Definition at line 394 of file ui.h.

◆ ui_set_pencil_cursor

#define ui_set_pencil_cursor ( widget)     ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "edit-cursor", 2, 3);

Definition at line 382 of file ui.h.

◆ ui_set_right_resize_cursor

#define ui_set_right_resize_cursor ( widget)     ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "e-resize-cursor", 10, 11);

Definition at line 413 of file ui.h.

◆ ui_set_right_resize_loop_cursor

#define ui_set_right_resize_loop_cursor ( widget)     ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "e-loop-cursor", 10, 11);

Definition at line 420 of file ui.h.

◆ ui_set_right_stretch_cursor

#define ui_set_right_stretch_cursor ( widget)
Value:
GTK_WIDGET (widget), "e-stretch-cursor", 10, 11);

Definition at line 416 of file ui.h.

◆ ui_set_speaker_cursor

#define ui_set_speaker_cursor ( widget)     ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "audition-cursor", 10, 12);

Definition at line 397 of file ui.h.

◆ ui_set_time_select_cursor

#define ui_set_time_select_cursor ( widget)
Value:
GTK_WIDGET (widget), "time-select-cursor", 10, 12);

Definition at line 423 of file ui.h.

◆ ui_show_error_message

#define ui_show_error_message ( title,
msg )   ui_show_message_literal (title, msg)

Definition at line 496 of file ui.h.

◆ ui_show_error_message_printf

#define ui_show_error_message_printf ( title,
fmt,
... )    ui_show_message_printf (title, fmt, __VA_ARGS__);

Wrapper to show error message so that no casting of the window is needed on the caller side.

Definition at line 493 of file ui.h.

◆ ui_show_message_literal

#define ui_show_message_literal ( title,
str )    ui_show_message_full (GTK_WIDGET (UI_ACTIVE_WINDOW_OR_NULL), title, "%s", str)

Type can be GTK_MESSAGE_ERROR, etc.

Definition at line 486 of file ui.h.

◆ ui_show_message_printf

#define ui_show_message_printf ( title,
fmt,
... )
Value:
GTK_WIDGET (UI_ACTIVE_WINDOW_OR_NULL), title, fmt, __VA_ARGS__)
AdwDialog * ui_show_message_full(GtkWidget *parent, const char *title, const char *format,...) G_GNUC_PRINTF(3
Shows a popup message of the given type with the given message.

Type can be GTK_MESSAGE_ERROR, etc.

Definition at line 479 of file ui.h.

◆ ui_show_notification_idle

#define ui_show_notification_idle ( msg)     ui_show_notification_idle_printf ("%s", msg)

Definition at line 222 of file ui.h.

◆ ui_show_notification_idle_printf

#define ui_show_notification_idle_printf ( fmt,
... )
Value:
char * text = g_strdup_printf (fmt, __VA_ARGS__); \
g_idle_add ((GSourceFunc) ui_show_notification_idle_func, (void *) text)
int ui_show_notification_idle_func(char *msg)
Show notification from non-GTK threads.

Shows the notification when idle.

This should be called from threads other than GTK main thread.

Definition at line 218 of file ui.h.

◆ UNSIGNED_FRAME_FORMAT

#define UNSIGNED_FRAME_FORMAT   PRIu64

Definition at line 66 of file types.h.

◆ z_cairo_draw_text

#define z_cairo_draw_text ( cr,
widget,
layout,
text )
Value:
cr, widget, layout, text, Z_CAIRO_TEXT_PADDING, Z_CAIRO_TEXT_PADDING)
void z_cairo_draw_text_full(cairo_t *cr, GtkWidget *widget, PangoLayout *layout, const char *text, int start_x, int start_y)
Draws the given text using the given font starting at the given position.
#define Z_CAIRO_TEXT_PADDING
Padding to leave from the top/left edges when drawing text.
Definition cairo.h:48

Draw text with default padding.

Definition at line 141 of file cairo.h.

◆ Z_CAIRO_FONT

#define Z_CAIRO_FONT   "Bold 9"

Default font for drawing pango text.

Definition at line 42 of file cairo.h.

◆ z_cairo_get_text_extents_for_widget

#define z_cairo_get_text_extents_for_widget ( _widget,
_layout,
_text,
_width,
_height )
Value:
(GtkWidget *) _widget, _layout, _text, _width, _height)
void _z_cairo_get_text_extents_for_widget(GtkWidget *widget, PangoLayout *layout, const char *text, int *width, int *height)
Gets the width of the given text in pixels for the given widget.

Definition at line 115 of file cairo.h.

◆ Z_CAIRO_TEXT_PADDING

#define Z_CAIRO_TEXT_PADDING   2

Padding to leave from the top/left edges when drawing text.

Definition at line 48 of file cairo.h.

◆ Z_GDK_RECTANGLE_INIT

#define Z_GDK_RECTANGLE_INIT ( _x,
_y,
_w,
_h )
Value:
{ \
.x = _x, .y = _y, .width = _w, .height = _h \
}

Definition at line 74 of file gtk.h.

◆ Z_GDK_RECTANGLE_INIT_UNIT

#define Z_GDK_RECTANGLE_INIT_UNIT ( _x,
_y )
Value:
{ \
.x = _x, .y = _y, .width = 1, .height = 1 \
}

Definition at line 79 of file gtk.h.

◆ Z_GDK_RGBA_INIT

#define Z_GDK_RGBA_INIT ( r,
g,
b,
a )
Value:
{ \
.red = static_cast<float> (r), .green = static_cast<float> (g), \
.blue = static_cast<float> (b), .alpha = static_cast<float> (a) \
}

Definition at line 68 of file gtk.h.

◆ Z_GRAPHENE_POINT_INIT

#define Z_GRAPHENE_POINT_INIT ( _x,
_y )    GRAPHENE_POINT_INIT (static_cast<float> (_x), static_cast<float> (_y))

Definition at line 89 of file gtk.h.

◆ Z_GRAPHENE_RECT_INIT

#define Z_GRAPHENE_RECT_INIT ( _x,
_y,
_w,
_h )
Value:
GRAPHENE_RECT_INIT ( \
static_cast<float> (_x), static_cast<float> (_y), static_cast<float> (_w), \
static_cast<float> (_h))

Definition at line 84 of file gtk.h.

◆ z_gtk_assistant_set_current_page_complete

#define z_gtk_assistant_set_current_page_complete ( assistant,
complete )
Value:
gtk_assistant_set_page_complete ( \
GTK_ASSISTANT (assistant), \
gtk_assistant_get_nth_page ( \
GTK_ASSISTANT (assistant), \
gtk_assistant_get_current_page (GTK_ASSISTANT (assistant))), \
complete);

Definition at line 60 of file gtk.h.

◆ z_gtk_create_menu_item

#define z_gtk_create_menu_item ( lbl_name,
icn_name,
action_name )    z_gtk_create_menu_item_full (lbl_name, icn_name, action_name)

Definition at line 212 of file gtk.h.

◆ z_return_if_fail_cmp

#define z_return_if_fail_cmp ( a,
comparator,
b )    z_return_val_if_fail_cmp (a, comparator, b, )

Definition at line 24 of file debug.h.

◆ z_return_val_if_fail_cmp

#define z_return_val_if_fail_cmp ( a,
comparator,
b,
val )
Value:
if (!(G_LIKELY ((a) comparator (b)))) \
{ \
g_critical ( \
"Assertion failed: %s (%" G_GINT64_FORMAT \
") " \
"%s %s (%" G_GINT64_FORMAT ")", \
#a, (gint64) (a), #comparator, #b, (gint64) (b)); \
return val; \
}

Definition at line 13 of file debug.h.

◆ z_warn_if_fail_cmp

#define z_warn_if_fail_cmp ( a,
comparator,
b )
Value:
if (!(G_LIKELY (a comparator b))) \
{ \
g_warning ( \
"Assertion failed: %s (%" G_GINT64_FORMAT \
") " \
"%s %s (%" G_GINT64_FORMAT ")", \
#a, (gint64) (a), #comparator, #b, (gint64) (b)); \
}

Definition at line 27 of file debug.h.

Typedef Documentation

◆ bpm_t

typedef float bpm_t

The BPM type.

Definition at line 54 of file types.h.

◆ channels_t

typedef unsigned int channels_t

Number of channels.

Definition at line 48 of file types.h.

◆ curviness_t

typedef double curviness_t

Definition at line 56 of file types.h.

◆ GenericCallback

typedef void(* GenericCallback) (void *object)

Generic callback.

Definition at line 103 of file types.h.

◆ GenericCmpFunc

typedef int(* GenericCmpFunc) (const void *a, const void *b)

Generic comparator.

Definition at line 108 of file types.h.

◆ GenericFloatGetter

typedef float(* GenericFloatGetter) (void *object)

Getter prototype for float values.

Definition at line 77 of file types.h.

◆ GenericFloatSetter

typedef void(* GenericFloatSetter) (void *object, float val)

Setter prototype for float values.

Definition at line 82 of file types.h.

◆ GenericPredicateFunc

typedef bool( * GenericPredicateFunc) (const void *object, const void *user_data)

Predicate function prototype.

To be used to return whether the given pointer matches some condition.

Definition at line 116 of file types.h.

◆ GenericStringCopyGetter

typedef void(* GenericStringCopyGetter) (void *object, char *buf)

Getter prototype for strings to be saved in the given buffer.

Definition at line 98 of file types.h.

◆ GenericStringGetter

typedef const char *(* GenericStringGetter) (void *object)

Getter prototype for strings.

Definition at line 87 of file types.h.

◆ GenericStringSetter

typedef void(* GenericStringSetter) (void *object, const char *val)

Setter prototype for float values.

Definition at line 92 of file types.h.

◆ midi_byte_t

typedef uint8_t midi_byte_t

MIDI byte.

Definition at line 36 of file types.h.

◆ midi_time_t

typedef uint32_t midi_time_t

MIDI time in global frames.

Definition at line 45 of file types.h.

◆ nframes_t

typedef uint32_t nframes_t

Frame count.

Definition at line 39 of file types.h.

◆ ObjectFreeFunc

typedef void(* ObjectFreeFunc) (void *)

Function to call to free objects.

Definition at line 122 of file types.h.

◆ ProgressInfo

typedef struct ProgressInfo ProgressInfo

Definition at line 35 of file progress_info.h.

◆ sample_rate_t

typedef uint32_t sample_rate_t

Sample rate.

Definition at line 42 of file types.h.

◆ sample_t

typedef float sample_t

The sample type.

Definition at line 51 of file types.h.

◆ signed_frame_t

typedef int_fast64_t signed_frame_t

Signed type for frame index.

Definition at line 59 of file types.h.

◆ signed_ms_t

Signed millisecond index.

Definition at line 69 of file types.h.

◆ signed_sec_t

Signed second index.

Definition at line 72 of file types.h.

◆ unsigned_frame_t

typedef uint_fast64_t unsigned_frame_t

Unsigned type for frame index.

Definition at line 64 of file types.h.

◆ ZVampPlugin

typedef void ZVampPlugin

Definition at line 90 of file vamp.h.

Enumeration Type Documentation

◆ AudioValueFormat

Enumerator
AUDIO_VALUE_AMPLITUDE 

0 to 2, amplitude.

AUDIO_VALUE_DBFS 

dbFS.

AUDIO_VALUE_FADER 

0 to 1, suitable for drawing.

Definition at line 124 of file types.h.

◆ BitDepth

enum class BitDepth
strong

Bit depth.

Definition at line 27 of file audio.h.

◆ CacheTypes

enum CacheTypes

Definition at line 170 of file types.h.

◆ HashAlgorithm

enum HashAlgorithm

Definition at line 23 of file hash.h.

◆ ProgressCompletionType

enum ProgressCompletionType

Definition at line 27 of file progress_info.h.

◆ ProgressStatus

enum ProgressStatus

Definition at line 19 of file progress_info.h.

◆ ResamplerQuality

enum ResamplerQuality

Definition at line 23 of file resampler.h.

◆ UiCursorState

Various cursor states to be shared.

Definition at line 232 of file ui.h.

◆ UiDetail

enum UiDetail

Definition at line 71 of file ui.h.

◆ UiDragMode

enum UiDragMode

Dragging modes for widgets that have click&drag.

Enumerator
UI_DRAG_MODE_CURSOR 

Value is wherever the cursor is.

UI_DRAG_MODE_RELATIVE 

Value is changed based on the offset.

UI_DRAG_MODE_RELATIVE_WITH_MULTIPLIER 

Value is changed based on the offset, times a multiplier.

Definition at line 366 of file ui.h.

◆ UiOverlayAction

Various overlay actions to be shared.

Enumerator
UI_OVERLAY_ACTION_AUTOFILLING 

Auto-filling in edit mode.

Note
This is also used for the pencil tool in velocity and automation editors.
UI_OVERLAY_ACTION_ERASING 

Erasing.

UI_OVERLAY_ACTION_STARTING_MOVING 

To be set in drag_start.

UI_OVERLAY_ACTION_STARTING_SELECTION 

To be set in drag_start.

Useful to check if nothing was clicked.

UI_OVERLAY_ACTION_STARTING_DELETE_SELECTION 

Like selecting but it auto deletes whatever touches the selection.

Definition at line 245 of file ui.h.

◆ ZFileType

enum class ZFileType
strong

File type.

Enumerator
FILE_TYPE_PARENT_DIR 

Special entry ".." for the parent dir.

Definition at line 30 of file supported_file.h.

◆ ZGtkResize

enum ZGtkResize

Definition at line 105 of file gtk.h.

◆ ZGtkShrink

enum ZGtkShrink

Definition at line 111 of file gtk.h.

◆ ZVampPluginType

enum ZVampPluginType

Definition at line 92 of file vamp.h.

Function Documentation

◆ _backtrace_get()

char * _backtrace_get ( const char * exe_path,
const char * prefix,
int max_lines,
bool with_lines,
bool write_to_file )

Returns the backtrace with max_lines number of lines and a string prefix.

Parameters
exe_pathExecutable path for running addr2line.
with_linesWhether to show line numbers. This is very slow.

◆ _z_cairo_get_text_extents_for_widget()

void _z_cairo_get_text_extents_for_widget ( GtkWidget * widget,
PangoLayout * layout,
const char * text,
int * width,
int * height )

Gets the width of the given text in pixels for the given widget.

Parameters
widgetThe widget to derive a PangoLayout from.
textThe text to draw.
widthThe width to fill in.
heightThe height to fill in.

◆ audio_detect_bpm()

float audio_detect_bpm ( float * src,
size_t num_frames,
unsigned int samplerate,
GArray * candidates )

Detect BPM.

Returns
The BPM, or 0 if not found.

◆ audio_files_equal()

bool audio_files_equal ( const char * f1,
const char * f2,
size_t num_frames,
float epsilon )

Returns whether the file contents are equal.

Parameters
num_framesMaximum number of frames to check. Passing 0 will check all frames.

◆ audio_write_raw_file()

WARN_UNUSED_RESULT bool audio_write_raw_file ( float * buff,
size_t frames_already_written,
size_t nframes,
uint32_t samplerate,
bool flac,
BitDepth bit_depth,
channels_t channels,
const char * filename,
GError ** error )

Writes the buffer as a raw file to the given path.

Parameters
sizeThe number of frames per channel.
samplerateThe samplerate of buff.
frames_already_writtenFrames (per channel) already written. If this is non-zero and the file exists, it will append to the existing file.
Returns
Whether successful.

◆ color_morph()

void color_morph ( GdkRGBA * a,
GdkRGBA * b,
float amt,
GdkRGBA * result )

Morphs from a to b, depending on the given amount.

Eg, if amt is 0, the resulting color will be a. If amt is 1, the resulting color will be .

◆ datetime_get_current_as_string()

char * datetime_get_current_as_string ( void )

Returns the current datetime as a string.

Must be free()'d by caller.

◆ env_get_int()

int env_get_int ( const char * key,
int def )

Returns an int for the given environment variable if it exists and is valid, otherwise returns the default int.

Parameters
defDefault value to return if not found.

◆ env_get_string()

char * env_get_string ( const char * key,
const char * def )

Returns a newly allocated string.

Parameters
defDefault value to return if not found.

◆ file_reflink()

int file_reflink ( const char * dest,
const char * src )

Do cp –reflink from src to dest.

Returns
Non-zero on error.

◆ io_copy_dir()

WARN_UNUSED_RESULT bool io_copy_dir ( const char * destdir_str,
const char * srcdir_str,
bool follow_symlinks,
bool recursive,
GError ** error )

Copies a directory.

Note
This will not work if destdir_str has a file with the same filename as a directory in srcdir_str.
See also
https://stackoverflow.com/questions/16453739/how-do-i-recursively-copy-a-directory-using-vala

◆ io_get_dir()

NONNULL char * io_get_dir ( const char * filename)

Gets directory part of filename.

MUST be freed.

Parameters
filenameFilename containing directory.

◆ io_get_files_in_dir_ending_in()

char ** io_get_files_in_dir_ending_in ( const char * _dir,
const int recursive,
const char * end_string,
bool allow_empty )

Returns a list of the files in the given directory.

Parameters
dirThe directory to look for.
allow_emptyWhether to allow returning an empty array that has only NULL, otherwise return NULL if empty.
Returns
a NULL terminated array of strings that must be free'd with g_strfreev() or NULL.

◆ io_get_next_available_filepath()

NONNULL char * io_get_next_available_filepath ( const char * filepath)

Returns a newly allocated path that is either a copy of the original path if the path does not exist, or the original path appended with (n), where n is a number.

Example: "myfile" -> "myfile (1)"

◆ io_path_get_basename_without_ext()

NONNULL char * io_path_get_basename_without_ext ( const char * filename)

Strips path from given filename.

MUST be freed.

◆ io_rmdir()

NONNULL int io_rmdir ( const char * path,
bool force )

Removes a dir, optionally forcing deletion.

For safety reasons, this only accepts an absolute path with length greater than 20 if forced.

◆ log_generate_compressed_file()

bool log_generate_compressed_file ( Log * self,
char ** ret_dir,
char ** ret_path,
GError ** error )

Generates a compressed log file (for sending with bug reports).

Returns
Whether successful.

◆ log_get_last_n_lines()

NONNULL char * log_get_last_n_lines ( Log * self,
int n )

Returns the last n lines as a newly allocated string.

Note
This must only be called from the GTK thread.
Parameters
nNumber of lines.

◆ log_init_with_file()

WARN_UNUSED_RESULT bool log_init_with_file ( Log * self,
const char * filepath,
GError ** error )

Initializes logging to a file.

This can be called from any thread.

Parameters
filepathIf non-NULL, the given file will be used, otherwise the default file will be created.
Returns
Whether successful.

◆ log_init_writer_idle()

NONNULL void log_init_writer_idle ( Log * self,
unsigned int secs )

Initializes logging to a file.

This must be called from the GTK thread.

Parameters
secsNumber of timeout seconds.

◆ log_new()

Log * log_new ( void )

Creates the logger and sets the writer func.

This can be called from any thread.

◆ math_assert_nonnann()

bool math_assert_nonnann ( float x)

Asserts that the value is non-nan.

Not real-time safe.

Returns
Whether the value is valid (nonnan).

◆ math_calculate_rms_db()

sample_t math_calculate_rms_db ( sample_t * buf,
const nframes_t nframes )

Calculate db using RMS method.

Parameters
bufBuffer containing the samples.
nframesNumber of samples.

◆ math_is_string_valid_float()

bool math_is_string_valid_float ( const char * str,
float * ret )

Returns whether the given string is a valid float.

Parameters
retIf non-NULL, the result will be placed here.

◆ NONNULL_ARGS()

NONNULL_ARGS ( 1 ) const

Makes directory if doesn't exist.

To be called periodically until resampler_is_done() returns true.

Returns
True if the directory exists or was successfully created, false if error was occurred and errno is set.

◆ resampler_new()

Resampler * resampler_new ( const float * in_frames,
const size_t num_in_frames,
const double input_rate,
const double output_rate,
const unsigned int num_channels,
const ResamplerQuality quality,
GError ** error )

Creates a new instance of a Resampler with the given settings.

Resampler.num_out_frames will be set to the number of output frames required for resampling with the given settings.

◆ resources_get_gl_shader_data()

GBytes * resources_get_gl_shader_data ( const char * path)

Returns the bytes of the specified OpenGL shader in RESOURCES_GL_SHADERS_PATH.

Caller must free the bytes with g_bytes_unref ().

Returns
bytes or NULL if error.

◆ resources_set_class_template()

void resources_set_class_template ( GtkWidgetClass * klass,
const char * filename )

Sets class template from resource.

Filename is part after .../ui/

◆ sort_alphabetical_func()

int sort_alphabetical_func ( const void * a,
const void * b )

Alphabetical sort func.

The arguments must be strings (char *).

◆ stack_new()

Stack * stack_new ( int length)

Creates a new stack of the given size.

Parameters
lengthStack size. If -1, the stack will have unlimited size.

◆ string_array_sort_and_remove_duplicates()

char ** string_array_sort_and_remove_duplicates ( char ** str_arr)

TODO Sorts the given string array and removes duplicates.

Parameters
str_arrA NULL-terminated array of strings.
Returns
A NULL-terminated array with the string addresses of the source array.

◆ string_convert_to_filename()

NONNULL char * string_convert_to_filename ( const char * str)

Returns a newly allocated string that is a filename version of the given string.

Example: "MIDI Region #1" -> "MIDI_Region_1".

◆ string_copy_w_realloc()

void string_copy_w_realloc ( char ** dest,
const char * src )

Copies the string src to the buffer in dest after reallocating the buffer in dest to the length of src.

If src is NULL, the string at dest is free'd and the pointer is set to NULL.

◆ string_get_int_after_last_space()

int string_get_int_after_last_space ( const char * str,
char * str_without_num )

Returns the integer found at the end of a string like "My String 3" -> 3, or -1 if no number is found.

See https://www.debuggex.com/cheatsheet/regex/pcre for more info.

Parameters
str_without_numA buffer to save the string without the number (including the space).

◆ string_get_regex_group()

char * string_get_regex_group ( const char * str,
const char * regex,
int group )

Gets the string in the given regex group.

Returns
A newly allocated string or NULL.

◆ string_get_regex_group_as_int()

int string_get_regex_group_as_int ( const char * str,
const char * regex,
int group,
int def )

Gets the string in the given regex group as an integer.

Parameters
defDefault.
Returns
The int, or default.

◆ string_to_lower()

void string_to_lower ( const char * in,
char * out )

Converts the given string to lowercase in out.

Assumes out is already allocated to as many chars as in.

◆ string_to_upper()

void string_to_upper ( const char * in,
char * out )

Converts the given string to uppercase in out.

Assumes out is already allocated to as many chars as in.

◆ string_utf8_strcasecmp()

int string_utf8_strcasecmp ( const char * s1,
const char * s2 )

Compares two UTF-8 strings using approximate case-insensitive ordering.

Returns
< 0 if
Parameters
s1compares before
s2,0if they compare equal, > 0 if
s1compares after
s2
Note
Taken from src/libedataserver/e-data-server-util.c in evolution-data-center (e_util_utf8_strcasecmp).

◆ supported_file_type_get_description()

char * supported_file_type_get_description ( ZFileType type)

Returns a human readable description of the given file type.

Example: wav -> "Wave file".

◆ system_get_cmd_output()

char * system_get_cmd_output ( char ** argv,
long ms_timer,
bool always_wait )

Runs the command and returns the output, or NULL.

This assumes that the process will exit within a few milliseconds from when the first output is printed, unless always_wait is true, in which case the process will only be reaped after the waiting time.

Parameters
ms_timerA timer in ms to kill the process, or negative to not wait.

◆ ui_gen_audio_backends_combo_row()

AdwComboRow * ui_gen_audio_backends_combo_row ( bool with_signal)

Generates a combo row for selecting the audio backend.

Parameters
with_signalAdd a signal to change the backend in GSettings.

◆ ui_gen_midi_backends_combo_row()

AdwComboRow * ui_gen_midi_backends_combo_row ( bool with_signal)

Generates a combo row for selecting the MIDI backend.

Parameters
with_signalAdd a signal to change the backend in GSettings.

◆ ui_get_arranger_object_color()

void ui_get_arranger_object_color ( GdkRGBA * color,
const bool is_hovered,
const bool is_selected,
const bool is_transient,
const bool is_muted )

Gets the color the widget should be.

Parameters
colorThe original color.
is_selectedWhether the widget is supposed to be selected or not.

◆ ui_get_contrast_color()

void ui_get_contrast_color ( GdkRGBA * src,
GdkRGBA * dest )

Returns the contrasting color (variation of black or white) based on if the given color is dark enough or not.

Parameters
srcThe source color.
destThe destination color to write to.

◆ ui_get_hit_child()

GtkWidget * ui_get_hit_child ( GtkWidget * parent,
double x,
double y,
GType type )

Returns the matching hit child, or NULL.

Parameters
xX in parent space.
yY in parent space.
typeType to look for.

◆ ui_get_locale_not_available_string()

char * ui_get_locale_not_available_string ( LocalizationLanguage lang)

Returns the "a locale for the language you have selected..." text based on the given language.

Must be free'd by caller.

◆ ui_get_mid_color()

void ui_get_mid_color ( GdkRGBA * dest,
const GdkRGBA * c1,
const GdkRGBA * c2,
const float transition )

Returns the color in-between two colors.

Parameters
transitionHow far to transition (0.5 for half).

◆ ui_get_normalized_draggable_value()

double ui_get_normalized_draggable_value ( double size,
double cur_val,
double start_px,
double cur_px,
double last_px,
double multiplier,
UiDragMode mode )

Gets a draggable value as a normalized value between 0 and 1.

Parameters
sizeWidget size (either width or height).
start_pxPx at start of drag.
cur_pxCurrent px.
last_pxPx during last call.

◆ ui_is_child_hit()

NONNULL int ui_is_child_hit ( GtkWidget * parent,
GtkWidget * child,
const int check_x,
const int check_y,
const double x,
const double y,
const double x_padding,
const double y_padding )

Returns if the child is hit or not by the coordinates in parent.

Parameters
check_xCheck x-axis for match.
check_yCheck y-axis for match.
xx in parent space.
yy in parent space.
x_paddingPadding to add to the x of the object when checking if hit. The bigger the padding the more space the child will have to get hit.
y_paddingPadding to add to the y of the object when checking if hit. The bigger the padding the more space the child will have to get hit.

◆ ui_is_point_in_rect_hit()

bool ui_is_point_in_rect_hit ( GdkRectangle * rect,
const bool check_x,
const bool check_y,
double x,
double y,
double x_padding,
double y_padding )

Returns if rect is hit or not by the given coordinate.

Parameters
check_xCheck x-axis for match.
check_yCheck y-axis for match.
xx in parent space.
yy in parent space.
x_paddingPadding to add to the x of the object when checking if hit. The bigger the padding the more space the child will have to get hit.
y_paddingPadding to add to the y of the object when checking if hit. The bigger the padding the more space the child will have to get hit.

◆ ui_px_to_frames_editor()

signed_frame_t ui_px_to_frames_editor ( double px,
bool has_padding )

Converts from pixels to frames.

Returns the frames.

Parameters
has_paddingWhether then given px contains padding.

◆ ui_px_to_frames_timeline()

signed_frame_t ui_px_to_frames_timeline ( double px,
bool has_padding )

Converts from pixels to frames.

Returns the frames.

Parameters
has_paddingWhether then given px contains padding.

◆ ui_px_to_pos_editor()

NONNULL void ui_px_to_pos_editor ( double px,
Position * pos,
bool has_padding )

Converts from pixels to position.

Only works with positive numbers. Negatives will be clamped at 0. If a negative is needed, pass the abs to this function and then change the sign.

Parameters
has_paddingWhether px contains padding.

◆ ui_px_to_pos_timeline()

NONNULL void ui_px_to_pos_timeline ( double px,
Position * pos,
bool has_padding )

Converts from pixels to position.

Only works with positive numbers. Negatives will be clamped at 0. If a negative is needed, pass the abs to this function and then change the sign.

Parameters
has_paddingWhether px contains padding.

◆ ui_setup_audio_device_name_combo_row()

void ui_setup_audio_device_name_combo_row ( AdwComboRow * combo_row,
bool populate,
bool with_signal )

Sets up a combo row for selecting the audio device name.

Parameters
with_signalAdd a signal to change the backend in GSettings.

◆ ui_show_message_full()

AdwDialog * ui_show_message_full ( GtkWidget * parent,
const char * title,
const char * format,
... )

Shows a popup message of the given type with the given message.

Note
Only works for non-markup. use AdwMessageDialog directly to show Pango markup.
Returns
The message window.

◆ ui_show_notification_idle_func()

int ui_show_notification_idle_func ( char * msg)

Show notification from non-GTK threads.

This should be used internally. Use the ui_show_notification_idle macro instead.

◆ z_cairo_reset_caches()

void z_cairo_reset_caches ( cairo_t ** cr_cache,
cairo_surface_t ** surface_cache,
int width,
int height,
cairo_t * new_cr )

Resets a surface and cairo_t with a new surface and cairo_t based on the given rectangle and cairo_t.

To be used inside draw calls of widgets that use caching.

Parameters
widthNew surface width.
heightNew surface height.

◆ z_curl_get_page_contents()

char * z_curl_get_page_contents ( const char * url,
int timeout,
GError ** error )

Returns the contents of the page in a newly allocated string.

Parameters
timeoutTimeout in seconds.
Returns
Newly allocated string or NULL if fail.

◆ z_curl_get_page_contents_default()

char * z_curl_get_page_contents_default ( const char * url)

Returns the contents of the page in a newly allocated string.

Returns
Newly allocated string or NULL if fail.

◆ z_curl_post_json_no_auth()

int z_curl_post_json_no_auth ( const char * url,
const char * data,
int timeout,
GError ** error,
... )

Posts the given JSON to the URL without any authentication.

Parameters
timeoutTimeout, in seconds.
...Optional files to send as multi-part mime objects. Each object must contain 3 strings: name, filepath, mimetype. The list must end in NULL.
Returns
Non-zero if error.

◆ z_gdk_clipboard_get_text()

char * z_gdk_clipboard_get_text ( GdkClipboard * clipboard)

Returns the text on the clipboard, or NULL if there is nothing or the content is not text.

Warning
Only works for clipboard entries from the current process.

◆ z_gdk_pixbuf_new_from_icon_name()

GdkPixbuf * z_gdk_pixbuf_new_from_icon_name ( const char * icon_name,
int width,
int height,
int scale,
GError ** error )

Creates a new pixbuf for the given icon scaled at the given width/height.

Pass -1 for either width/height to maintain aspect ratio.

◆ z_gdk_texture_new_from_icon_name()

GdkTexture * z_gdk_texture_new_from_icon_name ( const char * icon_name,
int width,
int height,
int scale )

Creates a new texture for the given icon scaled at the given width/height.

Pass -1 for either width/height to maintain aspect ratio.

◆ z_gtk_actionable_set_action_from_setting()

void z_gtk_actionable_set_action_from_setting ( GtkActionable * actionable,
GSettings * settings,
const char * key )

Sets the action target of the given GtkActionable to be binded to the given setting.

Mainly used for binding GSettings keys to toggle buttons.

◆ z_gtk_dialog_run()

int z_gtk_dialog_run ( GtkDialog * dialog,
bool destroy_on_close )

Mimics the blocking behavior.

Returns
The response ID.
Deprecated
Use async dialogs instead.

◆ z_gtk_generate_screenshot_image()

void z_gtk_generate_screenshot_image ( GtkWidget * widget,
const char * type,
char ** option_keys,
char ** option_values,
char ** ret_dir,
char ** ret_path,
bool accept_fallback )

Generates a screenshot image for the given widget.

See gdk_pixbuf_savev() for the parameters.

Parameters
accept_fallbackWhether to accept a fallback "no image" pixbuf.
[out]ret_dirPlaceholder for directory to be deleted after using the screenshot.
[out]ret_pathPlaceholder for absolute path to the screenshot.

◆ z_gtk_get_tooltip_for_action()

char * z_gtk_get_tooltip_for_action ( const char * detailed_action,
const char * tooltip )

Gets the tooltip for the given action on the given widget.

If the action is valid, an orange text showing the accelerator will be added to the tooltip.

Returns
A new string that must be free'd with g_free().

◆ z_gtk_setup_foldable_notebook()

void z_gtk_setup_foldable_notebook ( GtkNotebook * notebook)

Makes the given notebook foldable.

The pages of the notebook must all be wrapped in GtkBox's.

◆ z_gtk_show_context_menu_from_g_menu()

void z_gtk_show_context_menu_from_g_menu ( GtkPopoverMenu * popover_menu,
double x,
double y,
GMenu * menu )

The popover must already exist as a children of its intended widget (or a common parent).

This function will set the new menu and show it.

◆ z_gtk_simple_action_shortcut_func()

gboolean z_gtk_simple_action_shortcut_func ( GtkWidget * widget,
GVariant * args,
gpointer user_data )

A shortcut callback to use for simple actions.

A single parameter must be passed: action name under "app.".

◆ z_gtk_text_buffer_get_full_text()

char * z_gtk_text_buffer_get_full_text ( GtkTextBuffer * buffer)

Returns the full text contained in the text buffer.

Must be free'd using g_free().

◆ z_gtk_widget_set_tooltip_for_action()

void z_gtk_widget_set_tooltip_for_action ( GtkWidget * widget,
const char * detailed_action,
const char * tooltip )

Sets the tooltip for the given action on the given widget.

If the action is valid, an orange text showing the accelerator will be added to the tooltip.

Variable Documentation

◆ error [1/2]

WARN_UNUSED_RESULT GError** error

Definition at line 38 of file io.h.

◆ error [2/2]

GError** error

Definition at line 90 of file resampler.h.