gstreamer/gst/volume/filter.func

26 lines
550 B
Text
Raw Normal View History

{
guint j;
gint16 vol_i = filter->volume_i;
gfloat vol_f = filter->volume_f;
switch (filter->format) {
case GST_VOLUME_FORMAT_INT:
if (filter->muted) vol_i = 0;
for (j = 0; j < num_samples; j++) {
data[j] = (gint16) (((gint32)vol_i) * ((gint32)data[j]) / 8192);
}
break;
case GST_VOLUME_FORMAT_FLOAT:
if (filter->muted) vol_f = 0;
for (j = 0; j < num_samples; j++) {
data[j] *= vol_f;
}
break;
default:
g_warning("volume: filter.func: no format, aborting");
break;
}
}