|
Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
|
Audio clips for the pool. More...
#include <src/dsp/file_audio_source.h>


Public Types | |
| using | BitDepth = zrythm::utils::audio::BitDepth |
| using | AudioFile = zrythm::utils::audio::AudioFile |
| using | channels_t = uint_fast8_t |
| using | bpm_t = float |
Public Member Functions | |
| FileAudioSource (QObject *parent=nullptr) | |
| FileAudioSource (const std::filesystem::path &full_path, units::sample_rate_t project_sample_rate, bpm_t current_bpm, QObject *parent=nullptr) | |
| Creates an audio clip from a file. | |
| FileAudioSource (const utils::audio::AudioBuffer &buf, utils::audio::BitDepth bit_depth, units::sample_rate_t project_sample_rate, bpm_t current_bpm, const utils::Utf8String &name, QObject *parent=nullptr) | |
| Creates an audio clip by copying the given buffer. | |
| FileAudioSource (const float *arr, units::sample_u64_t nframes, channels_t channels, zrythm::utils::audio::BitDepth bit_depth, units::sample_rate_t project_sample_rate, bpm_t current_bpm, const utils::Utf8String &name, QObject *parent=nullptr) | |
| Creates an audio clip by copying the given interleaved float array. | |
| FileAudioSource (channels_t channels, units::sample_u64_t nframes, units::sample_rate_t project_sample_rate, bpm_t current_bpm, const utils::Utf8String &name, QObject *parent=nullptr) | |
| Create an audio clip while recording. | |
| Q_SIGNAL void | samplesChanged () |
| Emitted when the source samples change. | |
| auto | get_bit_depth () const |
| auto | get_name () const |
| auto | get_bpm () const |
| const auto & | get_samples () const |
| auto | get_samplerate () const |
| void | set_name (const utils::Utf8String &name) |
| void | expand_with_frames (const utils::audio::AudioBuffer &frames) |
| Expands (appends to the end) the frames in the clip by the given frames. | |
| void | replace_frames (const utils::audio::AudioBuffer &src_frames, units::sample_u64_t start_frame) |
Replaces the clip's frames starting from start_frame with frames. | |
| void | replace_frames_from_interleaved (const float *frames, units::sample_u64_t start_frame, units::sample_u64_t num_frames_per_channel, channels_t channels) |
Replaces the clip's frames starting from start_frame with frames. | |
| void | clear_frames () |
| Unloads the clip's frames from memory. | |
| auto | get_num_channels () const |
| auto | get_num_frames () const |
| void | init_from_file (const std::filesystem::path &full_path, units::sample_rate_t project_sample_rate, std::optional< bpm_t > bpm_to_set) |
| Initializes members from an audio file. | |
| Public Member Functions inherited from zrythm::utils::UuidIdentifiableObject< FileAudioSource > | |
| UuidIdentifiableObject & | operator= (const UuidIdentifiableObject &other)=default |
| auto | get_uuid () const |
Friends | |
| void | init_from (FileAudioSource &obj, const FileAudioSource &other, utils::ObjectCloneType clone_type) |
| void | to_json (nlohmann::json &j, const FileAudioSource &clip) |
| void | from_json (const nlohmann::json &j, FileAudioSource &clip) |
Audio clips for the pool.
These should be loaded in the project's sample rate.
Definition at line 23 of file file_audio_source.h.
| using zrythm::dsp::FileAudioSource::AudioFile = zrythm::utils::audio::AudioFile |
Definition at line 31 of file file_audio_source.h.
| using zrythm::dsp::FileAudioSource::BitDepth = zrythm::utils::audio::BitDepth |
Definition at line 30 of file file_audio_source.h.
| using zrythm::dsp::FileAudioSource::bpm_t = float |
Definition at line 33 of file file_audio_source.h.
| using zrythm::dsp::FileAudioSource::channels_t = uint_fast8_t |
Definition at line 32 of file file_audio_source.h.
|
inline |
Definition at line 36 of file file_audio_source.h.
| zrythm::dsp::FileAudioSource::FileAudioSource | ( | const std::filesystem::path & | full_path, |
| units::sample_rate_t | project_sample_rate, | ||
| bpm_t | current_bpm, | ||
| QObject * | parent = nullptr ) |
Creates an audio clip from a file.
The basename of the file will be used as the name of the clip.
| current_bpm | Current BPM from TempoTrack. bpm_ will be set to this. FIXME: should this be optional? does "current" BPM make sense? |
| ZrythmException | on error. |
| zrythm::dsp::FileAudioSource::FileAudioSource | ( | const utils::audio::AudioBuffer & | buf, |
| utils::audio::BitDepth | bit_depth, | ||
| units::sample_rate_t | project_sample_rate, | ||
| bpm_t | current_bpm, | ||
| const utils::Utf8String & | name, | ||
| QObject * | parent = nullptr ) |
Creates an audio clip by copying the given buffer.
| buf | Buffer to copy. |
| name | A name for this clip. |
|
inline |
Creates an audio clip by copying the given interleaved float array.
| arr | Interleaved array. |
| nframes | Number of frames per channel. |
| channels | Number of channels. |
| name | A name for this clip. |
Definition at line 76 of file file_audio_source.h.
| zrythm::dsp::FileAudioSource::FileAudioSource | ( | channels_t | channels, |
| units::sample_u64_t | nframes, | ||
| units::sample_rate_t | project_sample_rate, | ||
| bpm_t | current_bpm, | ||
| const utils::Utf8String & | name, | ||
| QObject * | parent = nullptr ) |
Create an audio clip while recording.
The frames will keep getting reallocated until the recording is finished.
| nframes | Number of frames to allocate. This should be the current cycle's frames when called during recording. |
|
inline |
Unloads the clip's frames from memory.
Definition at line 171 of file file_audio_source.h.
| void zrythm::dsp::FileAudioSource::expand_with_frames | ( | const utils::audio::AudioBuffer & | frames | ) |
Expands (appends to the end) the frames in the clip by the given frames.
| frames | Non-interleaved frames. |
|
inline |
Definition at line 124 of file file_audio_source.h.
|
inline |
Definition at line 126 of file file_audio_source.h.
|
inline |
Definition at line 125 of file file_audio_source.h.
|
inline |
Definition at line 177 of file file_audio_source.h.
|
inline |
Definition at line 178 of file file_audio_source.h.
|
inline |
Definition at line 128 of file file_audio_source.h.
|
inline |
Definition at line 127 of file file_audio_source.h.
| void zrythm::dsp::FileAudioSource::init_from_file | ( | const std::filesystem::path & | full_path, |
| units::sample_rate_t | project_sample_rate, | ||
| std::optional< bpm_t > | bpm_to_set ) |
Initializes members from an audio file.
| full_path | Path to the file. |
| bpm_to_set | BPM of the clip to set (File BPM or 0 will be used if nullopt). |
| ZrythmException | on I/O error. |
| void zrythm::dsp::FileAudioSource::replace_frames | ( | const utils::audio::AudioBuffer & | src_frames, |
| units::sample_u64_t | start_frame ) |
Replaces the clip's frames starting from start_frame with frames.
| src_frames | Frames to copy. |
| start_frame | Frame to start copying to (src_frames are always copied from the start). |
| void zrythm::dsp::FileAudioSource::replace_frames_from_interleaved | ( | const float * | frames, |
| units::sample_u64_t | start_frame, | ||
| units::sample_u64_t | num_frames_per_channel, | ||
| channels_t | channels ) |
Replaces the clip's frames starting from start_frame with frames.
| frames | Frames, interleaved. |
| start_frame | Frame to start copying to (src_frames are always copied from the start). |
|
inline |
Definition at line 130 of file file_audio_source.h.