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

◆ get_channel_frames() [2/2]

std::span< const double > MayaFlux::Kakshya::DynamicSoundStream::get_channel_frames ( uint32_t  channel,
uint64_t  start_frame,
uint64_t  num_frames 
) const

Get the fixed capacity of the circular buffer if enabled.

Returns
Capacity in frames if circular mode is active, 0 otherwise

Definition at line 234 of file DynamicSoundStream.cpp.

235{
236 if (channel >= get_num_channels()) {
237 return {};
238 }
239
241 MF_WARN(Journal::Component::Kakshya, Journal::Context::ContainerProcessing, "Direct span access not supported for interleaved data. Use get_frames() or Kakshya::extract_channel_data() instead.");
242 return {};
243 }
244
245 std::shared_lock lock(m_data_mutex);
246
247 if (channel >= m_data.size()) {
248 return {};
249 }
250
251 const auto& channel_data = std::get<std::vector<double>>(m_data[channel]);
252
253 if (start_frame >= channel_data.size()) {
254 return {};
255 }
256
257 uint64_t available_frames = channel_data.size() - start_frame;
258 uint64_t actual_frames = std::min(num_frames, available_frames);
259
260 return { channel_data.data() + start_frame, actual_frames };
261}
#define MF_WARN(comp, ctx,...)
DataAccess channel_data(size_t channel) override
Get channel data with semantic interpretation.
void lock() override
Acquire a lock for thread-safe access.
@ ContainerProcessing
Container operations (Kakshya - file/stream/region processing)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.
@ INTERLEAVED
Single DataVariant with interleaved data (LRLRLR for stereo)

References MayaFlux::Kakshya::SoundStreamContainer::channel_data(), MayaFlux::Journal::ContainerProcessing, MayaFlux::Kakshya::SoundStreamContainer::get_num_channels(), MayaFlux::Kakshya::INTERLEAVED, MayaFlux::Journal::Kakshya, MayaFlux::Kakshya::SoundStreamContainer::lock(), MayaFlux::Kakshya::SoundStreamContainer::m_data, MayaFlux::Kakshya::SoundStreamContainer::m_data_mutex, MayaFlux::Kakshya::SoundStreamContainer::m_structure, MF_WARN, and MayaFlux::Kakshya::ContainerDataStructure::organization.

+ Here is the call graph for this function: