MayaFlux 0.1.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 231 of file DynamicSoundStream.cpp.

232{
233 if (channel >= get_num_channels()) {
234 return {};
235 }
236
238 std::cerr << "Direct span access not supported for interleaved data. Use get_frames() or Kakshya::extract_channel_data() instead." << '\n';
239 return {};
240 }
241
242 std::shared_lock lock(m_data_mutex);
243
244 if (channel >= m_data.size()) {
245 return {};
246 }
247
248 const auto& channel_data = std::get<std::vector<double>>(m_data[channel]);
249
250 if (start_frame >= channel_data.size()) {
251 return {};
252 }
253
254 uint64_t available_frames = channel_data.size() - start_frame;
255 uint64_t actual_frames = std::min(num_frames, available_frames);
256
257 return { channel_data.data() + start_frame, actual_frames };
258}
DataAccess channel_data(size_t channel) override
Get channel data with semantic interpretation.
void lock() override
Acquire a lock for thread-safe access.
@ INTERLEAVED
Single DataVariant with interleaved data (LRLRLR for stereo)

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

+ Here is the call graph for this function: