Rerun C++ SDK
Loading...
Searching...
No Matches
audio_playback.hpp
1// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs
2// Based on "crates/build/re_type_definitions/rerun/blueprint/archetypes/audio_playback.def.rs".
3
4#pragma once
5
6#include "../../archetype_utils.hpp"
7#include "../../blueprint/components/volume.hpp"
8#include "../../collection.hpp"
9#include "../../component_batch.hpp"
10#include "../../component_column.hpp"
11#include "../../result.hpp"
12
13#include <cstdint>
14#include <optional>
15#include <utility>
16#include <vector>
17
18namespace rerun::blueprint::archetypes {
19 /// **Archetype**: Playback settings for an audio view.
20 ///
21 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
22 ///
24 /// Playback volume, from 0.0 (silent) to 1.0 (full).
25 ///
26 /// Defaults to 1.0.
27 std::optional<ComponentBatch> volume;
28
29 public:
30 /// The name of the archetype as used in `ComponentDescriptor`s.
31 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.AudioPlayback";
32
33 /// `ComponentDescriptor` for the `volume` field.
34 static constexpr auto Descriptor_volume = ComponentDescriptor(
35 ArchetypeName, "AudioPlayback:volume",
37 );
38
39 public:
40 AudioPlayback() = default;
41 AudioPlayback(AudioPlayback&& other) = default;
42 AudioPlayback(const AudioPlayback& other) = default;
43 AudioPlayback& operator=(const AudioPlayback& other) = default;
44 AudioPlayback& operator=(AudioPlayback&& other) = default;
45
46 /// Update only some specific fields of a `AudioPlayback`.
48 return AudioPlayback();
49 }
50
51 /// Clear all the fields of a `AudioPlayback`.
53
54 /// Playback volume, from 0.0 (silent) to 1.0 (full).
55 ///
56 /// Defaults to 1.0.
58 volume = ComponentBatch::from_loggable(_volume, Descriptor_volume).value_or_throw();
59 return std::move(*this);
60 }
61
62 /// Partitions the component data into multiple sub-batches.
63 ///
64 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
65 /// instead, via `ComponentBatch::partitioned`.
66 ///
67 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
68 ///
69 /// The specified `lengths` must sum to the total length of the component batch.
71 return detail::partition_batches({&volume}, lengths_).value_or_throw();
72 }
73
74 /// Partitions the component data into unit-length sub-batches.
75 ///
76 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
77 /// where `n` is automatically guessed.
79 return detail::partition_batches_of_unit_length({&volume}).value_or_throw();
80 }
81 };
82
83} // namespace rerun::blueprint::archetypes
84
85namespace rerun {
86 /// \private
87 template <typename T>
88 struct AsComponents;
89
90 /// \private
91 template <>
92 struct AsComponents<blueprint::archetypes::AudioPlayback> {
93 /// Serialize all set component batches.
94 static Result<Collection<ComponentBatch>> as_batches(
96 ) {
97 return detail::collect_batches({&archetype.volume});
98 }
99 };
100} // namespace rerun
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
A class for representing either a usable value, or an error.
Definition result.hpp:14
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:26
static Result< ComponentBatch > from_loggable(const rerun::Collection< T > &components, const ComponentDescriptor &descriptor)
Creates a new component batch from a collection of component instances.
Definition component_batch.hpp:46
A ComponentDescriptor fully describes the semantics of a column of data.
Definition component_descriptor.hpp:16
The Loggable trait is used by all built-in implementation of rerun::AsComponents to serialize a colle...
Definition loggable.hpp:11
Archetype: Playback settings for an audio view.
Definition audio_playback.hpp:23
static AudioPlayback clear_fields()
Clear all the fields of a AudioPlayback.
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition audio_playback.hpp:70
static AudioPlayback update_fields()
Update only some specific fields of a AudioPlayback.
Definition audio_playback.hpp:47
static constexpr auto Descriptor_volume
ComponentDescriptor for the volume field.
Definition audio_playback.hpp:34
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition audio_playback.hpp:31
AudioPlayback with_volume(const rerun::blueprint::components::Volume &_volume) &&
Playback volume, from 0.0 (silent) to 1.0 (full).
Definition audio_playback.hpp:57
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition audio_playback.hpp:78
std::optional< ComponentBatch > volume
Playback volume, from 0.0 (silent) to 1.0 (full).
Definition audio_playback.hpp:27
Component: Playback volume, as a multiplier applied to the audio samples.
Definition volume.hpp:20