[Musicpd-dev-team] [PATCH/RFC] Fix DSD-over-USB playback

2012-04-06 Thread Jurgen Kramer
The attached patch fixes playback for DSD-over-USB. Without this patch
MPD uses a frame size of 2 (stereo files) while the actual needed frame
size for the used output sample format is 8 (sample formats S24_P32 and
S32).

Maybe this is not the proper/complete solution but will at least allow
users to test the current DSD-over-USB code and hopefully provides some
clues for the actual fixes (if needed).
Below some more background info.

---
 src/output/alsa_output_plugin.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

Jurgen


Background:
For SAMPLE_FORMAT_DSD in- and out frame sizes are 2 (stereo files). When
using DSD2PCM the sample format is set to SAMPLE_FORMAT_FLOAT which has
a frame sizes of 8. For DSD-over-USB the sample format remains on
SAMPLE_FORMAT_DSD with a frame size of 2 which results in too little
data (4x) being sent to the receiving audio device.
diff --git a/src/output/alsa_output_plugin.c b/src/output/alsa_output_plugin.c
index a6dc92f..2a82861 100644
--- a/src/output/alsa_output_plugin.c
+++ b/src/output/alsa_output_plugin.c
@@ -673,7 +673,12 @@ alsa_open(struct audio_output *ao, struct audio_format *audio_format, GError **e
 		return false;
 	}
 
-	ad-in_frame_size = audio_format_frame_size(audio_format);
+	if (ad-export.shift8) {
+		g_warning(Adjusting in_frame_size for DSD-over-USB output\n);
+		ad-in_frame_size = ad-export.shift8 ? 8 : ad-in_frame_size;
+	} else {
+		ad-in_frame_size = audio_format_frame_size(audio_format);
+	}
 	ad-out_frame_size = ad-export.pack24 ? 3 : ad-in_frame_size;
 
 	return true;
-- 
1.7.6.5

--
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


Re: [Musicpd-dev-team] [PATCH/RFC] Fix DSD-over-USB playback

2012-04-06 Thread adel...@freemail.gr
On 6/4/2012 1:52 μμ, Jurgen Kramer wrote:
 The attached patch fixes playback for DSD-over-USB. Without this patch
 MPD uses a frame size of 2 (stereo files) while the actual needed frame
 size for the used output sample format is 8 (sample formats S24_P32 and
 S32).

 Maybe this is not the proper/complete solution but will at least allow
 users to test the current DSD-over-USB code and hopefully provides some
 clues for the actual fixes (if needed).
 Below some more background info.

 ---
   src/output/alsa_output_plugin.c |7 ++-
   1 files changed, 6 insertions(+), 1 deletions(-)

 Jurgen


 Background:
 For SAMPLE_FORMAT_DSD in- and out frame sizes are 2 (stereo files). When
 using DSD2PCM the sample format is set to SAMPLE_FORMAT_FLOAT which has
 a frame sizes of 8. For DSD-over-USB the sample format remains on
 SAMPLE_FORMAT_DSD with a frame size of 2 which results in too little
 data (4x) being sent to the receiving audio device.


I just ran a quick test and DSD over USB playback is working fine with 
this patch on my XMOS board.

Thanks.

--
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team