Eros Q Hosted: Apply DC Bias to PCM Data

Similar to the native port, the hosted port benefits from
adding a -1 dc bias to the PCM data. This prevents almost
all clicking artifacts.

Change-Id: Ic6378716774b6d88df23c476e2ef54d49f33dc72
This commit is contained in:
Dana Conrad 2021-08-09 19:22:52 -05:00 committed by Solomon Peachy
parent 235e41578b
commit 6de6e1459d
2 changed files with 9 additions and 2 deletions

View file

@ -3,6 +3,8 @@
#define AUDIOHW_CAPS (LINEOUT_CAP)
#define PCM_DC_OFFSET_VALUE -1
AUDIOHW_SETTING(VOLUME, "dB", 0, 2, -74, 0, -40)
//#define AUDIOHW_NEEDS_INITIAL_UNMUTE

View file

@ -68,6 +68,11 @@
#warning "MIX_FRAME_SAMPLES <1024 may cause dropouts!"
#endif
/* PCM_DC_OFFSET_VALUE is a workaround for eros q hardware quirk */
#if !defined(PCM_DC_OFFSET_VALUE)
# define PCM_DC_OFFSET_VALUE 0
#endif
static const snd_pcm_access_t access_ = SND_PCM_ACCESS_RW_INTERLEAVED; /* access mode */
#if defined(HAVE_ALSA_32BIT)
static const snd_pcm_format_t format = SND_PCM_FORMAT_S32_LE; /* sample format */
@ -359,8 +364,8 @@ static bool copy_frames(bool first)
sample_t *sample_ptr = &frames[2*(period_size-frames_left)];
for (int i = 0; i < nframes; i++)
{
*sample_ptr++ = *pcm_ptr++ * dig_vol_mult_l;
*sample_ptr++ = *pcm_ptr++ * dig_vol_mult_r;
*sample_ptr++ = (*pcm_ptr++ * dig_vol_mult_l) + PCM_DC_OFFSET_VALUE;
*sample_ptr++ = (*pcm_ptr++ * dig_vol_mult_r) + PCM_DC_OFFSET_VALUE;
}
}
else