Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
finite_time_stretch.hpp
Go to the documentation of this file.
1#pragma once
2
4
5#include <cstdint>
6#include <memory>
7
8namespace pulp::audio {
9
22
23enum class FiniteTimeStretchStepStatus : std::uint8_t { Progress, Complete, Failed };
24
33
43
44using FiniteTimeStretchRatioAtInputFrame = float (*)(void* context, std::uint64_t input_frame,
45 std::uint64_t input_frame_count) noexcept;
46
48 std::shared_ptr<const AudioFileData> source;
49 std::uint64_t source_start = 0;
50 std::uint64_t source_frame_count = 0;
51 std::uint32_t timeline_sample_rate = 0;
52 std::uint64_t target_frame_count = 0;
53 std::uint32_t max_block_frames = 256;
54 float max_time_ratio = 4.0f;
55 float constant_time_ratio = 1.0f;
57 void* ratio_context = nullptr;
58 std::uint64_t max_input_frames = 100'000'000u;
59 std::uint64_t max_output_frames = 100'000'000u;
60 // Offline determinism uses scalar double planar DSP scratch, then performs
61 // a bounded final conversion into the public float artifact.
62 std::uint64_t max_input_bytes = 1024u * 1024u * 1024u;
63 std::uint64_t max_output_bytes = 1024u * 1024u * 1024u;
64 std::uint64_t max_artifact_bytes = 512u * 1024u * 1024u;
65 std::uint64_t max_sample_rate_converter_bytes = 256u * 1024u * 1024u;
66 std::uint64_t max_scratch_allocation_bytes = 256u * 1024u * 1024u;
67};
68
80 public:
86 FiniteTimeStretchJob& operator=(const FiniteTimeStretchJob&) = delete;
87
90
93 FiniteTimeStretchStage stage() const noexcept;
94 std::uint64_t timeline_input_frame_count() const noexcept;
95 std::uint64_t input_frames_materialized() const noexcept;
96 std::uint64_t output_frames_written() const noexcept;
97 std::shared_ptr<const AudioFileData> take() noexcept;
98
99 private:
100 struct Impl;
101 std::unique_ptr<Impl> impl_;
102};
103
104} // namespace pulp::audio
FiniteTimeStretchJob(FiniteTimeStretchJob &&) noexcept
std::uint64_t timeline_input_frame_count() const noexcept
std::uint64_t output_frames_written() const noexcept
std::uint64_t input_frames_materialized() const noexcept
FiniteTimeStretchStepStatus step() noexcept
FiniteTimeStretchPrepareStatus prepare(FiniteTimeStretchConfig config)
std::shared_ptr< const AudioFileData > take() noexcept
FiniteTimeStretchFailure failure() const noexcept
FiniteTimeStretchPrepareStatus prepare_status() const noexcept
FiniteTimeStretchStage stage() const noexcept
Definition analyzer_provider.hpp:12
FiniteTimeStretchStage
Definition finite_time_stretch.hpp:34
@ PrepareSampleRateConverter
Definition finite_time_stretch.hpp:35
@ PrepareStretch
Definition finite_time_stretch.hpp:37
@ ConvertOutput
Definition finite_time_stretch.hpp:39
@ MaterializeTimelineInput
Definition finite_time_stretch.hpp:36
@ Stretch
Definition finite_time_stretch.hpp:38
FiniteTimeStretchFailure
Definition finite_time_stretch.hpp:25
@ OutputTooLong
Definition finite_time_stretch.hpp:30
@ None
Definition finite_time_stretch.hpp:26
@ ProcessorProtocolError
Definition finite_time_stretch.hpp:31
@ AllocationFailed
Definition finite_time_stretch.hpp:27
@ OutputTooShort
Definition finite_time_stretch.hpp:29
FiniteTimeStretchStepStatus
Definition finite_time_stretch.hpp:23
@ Progress
Definition finite_time_stretch.hpp:23
@ Complete
Definition finite_time_stretch.hpp:23
@ Failed
Definition finite_time_stretch.hpp:23
FiniteTimeStretchPrepareStatus
Definition finite_time_stretch.hpp:10
@ ProcessorPrepareFailed
Definition finite_time_stretch.hpp:20
@ InvalidSource
Definition finite_time_stretch.hpp:12
@ Prepared
Definition finite_time_stretch.hpp:11
@ InvalidSampleRate
Definition finite_time_stretch.hpp:14
@ InvalidTarget
Definition finite_time_stretch.hpp:16
@ InvalidSlice
Definition finite_time_stretch.hpp:13
@ InvalidBlockSize
Definition finite_time_stretch.hpp:15
@ SampleRateConverterPrepareFailed
Definition finite_time_stretch.hpp:19
@ InvalidRatio
Definition finite_time_stretch.hpp:17
@ CapacityExceeded
Definition finite_time_stretch.hpp:18
float(*)(void *context, std::uint64_t input_frame, std::uint64_t input_frame_count) noexcept FiniteTimeStretchRatioAtInputFrame
Definition finite_time_stretch.hpp:44
STL namespace.
Definition audio_file.hpp:24
Definition finite_time_stretch.hpp:47
std::shared_ptr< const AudioFileData > source
Definition finite_time_stretch.hpp:48
std::uint64_t max_output_bytes
Definition finite_time_stretch.hpp:63
std::uint64_t max_scratch_allocation_bytes
Definition finite_time_stretch.hpp:66
std::uint32_t timeline_sample_rate
Definition finite_time_stretch.hpp:51
float constant_time_ratio
Definition finite_time_stretch.hpp:55
std::uint64_t max_sample_rate_converter_bytes
Definition finite_time_stretch.hpp:65
std::uint64_t source_start
Definition finite_time_stretch.hpp:49
void * ratio_context
Definition finite_time_stretch.hpp:57
std::uint64_t max_output_frames
Definition finite_time_stretch.hpp:59
std::uint32_t max_block_frames
Definition finite_time_stretch.hpp:53
float max_time_ratio
Definition finite_time_stretch.hpp:54
std::uint64_t max_artifact_bytes
Definition finite_time_stretch.hpp:64
std::uint64_t target_frame_count
Definition finite_time_stretch.hpp:52
std::uint64_t max_input_bytes
Definition finite_time_stretch.hpp:62
std::uint64_t max_input_frames
Definition finite_time_stretch.hpp:58
FiniteTimeStretchRatioAtInputFrame ratio_at_input_frame
Definition finite_time_stretch.hpp:56
std::uint64_t source_frame_count
Definition finite_time_stretch.hpp:50