@item shift
Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
Default value is 0.0.
+
+@item level
+Set output gain applied to final output. Allowed range is from -1.0 to 1.0.
+Default value is 1.0.
@end table
@subsection Commands
-This filter supports the above option as @ref{commands}.
+This filter supports the all above options as @ref{commands}.
@section agate
@item shift
Specify phase shift. Allowed range is from -1.0 to 1.0.
Default value is 0.0.
+
+@item level
+Set output gain applied to final output. Allowed range is from -1.0 to 1.0.
+Default value is 1.0.
@end table
@subsection Commands
-This filter supports the above option as @ref{commands}.
+This filter supports the all above options as @ref{commands}.
@section apulsator
const AVClass *class;
double shift;
+ double level;
double c[NB_COEFS];
double *i2, double *o2)
{
AFreqShift *s = ctx->priv;
- double *c = s->c;
+ const double *c = s->c;
+ const double level = s->level;
double shift = s->shift * M_PI;
double cos_theta = cos(shift);
double sin_theta = sin(shift);
}
Q = o2[NB_COEFS - 1];
- dst[n] = I * cos_theta - Q * sin_theta;
+ dst[n] = (I * cos_theta - Q * sin_theta) * level;
}
}
double *i2, double *o2)
{
AFreqShift *s = ctx->priv;
- double *c = s->c;
+ const double *c = s->c;
+ const double level = s->level;
double ts = 1. / sample_rate;
double shift = s->shift;
int64_t N = s->in_samples;
Q = o2[NB_COEFS - 1];
theta = 2. * M_PI * fmod(shift * (N + n) * ts, 1.);
- dst[n] = I * cos(theta) - Q * sin(theta);
+ dst[n] = (I * cos(theta) - Q * sin(theta)) * level;
}
}
static const AVOption afreqshift_options[] = {
{ "shift", "set frequency shift", OFFSET(shift), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -INT_MAX, INT_MAX, FLAGS },
+ { "level", "set output level", OFFSET(level), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.0, 1.0, FLAGS },
{ NULL }
};
static const AVOption aphaseshift_options[] = {
{ "shift", "set phase shift", OFFSET(shift), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1.0, 1.0, FLAGS },
+ { "level", "set output level",OFFSET(level), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.0, 1.0, FLAGS },
{ NULL }
};