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

◆ get_channel_frames() [1/2]

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

Definition at line 247 of file DynamicSoundStream.cpp.

248{
249 if (channel >= get_num_channels() || output.empty())
250 return;
251
252 const uint64_t num_frames = output.size();
253
256 if (m_data.empty()) {
257 std::ranges::fill(output, 0.0);
258 return;
259 }
260 const auto& interleaved_data = std::get<std::vector<double>>(m_data[0]);
261 const uint32_t num_channels = get_num_channels();
262 for (uint64_t frame = 0; frame < num_frames; ++frame) {
263 uint64_t idx = (start_frame + frame) * num_channels + channel;
264 output[frame] = (idx < interleaved_data.size()) ? interleaved_data[idx] : 0.0;
265 }
266 });
267 } else {
269 if (channel >= m_data.size()) {
270 std::ranges::fill(output, 0.0);
271 return;
272 }
273 const auto& channel_data = std::get<std::vector<double>>(m_data[channel]);
274 for (uint64_t frame = 0; frame < num_frames; ++frame) {
275 uint64_t idx = start_frame + frame;
276 output[frame] = (idx < channel_data.size()) ? channel_data[idx] : 0.0;
277 }
278 });
279 }
280}
std::shared_ptr< Core::VKImage > output
DataAccess channel_data(size_t channel) override
Get channel data with semantic interpretation.
@ INTERLEAVED
Single DataVariant with interleaved data (LRLRLR for stereo)
bool seqlock_read_void(const Seqlock &lock, uint32_t max_attempts, Fn &&fn)
Invoke a void read functor under a Seqlock with a bounded retry count.
Definition SeqLock.hpp:222

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

+ Here is the call graph for this function: