Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
slice_point_analyzer.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <limits>
5#include <span>
6#include <vector>
7
12
13namespace pulp::audio {
14
15inline constexpr std::uint32_t kUnmappedTransientCandidateMarkerIndex =
16 std::numeric_limits<std::uint32_t>::max();
17
24
26 std::uint64_t source_generation = 0;
27 double source_sample_rate = 0.0;
28 std::uint64_t min_slice_frames = 256;
29 std::uint64_t snap_radius_frames = 64;
31 std::span<const SliceMarker> additional_markers{};
32 // Sidecar provenance over the `onsets` span. marker_index refers to the
33 // source onset index and is remapped to the final debounced slice marker.
34 std::span<const AnalyzerMarkerProvenance> onset_provenance{};
35 // Optional control-thread classifier output associated with final markers.
36 std::span<const TransientClassification> transient_classifications{};
37 // Optional authoritative map from TransientClassification::candidate_index
38 // to final SliceMap marker index for the same analysis generation. Use
39 // kUnmappedTransientCandidateMarkerIndex for candidate frames that do not
40 // have a surviving marker. When empty, classifications fall back to
41 // nearest-frame matching. When present, classifications with explicit but
42 // unresolvable candidate identity are dropped instead of falling back.
43 std::span<const std::uint32_t> transient_candidate_marker_indices{};
44 std::uint64_t transient_match_radius_frames = 256;
45};
46
48 bool ok = false;
50 std::vector<AnalyzerMarkerProvenance> marker_provenance;
51 std::vector<SliceMarkerClassification> marker_classifications;
52};
53
58
59enum class SliceSnapPolicy : std::uint8_t {
62};
63
65 // Includes the origin region. Zero leaves the region count unlimited.
66 std::uint32_t max_regions = 0;
70};
71
73public:
74 // Off-real-time/background analysis. Merges built-in/package onsets with
75 // optional beat-grid, silence, manual, imported, and loop-boundary markers.
77 std::span<const OnsetMarker> onsets,
78 const SlicePointAnalysisConfig& config) const;
80 std::span<const OnsetMarker> onsets,
81 const SlicePointAnalysisConfig& config,
82 const SliceSelectionOptions& options) const;
83};
84
85} // namespace pulp::audio
Non-owning view over multi-channel audio sample data.
Definition buffer.hpp:30
Definition slice_point_analyzer.hpp:72
SlicePointAnalysisResult analyze(BufferView< const float > source, std::span< const OnsetMarker > onsets, const SlicePointAnalysisConfig &config, const SliceSelectionOptions &options) const
SlicePointAnalysisResult analyze(BufferView< const float > source, std::span< const OnsetMarker > onsets, const SlicePointAnalysisConfig &config) const
Definition analyzer_provider.hpp:12
constexpr std::uint32_t kUnmappedTransientCandidateMarkerIndex
Definition slice_point_analyzer.hpp:15
SliceCandidateSelection
Definition slice_point_analyzer.hpp:54
@ TimelineOrder
Definition slice_point_analyzer.hpp:55
@ StrongestConfidence
Definition slice_point_analyzer.hpp:56
SliceSnapPolicy
Definition slice_point_analyzer.hpp:59
@ SignTransition
Definition slice_point_analyzer.hpp:61
@ NearZero
Definition slice_point_analyzer.hpp:60
TransientClass
Definition analyzer_provider.hpp:177
@ Unknown
Definition analyzer_provider.hpp:178
Definition analyzer_provider.hpp:138
Definition slice_map.hpp:30
Definition slice_point_analyzer.hpp:18
std::uint32_t marker_index
Definition slice_point_analyzer.hpp:19
AnalyzerProvenance provenance
Definition slice_point_analyzer.hpp:22
double confidence
Definition slice_point_analyzer.hpp:21
TransientClass transient_class
Definition slice_point_analyzer.hpp:20
Definition slice_point_analyzer.hpp:25
double source_sample_rate
Definition slice_point_analyzer.hpp:27
std::span< const TransientClassification > transient_classifications
Definition slice_point_analyzer.hpp:36
bool snap_to_zero_crossing
Definition slice_point_analyzer.hpp:30
std::uint64_t snap_radius_frames
Definition slice_point_analyzer.hpp:29
std::uint64_t min_slice_frames
Definition slice_point_analyzer.hpp:28
std::span< const SliceMarker > additional_markers
Definition slice_point_analyzer.hpp:31
std::span< const std::uint32_t > transient_candidate_marker_indices
Definition slice_point_analyzer.hpp:43
std::span< const AnalyzerMarkerProvenance > onset_provenance
Definition slice_point_analyzer.hpp:34
std::uint64_t source_generation
Definition slice_point_analyzer.hpp:26
std::uint64_t transient_match_radius_frames
Definition slice_point_analyzer.hpp:44
Definition slice_point_analyzer.hpp:47
SliceMap map
Definition slice_point_analyzer.hpp:49
std::vector< SliceMarkerClassification > marker_classifications
Definition slice_point_analyzer.hpp:51
bool ok
Definition slice_point_analyzer.hpp:48
std::vector< AnalyzerMarkerProvenance > marker_provenance
Definition slice_point_analyzer.hpp:50
Definition slice_point_analyzer.hpp:64
SliceCandidateSelection candidate_selection
Definition slice_point_analyzer.hpp:67
SliceSnapPolicy snap_policy
Definition slice_point_analyzer.hpp:69
std::uint32_t max_regions
Definition slice_point_analyzer.hpp:66