Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
pool.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2019-2023 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __AUDIO_POOL_H__
11#define __AUDIO_POOL_H__
12
13#include "dsp/clip.h"
14#include "utils/yaml.h"
15
16typedef struct Track Track;
17
24#define AUDIO_POOL_SCHEMA_VERSION 1
25
26#define AUDIO_POOL (AUDIO_ENGINE->pool)
27
38typedef struct AudioPool
39{
40 int schema_version;
41
48
57
59 size_t clips_size;
60} AudioPool;
61
65bool
66audio_pool_init_loaded (AudioPool * self, GError ** error);
67
73
82int
84
93int
95 AudioPool * self,
96 int clip_id,
97 bool write_file,
98 GError ** error);
99
103AudioClip *
104audio_pool_get_clip (AudioPool * self, int clip_id);
105
113void
115 AudioPool * self,
116 int clip_id,
117 bool free_and_remove_file,
118 bool backup);
119
127void
129
138void
140
144MALLOC
145char *
147
156bool
158
168bool
169audio_pool_write_to_disk (AudioPool * self, bool is_backup, GError ** error);
170
174AudioPool *
176
177void
178audio_pool_print (const AudioPool * const self);
179
180void
181audio_pool_free (AudioPool * self);
182
187#endif
Audio clip.
int audio_pool_add_clip(AudioPool *self, AudioClip *clip)
Adds an audio clip to the pool.
void audio_pool_ensure_unique_clip_name(AudioPool *pool, AudioClip *clip)
Ensures that the name of the clip is unique.
bool audio_pool_reload_clip_frame_bufs(AudioPool *self, GError **error)
Loads the frame buffers of clips currently in use in the project from their files and frees the buffe...
bool audio_pool_write_to_disk(AudioPool *self, bool is_backup, GError **error)
Writes all the clips to disk.
AudioPool * audio_pool_clone(const AudioPool *src)
To be used during serialization.
bool audio_pool_init_loaded(AudioPool *self, GError **error)
Inits after loading a project.
void audio_pool_remove_clip(AudioPool *self, int clip_id, bool free_and_remove_file, bool backup)
Removes the clip with the given ID from the pool and optionally frees it (and removes the file).
void audio_pool_remove_unused(AudioPool *self, bool backup)
Removes and frees (and removes the files for) all clips not used by the project or undo stacks.
int audio_pool_duplicate_clip(AudioPool *self, int clip_id, bool write_file, GError **error)
Duplicates the clip with the given ID and returns the duplicate.
MALLOC char * audio_pool_gen_name_for_recording_clip(AudioPool *pool, Track *track, int lane)
Generates a name for a recording clip.
AudioClip * audio_pool_get_clip(AudioPool *self, int clip_id)
Returns the clip for the given ID.
AudioPool * audio_pool_new(void)
Creates a new audio pool.
Audio clips for the pool.
Definition clip.h:33
An audio pool is a pool of audio files and their corresponding float arrays in memory that are refere...
Definition pool.h:39
size_t clips_size
Array sizes.
Definition pool.h:59
int num_clips
Clip counter.
Definition pool.h:56
AudioClip ** clips
Audio clips.
Definition pool.h:47
Track to be inserted into the Project's Tracklist.
Definition track.h:177
YAML utils.