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
+41 -34
View File
@@ -22,7 +22,8 @@
#include "widget/slider/floatslider.h"
namespace olive {
namespace olive
{
const QString VolumeNode::kSamplesInput = QStringLiteral("samples_in");
const QString VolumeNode::kVolumeInput = QStringLiteral("volume_in");
@@ -31,71 +32,77 @@ const QString VolumeNode::kVolumeInput = QStringLiteral("volume_in");
VolumeNode::VolumeNode()
{
AddInput(kSamplesInput, NodeValue::kSamples, InputFlags(kInputFlagNotKeyframable));
AddInput(kSamplesInput, NodeValue::kSamples,
InputFlags(kInputFlagNotKeyframable));
AddInput(kVolumeInput, NodeValue::kFloat, 1.0);
SetInputProperty(kVolumeInput, QStringLiteral("min"), 0.0);
SetInputProperty(kVolumeInput, QStringLiteral("view"), FloatSlider::kDecibel);
AddInput(kVolumeInput, NodeValue::kFloat, 1.0);
SetInputProperty(kVolumeInput, QStringLiteral("min"), 0.0);
SetInputProperty(kVolumeInput, QStringLiteral("view"),
FloatSlider::kDecibel);
SetFlag(kAudioEffect);
SetEffectInput(kSamplesInput);
SetFlag(kAudioEffect);
SetEffectInput(kSamplesInput);
}
QString VolumeNode::Name() const
{
return tr("Volume");
return tr("Volume");
}
QString VolumeNode::id() const
{
return QStringLiteral("org.olivevideoeditor.Olive.volume");
return QStringLiteral("org.olivevideoeditor.Olive.volume");
}
QVector<Node::CategoryID> VolumeNode::Category() const
{
return {kCategoryFilter};
return { kCategoryFilter };
}
QString VolumeNode::Description() const
{
return tr("Adjusts the volume of an audio source.");
return tr("Adjusts the volume of an audio source.");
}
void VolumeNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
void VolumeNode::Value(const NodeValueRow &value, const NodeGlobals &globals,
NodeValueTable *table) const
{
// Create a sample job
SampleBuffer buffer = value[kSamplesInput].toSamples();
// Create a sample job
SampleBuffer buffer = value[kSamplesInput].toSamples();
if (buffer.is_allocated()) {
// If the input is static, we can just do it now which will be faster
if (IsInputStatic(kVolumeInput)) {
auto volume = value[kVolumeInput].toDouble();
if (buffer.is_allocated()) {
// If the input is static, we can just do it now which will be faster
if (IsInputStatic(kVolumeInput)) {
auto volume = value[kVolumeInput].toDouble();
if (!qFuzzyCompare(volume, 1.0)) {
buffer.transform_volume(volume);
}
if (!qFuzzyCompare(volume, 1.0)) {
buffer.transform_volume(volume);
}
table->Push(NodeValue::kSamples, QVariant::fromValue(buffer), this);
} else {
// Requires job
SampleJob job(globals.time(), kSamplesInput, value);
job.Insert(kVolumeInput, value);
table->Push(NodeValue::kSamples, QVariant::fromValue(job), this);
}
}
table->Push(NodeValue::kSamples, QVariant::fromValue(buffer), this);
} else {
// Requires job
SampleJob job(globals.time(), kSamplesInput, value);
job.Insert(kVolumeInput, value);
table->Push(NodeValue::kSamples, QVariant::fromValue(job), this);
}
}
}
void VolumeNode::ProcessSamples(const NodeValueRow &values, const SampleBuffer &input, SampleBuffer &output, int index) const
void VolumeNode::ProcessSamples(const NodeValueRow &values,
const SampleBuffer &input, SampleBuffer &output,
int index) const
{
return ProcessSamplesInternal(values, kOpMultiply, kSamplesInput, kVolumeInput, input, output, index);
return ProcessSamplesInternal(values, kOpMultiply, kSamplesInput,
kVolumeInput, input, output, index);
}
void VolumeNode::Retranslate()
{
super::Retranslate();
super::Retranslate();
SetInputName(kSamplesInput, tr("Samples"));
SetInputName(kVolumeInput, tr("Volume"));
SetInputName(kSamplesInput, tr("Samples"));
SetInputName(kVolumeInput, tr("Volume"));
}
}