Rerun C++ SDK
Loading...
Searching...
No Matches
volume.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/components/volume.def.rs".
3
4#pragma once
5
6#include "../../encodings/float32.hpp"
7#include "../../result.hpp"
8
9#include <cstdint>
10#include <memory>
11
12namespace rerun::blueprint::components {
13 /// **Component**: Playback volume, as a multiplier applied to the audio samples.
14 ///
15 /// 0.0 is silent and 1.0 leaves the samples unchanged.
16 /// The scale is linear in amplitude, not in perceived loudness.
17 ///
18 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
19 ///
20 struct Volume {
22
23 public:
24 Volume() = default;
25
26 Volume(rerun::encodings::Float32 volume_) : volume(volume_) {}
27
28 Volume& operator=(rerun::encodings::Float32 volume_) {
29 volume = volume_;
30 return *this;
31 }
32
33 Volume(float value_) : volume(value_) {}
34
35 Volume& operator=(float value_) {
36 volume = value_;
37 return *this;
38 }
39
40 /// Cast to the underlying Float32 encoding
41 operator rerun::encodings::Float32() const {
42 return volume;
43 }
44 };
45} // namespace rerun::blueprint::components
46
47namespace rerun {
48 static_assert(sizeof(rerun::encodings::Float32) == sizeof(blueprint::components::Volume));
49
50 /// \private
51 template <>
52 struct Loggable<blueprint::components::Volume> {
53 static constexpr std::string_view ComponentType = "rerun.blueprint.components.Volume";
54
55 /// Returns the arrow data type this type corresponds to.
56 static const std::shared_ptr<arrow::DataType>& arrow_data_type() {
58 }
59
60 /// Serializes an array of `rerun::blueprint:: components::Volume` into an arrow array.
61 static Result<std::shared_ptr<arrow::Array>> to_arrow(
62 const blueprint::components::Volume* instances, size_t num_instances
63 ) {
64 if (num_instances == 0) {
65 return Loggable<rerun::encodings::Float32>::to_arrow(nullptr, 0);
66 } else if (instances == nullptr) {
67 return rerun::Error(
68 ErrorCode::UnexpectedNullArgument,
69 "Passed array instances is null when num_elements> 0."
70 );
71 } else {
72 return Loggable<rerun::encodings::Float32>::to_arrow(
73 &instances->volume,
74 num_instances
75 );
76 }
77 }
78 };
79} // namespace rerun
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:104
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:26
A type of component that can be registered.
Definition component_type.hpp:19
The Loggable trait is used by all built-in implementation of rerun::AsComponents to serialize a colle...
Definition loggable.hpp:11
Component: Playback volume, as a multiplier applied to the audio samples.
Definition volume.hpp:20
Encoding: A single-precision 32-bit IEEE 754 floating point number.
Definition float32.hpp:24