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
+12 -13
View File
@@ -58,17 +58,21 @@ QString VolumeNode::Description() const
return tr("Adjusts the volume of an audio source.");
}
Node::Capabilities VolumeNode::GetCapabilities(const NodeValueDatabase &) const
NodeValueTable VolumeNode::Value(NodeValueDatabase &value) const
{
return kSampleProcessor;
SampleJob job(samples_input_);
job.InsertValue(volume_input_, value);
NodeValueTable table = value.Merge();
if (qFuzzyCompare(job.GetValue(volume_input_).data().toDouble(), 1.0)) {
table.Push(NodeParam::kSampleJob, QVariant::fromValue(job), this);
}
return table;
}
NodeInput *VolumeNode::ProcessesSamplesFrom(const NodeValueDatabase &) const
{
return samples_input_;
}
void VolumeNode::ProcessSamples(const NodeValueDatabase &values, const AudioParams& params, const SampleBufferPtr input, SampleBufferPtr output, int index) const
void VolumeNode::ProcessSamples(NodeValueDatabase &values, const AudioParams& params, const SampleBufferPtr input, SampleBufferPtr output, int index) const
{
float volume_val = values[volume_input_].Get(NodeParam::kFloat).toFloat();
@@ -83,9 +87,4 @@ void VolumeNode::Retranslate()
volume_input_->set_name(tr("Volume"));
}
NodeInput *VolumeNode::samples_input() const
{
return samples_input_;
}
OLIVE_NAMESPACE_EXIT