Index: uspace/drv/audio/sb16/dsp.c
===================================================================
--- uspace/drv/audio/sb16/dsp.c	(revision 68d1313203ec8d46e7e4017b915b58cef472540c)
+++ uspace/drv/audio/sb16/dsp.c	(revision 737b4c0c17bd4b9485d683e5c0802d801e3543e1)
@@ -147,10 +147,7 @@
 }
 
-static inline size_t sample_count(unsigned sample_size, size_t byte_count)
-{
-	if (sample_size == 16) {
-		return byte_count / 2;
-	}
-	return byte_count;
+static inline size_t sample_count(pcm_sample_format_t format, size_t byte_count)
+{
+	return byte_count / pcm_sample_format_size(format);
 }
 
@@ -261,5 +258,5 @@
 
 int sb_dsp_start_playback(sb_dsp_t *dsp, unsigned id, unsigned parts,
-    unsigned sampling_rate, unsigned sample_size, unsigned channels, bool sign)
+    unsigned channels, unsigned sampling_rate, pcm_sample_format_t format)
 {
 	assert(dsp);
@@ -276,13 +273,14 @@
 	/* Check supported parameters */
 	ddf_log_debug("Requested playback on buffer \"%u\" (%u parts): %uHz, "
-	    "%ssinged %u bit, %u channel(s).", id, parts, sampling_rate,
-	    sign ? "" : "un", sample_size, channels);
-	if (id != BUFFER_ID)
-		return ENOENT;
-	if (sample_size != 16) // FIXME We only support 16 bit playback
-		return ENOTSUP;
+	    "%s, %u channel(s).", id, parts, sampling_rate,
+	    pcm_sample_format_str(format), channels);
+	if (id != BUFFER_ID)
+		return ENOENT;
 	if (channels != 1 && channels != 2)
 		return ENOTSUP;
 	if (sampling_rate > 44100)
+		return ENOTSUP;
+	// FIXME We only support 16 bit playback
+	if (format != PCM_SAMPLE_UINT16_LE && format != PCM_SAMPLE_SINT16_LE)
 		return ENOTSUP;
 
@@ -291,9 +289,11 @@
 		return ENOMEM;
 
+	const bool sign = (format == PCM_SAMPLE_SINT16_LE);
+
 	sb_dsp_write(dsp, SET_SAMPLING_RATE_OUTPUT);
 	sb_dsp_write(dsp, sampling_rate >> 8);
 	sb_dsp_write(dsp, sampling_rate & 0xff);
 
-	ddf_log_verbose("Sampling rate: %hhx:%hhx.",
+	ddf_log_verbose("Sample rate: %hhx:%hhx.",
 	    sampling_rate >> 8, sampling_rate & 0xff);
 
@@ -308,5 +308,5 @@
 	sb_dsp_write(dsp, dsp->active.mode);
 
-	dsp->active.samples = sample_count(sample_size, play_block_size);
+	dsp->active.samples = sample_count(format, play_block_size);
 	sb_dsp_write(dsp, (dsp->active.samples - 1) & 0xff);
 	sb_dsp_write(dsp, (dsp->active.samples - 1) >> 8);
@@ -314,5 +314,5 @@
 	ddf_log_verbose("Playback started, interrupt every %u samples "
 	    "(~1/%u sec)", dsp->active.samples,
-	    sampling_rate / dsp->active.samples);
+	    sampling_rate / (dsp->active.samples * channels));
 
 	dsp->active.playing = true;
@@ -332,5 +332,5 @@
 
 int sb_dsp_start_record(sb_dsp_t *dsp, unsigned id, unsigned parts,
-    unsigned sampling_rate, unsigned sample_size, unsigned channels, bool sign)
+    unsigned channels, unsigned sampling_rate, pcm_sample_format_t format)
 {
 	assert(dsp);
@@ -347,13 +347,14 @@
 	/* Check supported parameters */
 	ddf_log_debug("Requested recording on buffer \"%u\" (%u parts): %uHz, "
-	    "%ssinged %u bit, %u channel(s).", id, parts, sampling_rate,
-	    sign ? "" : "un", sample_size, channels);
-	if (id != BUFFER_ID)
-		return ENOENT;
-	if (sample_size != 16) // FIXME We only support 16 bit playback
-		return ENOTSUP;
+	    "%s, %u channel(s).", id, parts, sampling_rate,
+	    pcm_sample_format_str(format), channels);
+	if (id != BUFFER_ID)
+		return ENOENT;
 	if (channels != 1 && channels != 2)
 		return ENOTSUP;
 	if (sampling_rate > 44100)
+		return ENOTSUP;
+	// FIXME We only support 16 bit recording
+	if (format != PCM_SAMPLE_UINT16_LE && format != PCM_SAMPLE_SINT16_LE)
 		return ENOTSUP;
 
@@ -361,4 +362,6 @@
 	if (!dsp->event_exchange)
 		return ENOMEM;
+
+	const bool sign = (format == PCM_SAMPLE_SINT16_LE);
 
 	sb_dsp_write(dsp, SET_SAMPLING_RATE_OUTPUT);
@@ -379,5 +382,5 @@
 	sb_dsp_write(dsp, dsp->active.mode);
 
-	dsp->active.samples = sample_count(sample_size, play_block_size);
+	dsp->active.samples = sample_count(format, play_block_size);
 	sb_dsp_write(dsp, (dsp->active.samples - 1) & 0xff);
 	sb_dsp_write(dsp, (dsp->active.samples - 1) >> 8);
@@ -385,5 +388,5 @@
 	ddf_log_verbose("Recording started started, interrupt every %u samples "
 	    "(~1/%u sec)", dsp->active.samples,
-	    sampling_rate / dsp->active.samples);
+	    sampling_rate / (dsp->active.samples * channels));
 	dsp->active.playing = false;
 
