Clear silent/dsd_bits/dsd_shift in s16_disable so a re-enable starts
clean, and zero the DSD EMA accumulators in s16_reset so the level does
not carry a stale value across an xrun restart.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
s16->buf = NULL;
free(s16->buf_areas);
s16->buf_areas = 0;
+ /* Clear the format-derived state too, so a re-enable with a different
+ * format starts clean instead of inheriting a stale decode path. */
+ s16->silent = 0;
+ s16->dsd_bits = 0;
+ s16->dsd_shift = 0;
}
static void s16_close(snd_pcm_scope_t *scope)
{
snd_pcm_scope_s16_t *s16 = scope->private_data;
snd_pcm_meter_t *meter = s16->pcm->private_data;
+ /* Drop the DSD EMA accumulators so the level does not carry a stale
+ * value across a reset (e.g. an xrun restart). */
+ if (s16->dsd_states)
+ memset(s16->dsd_states, 0,
+ meter->gen.slave->channels * sizeof(*s16->dsd_states));
s16->old = meter->now;
}