Load file data into an existing SignalSourceContainer.
626{
627 if (!container) {
629 return false;
630 }
631
632 auto sc = std::dynamic_pointer_cast<Kakshya::SoundFileContainer>(container);
633 if (!sc) {
634 set_error(
"Container is not a SoundFileContainer");
635 return false;
636 }
637
638 std::shared_ptr<AudioStreamContext> audio;
639 {
643 return false;
644 }
646 }
647
650 sc->set_source_format(
m_demux->format_context->iformat->name);
651
652 sc->setup(audio->total_frames, audio->sample_rate, audio->channels);
653
655 sc->get_structure().organization = planar
658
660 if (data.empty()) {
662 return false;
663 }
664
665 sc->set_raw_data(data);
666
669 for (const auto& [name, group] : region_groups)
671
672 sc->create_default_processor();
673 sc->mark_ready_for_processing(true);
674 return true;
675}
static std::unordered_map< std::string, Kakshya::RegionGroup > regions_to_groups(const std::vector< FileRegion > ®ions)
Convert file regions to region groups.
std::vector< Kakshya::DataVariant > read_all() override
Read the entire audio file into memory.
std::shared_ptr< AudioStreamContext > m_audio
Codec + resampler state.
std::shared_mutex m_context_mutex
Guards both context pointers.
void set_error(const std::string &error) const
Set the last error message.
AudioReadOptions m_audio_options
Audio-specific read options.
std::string m_filepath
Path to the currently open file.
std::shared_ptr< FFmpegDemuxContext > m_demux
Container / format state.
std::vector< FileRegion > get_regions() const override
Get all regions (markers, loops, etc.) from the file.
@ DEINTERLEAVE
Output planar (per-channel) doubles instead of interleaved.
void add_region_group(std::unordered_map< std::string, RegionGroup > &groups, const RegionGroup &group)
Add a RegionGroup to a group map.
@ PLANAR
Separate DataVariant per logical unit (LLL...RRR for stereo)
@ INTERLEAVED
Single DataVariant with interleaved data (LRLRLR for stereo)