finished audio effects support in audio renderer
Working structure implemented in previous commit into the audio renderer is complete in this commit.
This commit is contained in:
@@ -11,3 +11,35 @@ void AudioWorker::FrameToValue(StreamPtr stream, FramePtr frame, NodeValueTable
|
||||
|
||||
table->Push(NodeParam::kSamples, frame->ToByteArray());
|
||||
}
|
||||
|
||||
void AudioWorker::RunNodeAccelerated(const Node *node, const TimeRange &range, const NodeValueDatabase *input_params, NodeValueTable *output_params)
|
||||
{
|
||||
// Check if node processes samples
|
||||
if (!node->ProcessesSamplesFrom()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to find the sample buffer in the table
|
||||
QVariant samples_var = (*input_params)[node->ProcessesSamplesFrom()].Get(NodeParam::kSamples);
|
||||
|
||||
// If there isn't one, there's nothing to do
|
||||
if (samples_var.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray input_buffer = samples_var.toByteArray();
|
||||
QByteArray output_buffer(input_buffer.size(), 0);
|
||||
|
||||
int sample_count = input_buffer.size() / audio_params().bytes_per_sample_per_channel();
|
||||
|
||||
// FIXME: Hardcoded float sample format
|
||||
for (int i=0;i<sample_count;i++) {
|
||||
node->ProcessSamples(input_params,
|
||||
audio_params(),
|
||||
reinterpret_cast<const float*>(input_buffer.constData()),
|
||||
reinterpret_cast<float*>(output_buffer.data()),
|
||||
i);
|
||||
}
|
||||
|
||||
output_params->Push(NodeParam::kSamples, output_buffer);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ public:
|
||||
protected:
|
||||
virtual void FrameToValue(StreamPtr stream, FramePtr frame, NodeValueTable* table) override;
|
||||
|
||||
virtual void RunNodeAccelerated(const Node *node, const TimeRange& range, const NodeValueDatabase *input_params, NodeValueTable* output_params) override;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
@@ -90,3 +90,8 @@ NodeValueTable AudioRenderWorker::RenderBlock(const TrackOutput *track, const Ti
|
||||
|
||||
return merged_table;
|
||||
}
|
||||
|
||||
const AudioRenderingParams &AudioRenderWorker::audio_params() const
|
||||
{
|
||||
return audio_params_;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ protected:
|
||||
|
||||
virtual NodeValueTable RenderBlock(const TrackOutput *track, const TimeRange& range) override;
|
||||
|
||||
const AudioRenderingParams& audio_params() const;
|
||||
|
||||
private:
|
||||
AudioRenderingParams audio_params_;
|
||||
|
||||
|
||||
@@ -42,12 +42,6 @@ NodeValueTable RenderWorker::RenderInternal(const NodeDependency &path)
|
||||
return ProcessNode(path);
|
||||
}
|
||||
|
||||
bool RenderWorker::OutputIsAccelerated(Node *output)
|
||||
{
|
||||
Q_UNUSED(output)
|
||||
return false;
|
||||
}
|
||||
|
||||
void RenderWorker::RunNodeAccelerated(const Node *node, const TimeRange &range, const NodeValueDatabase *input_params, NodeValueTable* output_params)
|
||||
{
|
||||
Q_UNUSED(node)
|
||||
|
||||
@@ -35,8 +35,6 @@ protected:
|
||||
|
||||
virtual NodeValueTable RenderInternal(const NodeDependency& path);
|
||||
|
||||
virtual bool OutputIsAccelerated(Node *output);
|
||||
|
||||
virtual void RunNodeAccelerated(const Node *node, const TimeRange& range, const NodeValueDatabase *input_params, NodeValueTable* output_params);
|
||||
|
||||
StreamPtr ResolveStreamFromInput(NodeInput* input);
|
||||
|
||||
Reference in New Issue
Block a user