-
- Sample* const buffer = buf.data();
-
- fractional_pos = 1.0;
-
- for (pframes_t nx = 0; nx < declick; ++nx) {
- buffer[nx] *= (initial + (delta * (0.5 + 0.5 * cos (M_PI * fractional_pos))));
- fractional_pos += fractional_shift;
- }
-
- /* now ensure the rest of the buffer has the target value applied, if necessary. */
-
- if (declick != nframes) {
-
- if (target == 0.0) {
- memset (&buffer[declick], 0, sizeof (Sample) * (nframes - declick));
- } else if (target != 1.0) {
- apply_gain_to_buffer (&buffer[declick], nframes - declick, target);
- }
- }