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

◆ set_value_at()

void MayaFlux::Kakshya::SoundStreamContainer::set_value_at ( const std::vector< uint64_t > &  coordinates,
double  value 
)
overridevirtual

Set a single value at the specified coordinates.

Parameters
coordinatesN-dimensional coordinates
valueValue to set

Implements MayaFlux::Kakshya::NDDataContainer.

Definition at line 267 of file SoundStreamContainer.cpp.

268{
269 if (coordinates.size() != 2)
270 return;
271
272 uint64_t frame = coordinates[0];
273 uint64_t channel = coordinates[1];
274
275 if (frame >= m_num_frames || channel >= m_num_channels) {
276 return;
277 }
278
279 const auto& spans = get_span_cache();
280
282 if (spans.empty())
283 return;
284
285 uint64_t linear_index = frame * m_num_channels + channel;
286 if (linear_index < spans[0].size()) {
287 const_cast<std::span<double>&>(spans[0])[linear_index] = value;
288 }
289
290 } else {
291 if (channel >= spans.size())
292 return;
293
294 if (frame < spans[channel].size()) {
295 const_cast<std::span<double>&>(spans[channel])[frame] = value;
296 }
297 }
298
300 m_double_extraction_dirty.store(true, std::memory_order_release);
301}
const std::vector< std::span< double > > & get_span_cache() const
Get the cached spans for each channel, recomputing if dirty.
void invalidate_span_cache()
Invalidate the span cache when data or layout changes.
@ INTERLEAVED
Single DataVariant with interleaved data (LRLRLR for stereo)

References get_span_cache(), MayaFlux::Kakshya::INTERLEAVED, invalidate_span_cache(), m_double_extraction_dirty, m_num_channels, m_num_frames, m_structure, and MayaFlux::Kakshya::ContainerDataStructure::organization.

+ Here is the call graph for this function: