nodes: minor overhaul to functionality

The nodes now have more control over how their accelerated shaders/sample
functions are run, as well as how items are popped off the value tables.
This allows for various optimizations that we didn't have access to before.
This commit is contained in:
itsmattkc
2020-06-12 00:54:15 +10:00
parent 663cf4a020
commit dd7af0e6bd
44 changed files with 1051 additions and 697 deletions
+14 -8
View File
@@ -59,17 +59,23 @@ QString PanNode::Description() const
return tr("Adjust the stereo panning of an audio source.");
}
Node::Capabilities PanNode::GetCapabilities(const NodeValueDatabase &) const
NodeValueTable PanNode::Value(NodeValueDatabase &value) const
{
return kSampleProcessor;
// Create a sample job
SampleJob job(samples_input_);
job.InsertValue(panning_input_, value);
// Push it to our table
NodeValueTable table = value.Merge();
if (!qIsNull(job.GetValue(samples_input_).data().toDouble())) {
table.Push(NodeParam::kSampleJob, QVariant::fromValue(job), this);
}
return table;
}
NodeInput *PanNode::ProcessesSamplesFrom(const NodeValueDatabase &) const
{
return samples_input_;
}
void PanNode::ProcessSamples(const NodeValueDatabase &values, const AudioParams &params, const SampleBufferPtr input, SampleBufferPtr output, int index) const
void PanNode::ProcessSamples(NodeValueDatabase &values, const AudioParams &params, const SampleBufferPtr input, SampleBufferPtr output, int index) const
{
if (params.channel_count() != 2) {
// This node currently only works for stereo audio