change: change code style to Linux style except indent.

This commit is contained in:
Mike Solar
2025-08-03 03:09:40 +08:00
parent 65ab76edc8
commit 74f73ab3be
789 changed files with 77113 additions and 68888 deletions
+61 -51
View File
@@ -22,7 +22,8 @@
#include "widget/slider/floatslider.h"
namespace olive {
namespace olive
{
const QString PanNode::kSamplesInput = QStringLiteral("samples_in");
const QString PanNode::kPanningInput = QStringLiteral("panning_in");
@@ -31,88 +32,97 @@ const QString PanNode::kPanningInput = QStringLiteral("panning_in");
PanNode::PanNode()
{
AddInput(kSamplesInput, NodeValue::kSamples, InputFlags(kInputFlagNotKeyframable));
AddInput(kSamplesInput, NodeValue::kSamples,
InputFlags(kInputFlagNotKeyframable));
AddInput(kPanningInput, NodeValue::kFloat, 0.0);
SetInputProperty(kPanningInput, QStringLiteral("min"), -1.0);
SetInputProperty(kPanningInput, QStringLiteral("max"), 1.0);
SetInputProperty(kPanningInput, QStringLiteral("view"), FloatSlider::kPercentage);
AddInput(kPanningInput, NodeValue::kFloat, 0.0);
SetInputProperty(kPanningInput, QStringLiteral("min"), -1.0);
SetInputProperty(kPanningInput, QStringLiteral("max"), 1.0);
SetInputProperty(kPanningInput, QStringLiteral("view"),
FloatSlider::kPercentage);
SetFlag(kAudioEffect);
SetEffectInput(kSamplesInput);
SetFlag(kAudioEffect);
SetEffectInput(kSamplesInput);
}
QString PanNode::Name() const
{
return tr("Pan");
return tr("Pan");
}
QString PanNode::id() const
{
return QStringLiteral("org.olivevideoeditor.Olive.pan");
return QStringLiteral("org.olivevideoeditor.Olive.pan");
}
QVector<Node::CategoryID> PanNode::Category() const
{
return {kCategoryFilter};
return { kCategoryFilter };
}
QString PanNode::Description() const
{
return tr("Adjust the stereo panning of an audio source.");
return tr("Adjust the stereo panning of an audio source.");
}
void PanNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
void PanNode::Value(const NodeValueRow &value, const NodeGlobals &globals,
NodeValueTable *table) const
{
// Create a sample job
SampleBuffer samples = value[kSamplesInput].toSamples();
if (samples.is_allocated()) {
// This node is only compatible with stereo audio
if (samples.audio_params().channel_count() == 2) {
// If the input is static, we can just do it now which will be faster
if (IsInputStatic(kPanningInput)) {
float pan_volume = value[kPanningInput].toDouble();
if (!qIsNull(pan_volume)) {
if (pan_volume > 0) {
samples.transform_volume_for_channel(0, 1.0f - pan_volume);
} else {
samples.transform_volume_for_channel(1, 1.0f + pan_volume);
}
}
// Create a sample job
SampleBuffer samples = value[kSamplesInput].toSamples();
if (samples.is_allocated()) {
// This node is only compatible with stereo audio
if (samples.audio_params().channel_count() == 2) {
// If the input is static, we can just do it now which will be faster
if (IsInputStatic(kPanningInput)) {
float pan_volume = value[kPanningInput].toDouble();
if (!qIsNull(pan_volume)) {
if (pan_volume > 0) {
samples.transform_volume_for_channel(0,
1.0f - pan_volume);
} else {
samples.transform_volume_for_channel(1,
1.0f + pan_volume);
}
}
table->Push(NodeValue(NodeValue::kSamples, samples, this));
} else {
// Requires job
table->Push(NodeValue::kSamples, SampleJob(globals.time(), kSamplesInput, value), this);
}
} else {
// Pass right through
table->Push(value[kSamplesInput]);
}
}
table->Push(NodeValue(NodeValue::kSamples, samples, this));
} else {
// Requires job
table->Push(NodeValue::kSamples,
SampleJob(globals.time(), kSamplesInput, value),
this);
}
} else {
// Pass right through
table->Push(value[kSamplesInput]);
}
}
}
void PanNode::ProcessSamples(const NodeValueRow &values, const SampleBuffer &input, SampleBuffer &output, int index) const
void PanNode::ProcessSamples(const NodeValueRow &values,
const SampleBuffer &input, SampleBuffer &output,
int index) const
{
float pan_val = values[kPanningInput].toDouble();
float pan_val = values[kPanningInput].toDouble();
for (int i=0;i<input.audio_params().channel_count();i++) {
output.data(i)[index] = input.data(i)[index];
}
for (int i = 0; i < input.audio_params().channel_count(); i++) {
output.data(i)[index] = input.data(i)[index];
}
if (pan_val > 0) {
output.data(0)[index] *= (1.0F - pan_val);
} else if (pan_val < 0) {
output.data(1)[index] *= (1.0F - qAbs(pan_val));
}
if (pan_val > 0) {
output.data(0)[index] *= (1.0F - pan_val);
} else if (pan_val < 0) {
output.data(1)[index] *= (1.0F - qAbs(pan_val));
}
}
void PanNode::Retranslate()
{
super::Retranslate();
super::Retranslate();
SetInputName(kSamplesInput, tr("Samples"));
SetInputName(kPanningInput, tr("Pan"));
SetInputName(kSamplesInput, tr("Samples"));
SetInputName(kPanningInput, tr("Pan"));
}
}