30 m_data.resize(data.size());
32 std::ranges::copy(data,
m_data.begin());
34 auto elements = std::visit([](
const auto& vec) {
return vec.size(); },
m_data[0]);
50 std::vector<std::vector<double>> channel_data,
51 uint32_t num_channels,
55 if (channel_data.empty() || channel_data[0].size() == 0 || num_channels != channel_data.size()) {
56 error<std::invalid_argument>(
58 std::source_location::current(),
59 "build_sound_file_container: channel_data must be non-empty and match num_channels");
62 auto sc = std::make_shared<SoundFileContainer>();
63 sc->setup(channel_data[0].size(), sample_rate, num_channels);
64 sc->get_structure().organization = org;
66 std::vector<DataVariant> variants;
67 variants.reserve(num_channels);
68 for (
auto& ch : channel_data)
69 variants.emplace_back(std::move(ch));
71 sc->set_raw_data(variants);
72 sc->create_default_processor();
73 sc->mark_ready_for_processing(
true);
void setup(uint64_t num_frames, uint32_t sample_rate, uint32_t num_channels)
Setup the container with file parameters.
SoundFileContainer()
Construct a SoundFileContainer with default parameters Uses reasonable defaults suitable for file con...
void set_raw_data(const std::vector< DataVariant > &data)
Set raw data from external source (e.g., file loading)
double get_duration_seconds() const
Enable debug output for this container.
double position_to_time(uint64_t position) const override
Convert from position units (e.g., frame/sample index) to time (seconds).
std::atomic< bool > m_double_extraction_dirty
void update_processing_state(ProcessingState new_state) override
Update the processing state of the container.
std::vector< DataVariant > m_data
Memory::Seqlock m_data_lock
ContainerDataStructure m_structure
Concrete base implementation for streaming audio containers.
RAII guard that brackets a Seqlock write region.
@ Configuration
Configuration and parameter updates.
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.
@ IDLE
Container is inactive with no data or not ready for processing.
std::shared_ptr< SoundFileContainer > make_sound_file_container(std::vector< std::vector< double > > channel_data, uint32_t num_channels, uint32_t sample_rate, OrganizationStrategy org)
Construct a fully populated SoundFileContainer from computed channel data.
OrganizationStrategy
Data organization strategy for multi-channel/multi-frame data.
@ INTERLEAVED
Single DataVariant with interleaved data (LRLRLR for stereo)
OrganizationStrategy organization