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

◆ process()

void MayaFlux::Kakshya::PlotProcessor::process ( const std::shared_ptr< SignalSourceContainer > &  container)
overridevirtual

Acquire data from all bound sources and write into the container.

For each bound series: acquires from source, writes into container m_data, then copies m_data into processed_data. Unbound series are left unchanged. Called from the graphics thread by Forma before the geometry function runs.

Implements MayaFlux::Kakshya::DataProcessor.

Definition at line 156 of file PlotProcessor.cpp.

157{
158 auto plot = std::dynamic_pointer_cast<PlotContainer>(container);
159 if (!plot) {
160 MF_ERROR(C, X, "PlotProcessor::process: container is not a PlotContainer");
161 return;
162 }
163
164 m_processing.store(true, std::memory_order_release);
165
166 for (auto& [idx, b] : m_bindings) {
167 if (idx >= plot->series_count())
168 continue;
169
170 thread_local std::vector<double> staging;
171 staging.resize(plot->series_size(idx));
172
173 {
174 auto frame = plot->get_frame(idx).as<double>();
175 if (frame.size() == staging.size()) {
176 std::ranges::copy(frame, staging.begin());
177 } else {
178 std::ranges::fill(staging, 0.0);
179 }
180 }
181
182 switch (b.source_type) {
183 case SourceType::NODE:
184 acquire_from_node(b, staging);
185 break;
188 break;
190 acquire_from_network(b, staging);
191 break;
193 acquire_from_callable(b, staging);
194 break;
195 case SourceType::RAW:
196 acquire_from_raw(b, staging);
197 break;
198 }
199
200 plot->write_series(idx, staging);
201 }
202
203 auto& src = plot->get_data();
204 auto& dst = plot->get_processed_data();
205 dst.resize(src.size());
206 for (size_t i = 0; i < src.size(); ++i)
207 dst[i] = src[i];
208
209 m_processing.store(false, std::memory_order_release);
210}
#define MF_ERROR(comp, ctx,...)
uint32_t * dst
const uint32_t * src
size_t b
void acquire_from_raw(SeriesBinding &b, std::vector< double > &series)
std::unordered_map< uint32_t, SeriesBinding > m_bindings
void acquire_from_audio_buffer(SeriesBinding &b, std::vector< double > &series)
void acquire_from_callable(SeriesBinding &b, std::vector< double > &series)
void acquire_from_node(SeriesBinding &b, std::vector< double > &series)
void acquire_from_network(SeriesBinding &b, std::vector< double > &series)
std::pair< Mapped< std::shared_ptr< Kakshya::PlotContainer > >, Surface > plot(std::string title, uint32_t width, uint32_t height, std::shared_ptr< Kakshya::PlotContainer > container, Plot::SeriesSpec spec)
Create a live plot in a new window.
Definition Forma.cpp:113

References acquire_from_audio_buffer(), acquire_from_callable(), acquire_from_network(), acquire_from_node(), acquire_from_raw(), AUDIO_BUFFER, b, CALLABLE, dst, m_bindings, m_processing, MF_ERROR, NETWORK, NODE, RAW, and src.

+ Here is the call graph for this function: