Restore increased range for volume effect, only limit the visible range in timeline

Related to #770
parent 186c2793
......@@ -50,6 +50,11 @@ The rest:
- tag "comment": (optional) description of the parameter (support HTML formatting) (not yet supported by all widgets)
- attribute "name": MLT filter parameter name
- attribute "paramprefix": a string to be prepended to the parameter value before passing it to MLT
- attribute "suffix": a string to be appended to the parameter (for UI display only)
- attribute "min": the minimal accepted value
- attribute "max": the maximal accepted value
- attribute "visualmin": the minimal value displayed in timeline keyframes (can be > than min)
- attribute "visualmax": the maximal value displayed in timeline keyframes (can be < than max)
- attribute "default": initial value, format depends on parameter type
- attribute "optional": if it is set, it means that this parameter can have an empty value. So then loading a project, don't set its value to default
- attribute "type": widget (GUI) to use
......
......@@ -3,7 +3,7 @@
<name>Volume (keyframable)</name>
<description>Adjust audio volume with keyframes</description>
<author>Dan Dennedy</author>
<parameter type="animated" name="level" default="0" max="50" min="-50" suffix="dB" scale="-1">
<parameter type="animated" name="level" default="0" max="50" min="-100" visualmax="50" visualmin="-50" suffix="dB" scale="-1">
<name>Gain</name>
</parameter>
</effect>
......@@ -298,8 +298,12 @@ bool KeyframeModel::updateKeyframe(int pos, double newVal)
{
GenTime Pos(pos, pCore->getCurrentFps());
if (auto ptr = m_model.lock()) {
double min = ptr->data(m_index, AssetParameterModel::MinRole).toDouble();
double max = ptr->data(m_index, AssetParameterModel::MaxRole).toDouble();
double min = ptr->data(m_index, AssetParameterModel::VisualMinRole).toDouble();
double max = ptr->data(m_index, AssetParameterModel::VisualMaxRole).toDouble();
if (qFuzzyIsNull(min) && qFuzzyIsNull(max)) {
min = ptr->data(m_index, AssetParameterModel::MinRole).toDouble();
max = ptr->data(m_index, AssetParameterModel::MaxRole).toDouble();
}
double factor = ptr->data(m_index, AssetParameterModel::FactorRole).toDouble();
double norm = ptr->data(m_index, AssetParameterModel::DefaultRole).toDouble();
int logRole = ptr->data(m_index, AssetParameterModel::ScaleRole).toInt();
......@@ -454,8 +458,12 @@ QVariant KeyframeModel::data(const QModelIndex &index, int role) const
double val = it->second.second.toDouble();
if (auto ptr = m_model.lock()) {
Q_ASSERT(m_index.isValid());
double min = ptr->data(m_index, AssetParameterModel::MinRole).toDouble();
double max = ptr->data(m_index, AssetParameterModel::MaxRole).toDouble();
double min = ptr->data(m_index, AssetParameterModel::VisualMinRole).toDouble();
double max = ptr->data(m_index, AssetParameterModel::VisualMaxRole).toDouble();
if (qFuzzyIsNull(min) && qFuzzyIsNull(max)) {
min = ptr->data(m_index, AssetParameterModel::MinRole).toDouble();
max = ptr->data(m_index, AssetParameterModel::MaxRole).toDouble();
}
double factor = ptr->data(m_index, AssetParameterModel::FactorRole).toDouble();
double norm = ptr->data(m_index, AssetParameterModel::DefaultRole).toDouble();
int logRole = ptr->data(m_index, AssetParameterModel::ScaleRole).toInt();
......@@ -890,8 +898,12 @@ QVariant KeyframeModel::updateInterpolated(const QVariant &interpValue, double v
QVariant KeyframeModel::getNormalizedValue(double newVal) const
{
if (auto ptr = m_model.lock()) {
double min = ptr->data(m_index, AssetParameterModel::MinRole).toDouble();
double max = ptr->data(m_index, AssetParameterModel::MaxRole).toDouble();
double min = ptr->data(m_index, AssetParameterModel::VisualMinRole).toDouble();
double max = ptr->data(m_index, AssetParameterModel::VisualMaxRole).toDouble();
if (qFuzzyIsNull(min) && qFuzzyIsNull(max)) {
min = ptr->data(m_index, AssetParameterModel::MinRole).toDouble();
max = ptr->data(m_index, AssetParameterModel::MaxRole).toDouble();
}
double factor = ptr->data(m_index, AssetParameterModel::FactorRole).toDouble();
double norm = ptr->data(m_index, AssetParameterModel::DefaultRole).toDouble();
int logRole = ptr->data(m_index, AssetParameterModel::ScaleRole).toInt();
......
......@@ -440,6 +440,10 @@ QVariant AssetParameterModel::data(const QModelIndex &index, int role) const
return parseAttribute(m_ownerId, QStringLiteral("decimals"), element);
case OddRole:
return element.attribute(QStringLiteral("odd")) == QLatin1String("1");
case VisualMinRole:
return parseAttribute(m_ownerId, QStringLiteral("visualmin"), element);
case VisualMaxRole:
return parseAttribute(m_ownerId, QStringLiteral("visualmax"), element);
case DefaultRole:
return parseAttribute(m_ownerId, QStringLiteral("default"), element);
case FilterRole:
......
......@@ -91,6 +91,8 @@ public:
CommentRole,
AlternateNameRole,
MinRole,
VisualMinRole,
VisualMaxRole,
MaxRole,
DefaultRole,
SuffixRole,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment