31 m_data.resize(data.size());
32 std::ranges::copy(data,
m_data.begin());
35 auto elements = std::visit([](
const auto& vec) {
return vec.size(); },
m_data[0]);
51 std::vector<std::vector<double>> channel_data,
52 uint32_t num_channels,
56 if (channel_data.empty() || channel_data[0].size() == 0 || num_channels != channel_data.size()) {
57 error<std::invalid_argument>(
59 std::source_location::current(),
60 "build_sound_file_container: channel_data must be non-empty and match num_channels");
63 auto sc = std::make_shared<SoundFileContainer>();
64 sc->setup(channel_data[0].
size(), sample_rate, num_channels);
65 sc->get_structure().organization = org;
67 std::vector<DataVariant> variants;
68 variants.reserve(num_channels);
69 for (
auto& ch : channel_data)
70 variants.emplace_back(std::move(ch));
72 sc->set_raw_data(variants);
73 sc->create_default_processor();
74 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
std::shared_mutex m_data_mutex
void update_processing_state(ProcessingState new_state) override
Update the processing state of the container.
std::vector< DataVariant > m_data
void lock() override
Acquire a lock for thread-safe access.
ContainerDataStructure m_structure
Concrete base implementation for streaming audio containers.
@ 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