implemented audio keyframing

This mostly builds on the keyframing we already set up for video, but the
audio renderer will now appropriately updated keyframe inputs per sample in
accordance with keyframe values.
This commit is contained in:
itsmattkc
2019-12-30 20:14:45 +11:00
parent 7cc31e01e4
commit e6c47b14f4
6 changed files with 66 additions and 28 deletions
+34 -20
View File
@@ -42,7 +42,7 @@ NodeValueTable RenderWorker::RenderInternal(const NodeDependency &path)
return ProcessNode(path);
}
void RenderWorker::RunNodeAccelerated(const Node *node, const TimeRange &range, const NodeValueDatabase *input_params, NodeValueTable* output_params)
void RenderWorker::RunNodeAccelerated(const Node *node, const TimeRange &range, const NodeValueDatabase &input_params, NodeValueTable* output_params)
{
Q_UNUSED(node)
Q_UNUSED(range)
@@ -86,24 +86,45 @@ NodeValueTable RenderWorker::ProcessNode(const NodeDependency& dep)
// FIXME: Cache certain values here if we've already processed them before
// Generate database of input values of node
NodeValueDatabase database = GenerateDatabase(node, dep.range());
// By this point, the node should have all the inputs it needs to render correctly
NodeValueTable table = node->Value(database);
// Check if we have a shader for this output
RunNodeAccelerated(node, dep.range(), database, &table);
return table;
}
NodeValueTable RenderWorker::ProcessInput(const NodeInput *input, const TimeRange& range)
{
if (input->IsConnected()) {
// Value will equal something from the connected node, follow it
return ProcessNode(NodeDependency(input->get_connected_node(),
range));
} else {
// Push onto the table the value at this time from the input
QVariant input_value = input->get_value_at_time(range.in());
NodeValueTable table;
table.Push(input->data_type(), input_value);
return table;
}
}
NodeValueDatabase RenderWorker::GenerateDatabase(const Node* node, const TimeRange& range)
{
NodeValueDatabase database;
// We need to insert tables into the database for each input
foreach (NodeParam* param, node->parameters()) {
if (param->type() == NodeParam::kInput) {
NodeValueTable table;
NodeInput* input = static_cast<NodeInput*>(param);
TimeRange input_time = node->InputTimeAdjustment(input, dep.range());
TimeRange input_time = node->InputTimeAdjustment(input, range);
if (input->IsConnected()) {
// Value will equal something from the connected node, follow it
table = ProcessNode(NodeDependency(input->get_connected_node(),
input_time));
} else {
// Push onto the table the value at this time from the input
QVariant input_value = input->get_value_at_time(input_time.in());
table.Push(input->data_type(), input_value);
}
NodeValueTable table = ProcessInput(input, input_time);
// Exception for Footage types where we actually retrieve some Footage data from a decoder
if (input->data_type() == NodeParam::kFootage) {
@@ -126,12 +147,5 @@ NodeValueTable RenderWorker::ProcessNode(const NodeDependency& dep)
}
}
// By this point, the node should have all the inputs it needs to render correctly
NodeValueTable table = node->Value(database);
// Check if we have a shader for this output
RunNodeAccelerated(node, dep.range(), &database, &table);
return table;
return database;
}