MayaFlux 0.1.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 265 of file SoundStreamContainer.cpp.

266{
267 if (coordinates.size() != 2)
268 return;
269
270 uint64_t frame = coordinates[0];
271 uint64_t channel = coordinates[1];
272
273 if (frame >= m_num_frames || channel >= m_num_channels) {
274 return;
275 }
276
277 const auto& spans = get_span_cache();
278
280 if (spans.empty())
281 return;
282
283 uint64_t linear_index = frame * m_num_channels + channel;
284 if (linear_index < spans[0].size()) {
285 const_cast<std::span<double>&>(spans[0])[linear_index] = value;
286 }
287
288 } else {
289 if (channel >= spans.size())
290 return;
291
292 if (frame < spans[channel].size()) {
293 const_cast<std::span<double>&>(spans[channel])[frame] = value;
294 }
295 }
296
298 m_double_extraction_dirty.store(true, std::memory_order_release);
299}
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: