Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
supported_file.h
Go to the documentation of this file.
1// clang-format off
2// SPDX-FileCopyrightText: © 2019-2021, 2023 Alexandros Theodotou <alex@zrythm.org>
3// SPDX-License-Identifier: LicenseRef-ZrythmLicense
4// clang-format on
5
12#ifndef __AUDIO_SUPPORTED_FILE_H__
13#define __AUDIO_SUPPORTED_FILE_H__
14
15#include <glib.h>
16
17typedef struct _WrappedObjectWithChangeSignal WrappedObjectWithChangeSignal;
18
25#define SUPPORTED_FILE_DND_PREFIX Z_DND_STRING_PREFIX "SupportedFile::"
26
30enum class ZFileType
31{
32 FILE_TYPE_MIDI,
33 FILE_TYPE_MP3,
34 FILE_TYPE_FLAC,
35 FILE_TYPE_OGG,
36 FILE_TYPE_WAV,
37 FILE_TYPE_DIR,
40 FILE_TYPE_OTHER,
41 NUM_FILE_TYPES,
42};
43
47typedef struct SupportedFile
48{
50 char * abs_path;
51
54
56 char * label;
57
59 int hidden;
60
62 // MidiFile * midi_file;
63
65 // AudioFile * midi_file;
66
70
76supported_file_new_from_path (const char * path);
77
79supported_file_new_from_uri (const char * uri, GError ** error);
80
87char *
89
95
99int
101
105int
107
111int
113
118const char *
120
124NONNULL ZFileType
125supported_file_get_type (const char * file);
126
131NONNULL bool
133
138const char *
140
144NONNULL char *
146
150void
152
157#endif
int supported_file_type_is_midi(ZFileType type)
Returns if the SupportedFile is a midi file.
ZFileType
File type.
SupportedFile * supported_file_new_from_path(const char *path)
Creates a new SupportedFile from the given absolute path.
void supported_file_free(SupportedFile *self)
Frees the instance and all its members.
int supported_file_type_is_supported(ZFileType type)
Returns if the given type is supported.
char * supported_file_type_get_description(ZFileType type)
Returns a human readable description of the given file type.
int supported_file_type_is_audio(ZFileType type)
Returns if the SupportedFile is an audio file.
NONNULL char * supported_file_get_info_text_for_label(const SupportedFile *self)
Returns a pango markup to be used in GTK labels.
NONNULL bool supported_file_should_autoplay(const SupportedFile *self)
Returns whether the given file should auto-play (shorter than 1 min).
NONNULL ZFileType supported_file_get_type(const char *file)
Returns the file type of the given file path.
SupportedFile * supported_file_clone(const SupportedFile *src)
Clones the given SupportedFile.
const char * supported_file_type_get_ext(ZFileType type)
Returns the most common extension for the given filetype.
const char * supported_file_get_icon_name(const SupportedFile *const self)
Gets the corresponding icon name for the given SupportedFile's type.
@ FILE_TYPE_PARENT_DIR
Special entry ".." for the parent dir.
Metadata for a supported file.
int hidden
Hidden or not.
char * label
Human readable label.
char * abs_path
Absolute path.
ZFileType type
Type of file.
WrappedObjectWithChangeSignal * gobj
MIDI file, if midi.
A GObject-ified normal C object with a signal that interested parties can listen to for changes.