10#ifndef __AUDIO_CLIP_H__
11#define __AUDIO_CLIP_H__
25#define AUDIO_CLIP_SCHEMA_VERSION 1
100static const cyaml_schema_field_t audio_clip_fields_schema[] = {
101 YAML_FIELD_INT (
AudioClip, schema_version),
103 YAML_FIELD_STRING_PTR_OPTIONAL (
AudioClip, file_hash),
105 YAML_FIELD_ENUM (
AudioClip, bit_depth, bit_depth_strings),
113static const cyaml_schema_value_t audio_clip_schema = {
123 return bd < BIT_DEPTH_32;
208WARN_UNUSED_RESULT NONNULL
bool
211 const
char * filepath,
225WARN_UNUSED_RESULT NONNULL
bool
NONNULL_ARGS(1) int undo_manager_undo(UndoManager *self
Undo last action.
AudioClip * audio_clip_new_from_file(const char *full_path, GError **error)
Creates an audio clip from a file.
NONNULL void audio_clip_remove_and_free(AudioClip *self, bool backup)
To be called by audio_pool_remove_clip().
NONNULL char * audio_clip_get_path_in_pool_from_name(const char *name, bool use_flac, bool is_backup)
Gets the path of a clip matching name from the pool.
AudioClip * audio_clip_new_recording(const channels_t channels, const unsigned_frame_t nframes, const char *name)
Create an audio clip while recording.
NONNULL void audio_clip_update_channel_caches(AudioClip *self, size_t start_from)
Updates the channel caches.
NONNULL void audio_clip_free(AudioClip *self)
Frees the audio clip.
WARN_UNUSED_RESULT NONNULL bool audio_clip_write_to_file(AudioClip *self, const char *filepath, bool parts, GError **error)
Writes the given audio clip data to a file.
NONNULL AudioClip * audio_clip_edit_in_ext_program(AudioClip *self, GError **error)
Shows a dialog with info on how to edit a file, with an option to open an app launcher.
WARN_UNUSED_RESULT NONNULL bool audio_clip_write_to_pool(AudioClip *self, bool parts, bool is_backup, GError **error)
Writes the clip to the pool as a wav file.
NONNULL char * audio_clip_get_path_in_pool(AudioClip *self, bool is_backup)
Gets the path of the given clip from the pool.
AudioClip * audio_clip_new_from_float_array(const float *arr, const unsigned_frame_t nframes, const channels_t channels, BitDepth bit_depth, const char *name)
Creates an audio clip by copying the given float array.
COLD NONNULL bool audio_clip_init_loaded(AudioClip *self, GError **error)
Inits after loading a Project.
NONNULL bool audio_clip_is_in_use(AudioClip *self, bool check_undo_stack)
Returns whether the clip is used inside the project.
uint_fast64_t unsigned_frame_t
Unsigned type for frame index.
float sample_t
The sample type.
#define YAML_VALUE_PTR_NULLABLE(cc, fields_schema)
Schema to be used as a pointer that can be NULL.
unsigned int channels_t
Number of channels.
Audio clips for the pool.
sample_t * frames
The audio frames, interleaved.
char * name
Name of the clip.
char * file_hash
File hash, used for checking if a clip is already written to the pool.
sample_t * ch_frames[16]
Per-channel frames for convenience.
int pool_id
ID in the audio pool.
unsigned_frame_t num_frames
Number of frames per channel.
unsigned_frame_t frames_written
Frames already written to the file, per channel.
BitDepth bit_depth
Bit depth of the clip when the clip was imported into the project.
bool use_flac
Whether the clip should use FLAC when being serialized.
gint64 last_write
Time the last write took place.
bpm_t bpm
BPM of the clip, or BPM of the project when the clip was first loaded.
int samplerate
Samplerate of the clip, or samplerate when the clip was imported into the project.
channels_t channels
Number of channels.