Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
assets.hpp
Go to the documentation of this file.
1#pragma once
2
5
6#include <array>
7#include <compare>
8#include <cstdint>
9#include <optional>
10#include <string>
11#include <string_view>
12#include <vector>
13
14namespace pulp::timeline {
15
19
25 public:
26 constexpr ContentHash() noexcept = default;
28 static std::optional<ContentHash> from_hex(std::string_view hex) noexcept;
29
31 std::string to_hex() const;
33 constexpr bool valid() const noexcept { return valid_; }
35 constexpr const std::array<std::uint8_t, 32>& bytes() const noexcept { return bytes_; }
36 constexpr auto operator<=>(const ContentHash&) const = default;
37
38 private:
39 explicit constexpr ContentHash(std::array<std::uint8_t, 32> bytes) noexcept
40 : bytes_(bytes), valid_(true) {}
41 std::array<std::uint8_t, 32> bytes_{};
42 bool valid_ = false;
43};
44
46enum class AssetStoragePolicy : std::uint8_t {
53};
54
56enum class AssetLocatorKind : std::uint8_t {
61};
62
66 std::string hint;
67 constexpr auto operator<=>(const AssetLocator&) const = default;
68};
69
80
82enum class AudioLoopPointKind : std::uint8_t {
85};
86
89 std::uint64_t frame = 0;
91 constexpr auto operator<=>(const AudioLoopPoint&) const = default;
92};
93
96 std::uint64_t start_frame = 0;
97 std::uint64_t end_frame = 0;
98 constexpr auto operator<=>(const AudioFrameRange&) const = default;
99};
100
106 std::optional<timebase::TickDuration> musical_length;
108 bool one_shot = false;
109 std::optional<std::uint8_t> root_note;
110 std::optional<AudioFrameRange> active_range;
111 std::vector<AudioLoopPoint> points;
112 std::vector<std::string> tags;
113 auto operator<=>(const AudioLoopInfo&) const = default;
114};
115
117
118} // namespace pulp::timeline
Durable SHA-256 identity for sealed media bytes.
Definition assets.hpp:24
constexpr const std::array< std::uint8_t, 32 > & bytes() const noexcept
Borrows the 32 digest bytes for the lifetime of this value.
Definition assets.hpp:35
constexpr ContentHash() noexcept=default
static std::optional< ContentHash > from_hex(std::string_view hex) noexcept
Decodes exactly 64 lowercase hexadecimal digits, or returns null on malformed input.
constexpr auto operator<=>(const ContentHash &) const =default
constexpr bool valid() const noexcept
Returns whether this value was constructed from a complete digest.
Definition assets.hpp:33
std::string to_hex() const
Returns the lowercase 64-digit encoding; invalid hashes encode as 64 zeroes.
AssetLocatorKind
Namespace in which an asset locator hint is interpreted.
Definition assets.hpp:56
AssetStoragePolicy
Preferred storage relationship between a project and an asset's bytes.
Definition assets.hpp:46
AudioLoopPointKind
Provenance of a suggested audio loop point.
Definition assets.hpp:82
@ ExternalUri
An application-resolved external URI.
Definition assets.hpp:60
@ PackageRelative
A lexically safe path relative to a project package.
Definition assets.hpp:58
@ Embedded
Store the bytes in the project package.
Definition assets.hpp:50
@ PreferEmbedded
Prefer packaged bytes while permitting external resolution.
Definition assets.hpp:52
@ External
Resolve the bytes outside the project package.
Definition assets.hpp:48
@ Automatic
Definition assets.hpp:84
@ Manual
Definition assets.hpp:83
Definition program_compiler.hpp:18
STL namespace.
Definition compiled_meter_map.hpp:14
Non-authoritative location hint for resolving content by hash.
Definition assets.hpp:64
AssetLocatorKind kind
Definition assets.hpp:65
constexpr auto operator<=>(const AssetLocator &) const =default
std::string hint
Definition assets.hpp:66
Alternate fidelity, analysis, or cache form of the same logical asset.
Definition assets.hpp:74
std::string role
Definition assets.hpp:75
AssetStoragePolicy storage_policy
Definition assets.hpp:77
std::vector< AssetLocator > locators
Definition assets.hpp:78
ContentHash content_hash
Definition assets.hpp:76
Half-open frame interval [start_frame, end_frame).
Definition assets.hpp:95
std::uint64_t end_frame
Definition assets.hpp:97
std::uint64_t start_frame
Definition assets.hpp:96
constexpr auto operator<=>(const AudioFrameRange &) const =default
Typed musical metadata attached to sealed audio content.
Definition assets.hpp:105
std::optional< std::uint8_t > root_note
Definition assets.hpp:109
timebase::MeterSignature meter
Definition assets.hpp:107
auto operator<=>(const AudioLoopInfo &) const =default
bool one_shot
Definition assets.hpp:108
std::optional< timebase::TickDuration > musical_length
Definition assets.hpp:106
std::vector< AudioLoopPoint > points
Definition assets.hpp:111
std::vector< std::string > tags
Definition assets.hpp:112
std::optional< AudioFrameRange > active_range
Definition assets.hpp:110
Frame position at which sealed audio may loop.
Definition assets.hpp:88
constexpr auto operator<=>(const AudioLoopPoint &) const =default
AudioLoopPointKind kind
Definition assets.hpp:90
std::uint64_t frame
Definition assets.hpp:89