An audio pool is a pool of audio files and their corresponding float arrays in memory that are referenced by regions.
More...
#include <src/engine/session/pool.h>
|
|
| AudioPool (ProjectPoolPathGetter path_getter, SampleRateGetter sr_getter) |
| |
| void | init_loaded () |
| | Initializes the audio pool after deserialization.
|
| |
| void | register_clip (std::shared_ptr< AudioClip > clip) |
| | Takes ownership of the given clip.
|
| |
| auto | duplicate_clip (const AudioClip::Uuid &clip_id, bool write_file) -> AudioClip::Uuid |
| | Duplicates the clip with the given ID and returns the duplicate.
|
| |
|
AudioClip * | get_clip (const AudioClip::Uuid &clip_id) |
| | Returns the clip for the given ID.
|
| |
| fs::path | get_clip_path_from_name (const utils::Utf8String &name, bool use_flac, bool is_backup) const |
| | Gets the path of a clip matching name from the pool.
|
| |
| fs::path | get_clip_path (const AudioClip &clip, bool is_backup) const |
| | Gets the path of the given clip from the pool.
|
| |
| void | write_clip (AudioClip &clip, bool parts, bool backup) |
| | Writes the clip to the pool as a wav file.
|
| |
| void | remove_clip (const AudioClip::Uuid &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 | remove_unused (bool backup) |
| | Removes and frees (and removes the files for) all clips not used by the project or undo stacks.
|
| |
| void | ensure_unique_clip_name (AudioClip &clip) |
| | Ensures that the name of the clip is unique.
|
| |
| void | reload_clip_frame_bufs () |
| | Loads the frame buffers of clips currently in use in the project from their files and frees the buffers of clips not currently in use.
|
| |
| void | write_to_disk (bool is_backup) |
| | Writes all the clips to disk.
|
| |
|
void | print () const |
| |
An audio pool is a pool of audio files and their corresponding float arrays in memory that are referenced by regions.
Instead of associating audio files with regions, all audio files (and their edited counterparts after some hard editing like stretching) are saved in the pool.
Definition at line 23 of file pool.h.
◆ ProjectPoolPathGetter
| using AudioPool::ProjectPoolPathGetter = std::function<fs::path (bool backup)> |
◆ duplicate_clip()
| auto AudioPool::duplicate_clip |
( |
const AudioClip::Uuid & | clip_id, |
|
|
bool | write_file ) -> AudioClip::Uuid |
Duplicates the clip with the given ID and returns the duplicate.
- Parameters
-
| write_file | Whether to also write the file. |
- Returns
- The ID in the pool.
- Exceptions
-
◆ ensure_unique_clip_name()
| void AudioPool::ensure_unique_clip_name |
( |
AudioClip & | clip | ) |
|
Ensures that the name of the clip is unique.
The clip must not be part of the pool yet.
If the clip name is not unique, it will be replaced by a unique name.
◆ get_clip_path()
| fs::path AudioPool::get_clip_path |
( |
const AudioClip & | clip, |
|
|
bool | is_backup ) const |
Gets the path of the given clip from the pool.
- Parameters
-
| is_backup | Whether writing to a backup project. |
◆ get_clip_path_from_name()
| fs::path AudioPool::get_clip_path_from_name |
( |
const utils::Utf8String & | name, |
|
|
bool | use_flac, |
|
|
bool | is_backup ) const |
Gets the path of a clip matching name from the pool.
- Parameters
-
| use_flac | Whether to look for a FLAC file instead of a wav file. |
| is_backup | Whether writing to a backup project. |
◆ init_loaded()
| void AudioPool::init_loaded |
( |
| ) |
|
Initializes the audio pool after deserialization.
- Exceptions
-
◆ register_clip()
| void AudioPool::register_clip |
( |
std::shared_ptr< AudioClip > | clip | ) |
|
Takes ownership of the given clip.
Changes the name of the clip if another clip with the same name already exists.
◆ reload_clip_frame_bufs()
| void AudioPool::reload_clip_frame_bufs |
( |
| ) |
|
Loads the frame buffers of clips currently in use in the project from their files and frees the buffers of clips not currently in use.
This should be called whenever there is a relevant change in the project (eg, object added/removed).
- Exceptions
-
◆ remove_clip()
| void AudioPool::remove_clip |
( |
const AudioClip::Uuid & | 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).
- Parameters
-
| backup | Whether to remove from backup directory. |
- Exceptions
-
◆ remove_unused()
| void AudioPool::remove_unused |
( |
bool | backup | ) |
|
Removes and frees (and removes the files for) all clips not used by the project or undo stacks.
- Parameters
-
| backup | Whether to remove from backup directory. |
- Exceptions
-
◆ write_clip()
| void AudioPool::write_clip |
( |
AudioClip & | clip, |
|
|
bool | parts, |
|
|
bool | backup ) |
Writes the clip to the pool as a wav file.
- Parameters
-
| parts | If true, only write new data. |
- See also
- AudioClip.frames_written.
- Parameters
-
| backup | Whether writing to a backup project. |
- Exceptions
-
◆ write_to_disk()
| void AudioPool::write_to_disk |
( |
bool | is_backup | ) |
|
Writes all the clips to disk.
Used when saving a project elsewhere.
- Parameters
-
| is_backup | Whether this is a backup project. |
- Exceptions
-
The documentation for this struct was generated from the following file: