MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ root_audio_buffer() [2/2]

InspectResult MayaFlux::Portal::Forma::Inspector::root_audio_buffer ( Buffers::ProcessingToken  token,
uint32_t  channel,
Surface surface,
LayoutCursor cursor,
float  x_min = -0.95F,
float  x_max = 0.95F,
float  row_h = 0.05F,
int  depth = 0 
)

Inspect the root audio buffer for a specific token and channel.

Header shows channel index and token. Rows show sample count and child count. The root buffer itself is expanded via buffer(), then each child buffer is expanded via buffer() in order.

Definition at line 96 of file BufferQuery.cpp.

101{
102 auto root = m_bm.get_root_audio_buffer(token, channel);
103 const auto children = root->get_child_buffers();
104
105 const float ind = x_min + static_cast<float>(depth) * k_inspect_indent;
106 const std::string header_label = "ch " + std::to_string(channel);
107
108 std::vector<ValueSpec> values {
109 ValueSpec {
110 .label = "samples",
111 .reader = [root] { return std::to_string(root->get_num_samples()); },
112 },
113 ValueSpec {
114 .label = "children",
115 .reader = [root] { return std::to_string(root->get_num_children()); },
116 },
117 };
118
119 const auto dims = row_pixel_dims(surface.window(), ind, x_max, row_h);
120 auto hbuf = make_row_buffer(surface.window(), header_label, dims);
121 std::vector<RowBuffer> rbufs;
122 rbufs.reserve(values.size());
123 for (const auto& spec : values)
124 rbufs.push_back(make_row_buffer(surface.window(), spec.label, dims));
125 auto group = make_value_group(values, std::move(hbuf), rbufs,
126 surface, cursor, ind, x_max, row_h, false);
127
128 InspectResult result;
129 result.group = std::move(group);
130
131 auto root_result = buffer(
132 root, surface, cursor,
133 x_min, x_max, row_h, depth + 1);
134 surface.layer().relate(result.group.header.header_id, root_result.group.header.header_id);
135 result.children.push_back(std::move(root_result));
136
137 for (const auto& child : children) {
138 auto child_result = buffer(
139 child, surface, cursor,
140 x_min, x_max, row_h, depth + 2);
141 surface.layer().relate(result.group.header.header_id, child_result.group.header.header_id);
142 result.children.push_back(std::move(child_result));
143 }
144
145 return result;
146}
std::shared_ptr< RootAudioBuffer > get_root_audio_buffer(ProcessingToken token, uint32_t channel=0)
Gets a root buffer for a specific token and channel (audio-specific due to channels)
RowBuffer make_row_buffer(const std::shared_ptr< Core::Window > &window, std::string_view text, glm::uvec2 pixel_dims) const
Definition Inspector.cpp:13
InspectResult buffer(const std::shared_ptr< Buffers::Buffer > &buf, Surface &surface, LayoutCursor &cursor, float x_min=-0.95F, float x_max=0.95F, float row_h=0.05F, int depth=0)
Inspect a single Buffer: default processor and full processing chain.
Buffers::BufferManager & m_bm
ValueGroup make_value_group(std::span< const ValueSpec > values, RowBuffer header_buf, std::span< const RowBuffer > row_bufs, Surface &surface, LayoutCursor &cursor, float x_min, float x_max, float row_h, bool initially_open)
Construct a collapsible header followed by N value rows under it.
constexpr float k_inspect_indent
glm::uvec2 row_pixel_dims(const std::shared_ptr< Core::Window > &window, float x_min, float x_max, float row_h)
Convert an NDC row rect into integer pixel dimensions.

References buffer(), MayaFlux::Portal::Forma::InspectResult::children, MayaFlux::Buffers::BufferManager::get_root_audio_buffer(), MayaFlux::Portal::Forma::InspectResult::group, MayaFlux::Portal::Forma::ValueGroup::header, MayaFlux::Portal::Forma::Collapsible::header_id, MayaFlux::Portal::Forma::k_inspect_indent, MayaFlux::Portal::Forma::ValueSpec::label, MayaFlux::Portal::Forma::Surface::layer(), m_bm, make_row_buffer(), MayaFlux::Portal::Forma::make_value_group(), MayaFlux::Portal::Forma::Layer::relate(), MayaFlux::Portal::Forma::row_pixel_dims(), and MayaFlux::Portal::Forma::Surface::window().

Referenced by buffer_manager(), and root_audio_buffer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: