Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
loop_types.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4
5namespace pulp::audio {
6
7enum class LoopPlaybackMode : std::uint8_t {
11 PingPong, // forward then backward, reflecting at the loop boundaries
12 ReverseOnce, // play once from end to start, then stop (no loop)
13};
14
15enum class LoopCrossfadeCurve : std::uint8_t {
18};
19
20enum class LoopInterpolationMode : std::uint8_t {
24};
25
32
41
42struct LoopRegion {
43 std::uint64_t start_frame = 0;
44 std::uint64_t end_frame = 0; // exclusive
45 std::uint64_t crossfade_frames = 0;
46 double source_sample_rate = 0.0;
51 // Two-phase playback (PlunderTube / Logic model): reverse_entry sets the
52 // FIRST-pass direction (where playback enters and which way it travels),
53 // while playback_mode sets the STEADY-STATE loop behavior that takes over
54 // after the first pass reaches the far edge — its direction OVERRIDES the
55 // entry. So a Reverse loop with reverse_entry=false plays forward once, then
56 // loops backward; a Forward loop with reverse_entry=true plays backward once,
57 // then loops forward. Default false = enter forward (unchanged for Forward/
58 // OneShot/PingPong). ReverseOnce implies a reverse entry regardless.
59 bool reverse_entry = false;
60};
61
66
68 std::uint64_t source_frames,
69 std::uint64_t min_loop_frames = 1) noexcept;
70
71} // namespace pulp::audio
Definition analyzer_provider.hpp:12
LoopSnapPolicy
Definition loop_types.hpp:26
@ NearestZeroCrossing
Definition loop_types.hpp:28
@ SlopeMatchedZeroCrossing
Definition loop_types.hpp:29
@ ValueDirection
Definition loop_types.hpp:30
LoopValidationResult validate_loop_region(const LoopRegion &region, std::uint64_t source_frames, std::uint64_t min_loop_frames=1) noexcept
LoopPlaybackMode
Definition loop_types.hpp:7
@ Forward
Definition loop_types.hpp:9
@ Reverse
Definition loop_types.hpp:10
@ ReverseOnce
Definition loop_types.hpp:12
@ PingPong
Definition loop_types.hpp:11
@ OneShot
Definition loop_types.hpp:8
@ None
Definition finite_time_stretch.hpp:26
LoopCrossfadeCurve
Definition loop_types.hpp:15
@ Linear
Definition loop_types.hpp:16
@ EqualPower
Definition loop_types.hpp:17
LoopInterpolationMode
Definition loop_types.hpp:20
@ Linear
Definition loop_types.hpp:22
@ Cubic
Definition loop_types.hpp:23
LoopValidationStatus
Definition loop_types.hpp:33
@ TooShort
Definition loop_types.hpp:37
@ Ok
Definition loop_types.hpp:34
@ EmptySource
Definition loop_types.hpp:35
@ InvalidRange
Definition loop_types.hpp:36
@ CrossfadeTooLong
Definition loop_types.hpp:38
@ InvalidSampleRate
Definition finite_time_stretch.hpp:14
Definition loop_types.hpp:42
LoopCrossfadeCurve crossfade_curve
Definition loop_types.hpp:48
std::uint64_t crossfade_frames
Definition loop_types.hpp:45
LoopPlaybackMode playback_mode
Definition loop_types.hpp:47
bool reverse_entry
Definition loop_types.hpp:59
double source_sample_rate
Definition loop_types.hpp:46
LoopSnapPolicy snap_policy
Definition loop_types.hpp:50
std::uint64_t start_frame
Definition loop_types.hpp:43
std::uint64_t end_frame
Definition loop_types.hpp:44
LoopInterpolationMode interpolation
Definition loop_types.hpp:49
Definition loop_types.hpp:62
bool ok
Definition loop_types.hpp:63
LoopValidationStatus status
Definition loop_types.hpp:64