13 constexpr uint32_t k_default_block_frames = 512;
17 slot.
node->m_fire_events_during_snapshot =
true;
22 m_slots.push_back(std::move(slot));
31 for (
const auto& slot :
slots) {
62 return std::cref(*it);
67 for (uint32_t i = 0; i < static_cast<uint32_t>(
m_slots.size()); ++i) {
79 for (
const auto& op :
chain->operators()) {
81 relation_op->set_slots(
m_slots);
82 relation_op->begin_block();
86 chain->process(
static_cast<float>(num_samples));
89 std::this_thread::yield();
127 total += publisher->get_output_count();
135 const size_t count = publisher->get_output_count();
137 return publisher->get_output_block(
index);
147 meta[
"slot_count"] = std::to_string(
m_slots.size());
std::vector< uint32_t > indices
BufferProcessingChain * chain
void apply_output_scale()
Apply m_output_scale to m_last_audio_buffer.
virtual std::optional< std::vector< double > > get_audio_buffer() const
Get cached audio buffer from last process_batch()
std::shared_ptr< OperatorChain > m_operator_chain
std::shared_ptr< OperatorChain > get_operator_chain() const
Access the secondary operator chain.
std::atomic_flag m_audio_buffer_lock
Spinlock guarding m_last_audio_buffer.
virtual std::unordered_map< std::string, std::string > get_metadata() const
Get network metadata for debugging/visualization.
std::vector< double > m_last_audio_buffer
void set_output_mode(OutputMode mode)
Set the network's output routing mode.
std::optional< std::span< const double > > get_node_audio_buffer(size_t index) const override
Block of one slot from the last process_batch()
void process_batch(unsigned int num_samples) override
Process the network for the given number of samples.
std::optional< std::span< const double > > get_output_block(size_t index) const
Block of one published output from the last process_batch()
std::unordered_map< std::string, std::string > get_metadata() const override
Get network metadata for debugging/visualization.
std::vector< RelationSlot > & slots() noexcept
std::optional< std::reference_wrapper< RelationSlot > > find_slot(std::string_view name)
Find a slot by name.
std::vector< std::shared_ptr< RelationOperator > > m_publishers
std::vector< uint32_t > add_slots(std::initializer_list< RelationSlot > slots)
Add several slots at once.
std::optional< std::vector< double > > get_audio_buffer() const override
Block of the first published output, or nullopt when none is published.
RelationSlot & get_slot(uint32_t index)
std::optional< uint32_t > find_slot_index(std::string_view name) const
Find the index of a slot by name.
uint32_t add_slot(RelationSlot slot={})
Add a slot to the network.
size_t get_output_count() const
Total published outputs across all publishing operators, in chain order.
std::vector< RelationSlot > m_slots
std::optional< double > get_node_output(size_t index) const override
Level of one slot after the last processed block.
Operator that acts on a network's slots over one block at a time.
@ AUDIO_SINK
Aggregated audio samples sent to output.
std::shared_ptr< Node > node
void reserve_block(uint32_t block_frames)
Preallocate this slot's block storage without changing its size.
One addressable participant of a RelationNetwork.