diff mbox

ALSA: usb-audio: Eliminate noise at the start of DSD playback.

Message ID 1481565178-2199-1-git-send-email-nob77413@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Nobutaka Okabe Dec. 12, 2016, 5:52 p.m. UTC
[Problem]
In some USB DACs, a terrible pop noise comes to be heard
at the start of DSD playback (in the following situations).

- play first DSD track
- change from PCM track to DSD track
- change from DSD64 track to DSD128 track (and etc...)
- seek DSD track
- Fast-Forward/Rewind DSD track

[Cause]
At the start of playback, there is a little silence.
The silence bit pattern "0x69" is required on DSD mode,
but it is not like that.

[Solution]
This patch adds DSD silence pattern to the endpoint settings.

Signed-off-by: Nobutaka Okabe <nob77413@gmail.com>
---
 sound/usb/endpoint.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

Comments

Takashi Iwai Dec. 12, 2016, 9:44 p.m. UTC | #1
On Mon, 12 Dec 2016 18:52:58 +0100,
Nobutaka Okabe wrote:
> 
> [Problem]
> In some USB DACs, a terrible pop noise comes to be heard
> at the start of DSD playback (in the following situations).
> 
> - play first DSD track
> - change from PCM track to DSD track
> - change from DSD64 track to DSD128 track (and etc...)
> - seek DSD track
> - Fast-Forward/Rewind DSD track
> 
> [Cause]
> At the start of playback, there is a little silence.
> The silence bit pattern "0x69" is required on DSD mode,
> but it is not like that.
> 
> [Solution]
> This patch adds DSD silence pattern to the endpoint settings.
> 
> Signed-off-by: Nobutaka Okabe <nob77413@gmail.com>

Thanks, applied.


Takashi
diff mbox

Patch

diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 57b0d99..a2cdf33 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -638,7 +638,21 @@  static int data_ep_set_params(struct snd_usb_endpoint *ep,
 
 	ep->datainterval = fmt->datainterval;
 	ep->stride = frame_bits >> 3;
-	ep->silence_value = pcm_format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0;
+
+	switch (pcm_format) {
+	case SNDRV_PCM_FORMAT_U8:
+		ep->silence_value = 0x80;
+		break;
+	case SNDRV_PCM_FORMAT_DSD_U8:
+	case SNDRV_PCM_FORMAT_DSD_U16_LE:
+	case SNDRV_PCM_FORMAT_DSD_U32_LE:
+	case SNDRV_PCM_FORMAT_DSD_U16_BE:
+	case SNDRV_PCM_FORMAT_DSD_U32_BE:
+		ep->silence_value = 0x69;
+		break;
+	default:
+		ep->silence_value = 0;
+	}
 
 	/* assume max. frequency is 50% higher than nominal */
 	ep->freqmax = ep->freqn + (ep->freqn >> 1);