The core processing function that must be implemented by derived classes.
This method is where the actual transformation logic is implemented. It should contain the algorithmic details of how the buffer's data is transformed, analyzed, or processed. The implementation can utilize any backend capabilities available to the processor, including:
Derived classes must override this method to provide specific processing behavior.
88{
89 auto audio = std::dynamic_pointer_cast<AudioBuffer>(buffer);
90 if (!audio) {
92 "AudioContextProcessor received a non-audio buffer");
93 return;
94 }
95
96 auto& samples = audio->get_data();
97 if (samples.empty()) {
98 return;
99 }
100
106
107 std::vector<double> delivered;
108 bool busy = false;
109
112 const auto result = slot.context->collect_result();
114 if (due && slot.sequence == expected) {
115 delivered = slot.context->decode_primary(result);
116 }
117 } else {
118 busy = true;
119 }
120 }
121
122 if (!busy) {
123 submit(slot, sequence, samples);
124 }
125
126 if (delivered.empty()) {
127 if (due) {
132 "AudioContextProcessor block {} was not complete, output is silent until results arrive in time", expected);
133 }
134 }
135 audio->clear();
136 return;
137 }
138
140
141 const size_t copied = std::min(samples.size(), delivered.size());
142 std::copy_n(delivered.begin(), copied, samples.begin());
143 std::fill(samples.begin() + static_cast<std::ptrdiff_t>(copied), samples.end(), 0.0);
144}
#define MF_RT_WARN(comp, ctx,...)
#define MF_RT_ERROR(comp, ctx,...)
void submit(Slot &slot, uint64_t sequence, std::span< const double > samples)
std::vector< Slot > m_slots
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains).
@ Buffers
Buffers, Managers, processors and processing chains.
std::shared_ptr< Vruta::Routine > sequence(std::vector< std::pair< double, std::function< void()> > > sequence, Vruta::ProcessingToken token)
Creates a temporal sequence that executes callbacks at specified time offsets.
constexpr FenceID INVALID_FENCE
MAYAFLUX_API ShaderFoundry & get_shader_foundry()
Get the global shader compiler instance.