From: Torsten Schenk <torsten.schenk@zoho.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org, clemens@ladisch.de
Subject: [PATCH 3/5] TerraTec DMX 6Fire USB updates
Date: Mon, 04 Apr 2011 11:49:00 +0200 [thread overview]
Message-ID: <12f1fea5072.-2538109497311885351.4184985179110801240@zoho.com> (raw)
In-Reply-To: <s5hwrjamq64.wl%tiwai@suse.de>
Added support for sample format s32_le.
Signed-off-by: Torsten Schenk <torsten.schenk@zoho.com>
diff -Nur a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c
--- a/sound/usb/6fire/pcm.c 2011-04-04 11:23:42.102833002 +0200
+++ b/sound/usb/6fire/pcm.c 2011-04-04 11:23:10.342833002 +0200
@@ -64,7 +64,7 @@
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_BATCH,
- .formats = SNDRV_PCM_FMTBIT_S24_LE,
+ .formats = SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE,
.rates = SNDRV_PCM_RATE_44100 |
SNDRV_PCM_RATE_48000 |
@@ -228,7 +228,7 @@
unsigned int total_length = 0;
struct pcm_runtime *rt = snd_pcm_substream_chip(sub->instance);
struct snd_pcm_runtime *alsa_rt = sub->instance->runtime;
- u32 *src = (u32 *) urb->buffer;
+ u32 *src = NULL;
u32 *dest = (u32 *) (alsa_rt->dma_area + sub->dma_off
* (alsa_rt->frame_bits >> 3));
u32 *dest_end = (u32 *) (alsa_rt->dma_area + alsa_rt->buffer_size
@@ -244,7 +244,12 @@
else
frame_count = 0;
- src = (u32 *) (urb->buffer + total_length);
+ if (alsa_rt->format == SNDRV_PCM_FORMAT_S24_LE)
+ src = (u32 *) (urb->buffer + total_length);
+ else if (alsa_rt->format == SNDRV_PCM_FORMAT_S32_LE)
+ src = (u32 *) (urb->buffer - 1 + total_length);
+ else
+ return;
src++; /* skip leading 4 bytes of every packet */
total_length += urb->packets[i].length;
for (frame = 0; frame < frame_count; frame++) {
@@ -274,9 +279,18 @@
* (alsa_rt->frame_bits >> 3));
u32 *src_end = (u32 *) (alsa_rt->dma_area + alsa_rt->buffer_size
* (alsa_rt->frame_bits >> 3));
- u32 *dest = (u32 *) urb->buffer;
+ u32 *dest;
int bytes_per_frame = alsa_rt->channels << 2;
+ if (alsa_rt->format == SNDRV_PCM_FORMAT_S32_LE)
+ dest = (u32 *) (urb->buffer - 1);
+ else if (alsa_rt->format == SNDRV_PCM_FORMAT_S24_LE)
+ dest = (u32 *) (urb->buffer);
+ else {
+ snd_printk(KERN_ERR PREFIX "Unknown sample format.");
+ return;
+ }
+
for (i = 0; i < PCM_N_PACKETS_PER_URB; i++) {
/* at least 4 header bytes for valid packet.
* after that: 32 bits per sample for analog channels */
next prev parent reply other threads:[~2011-04-04 9:49 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <12d995c1fa0.477955495632923443.5387390398635058860@zoho.com>
2011-01-20 16:54 ` Driver for TerraTec DMX 6Fire USB Takashi Iwai
2011-01-20 22:38 ` Torsten Schenk
2011-01-21 8:57 ` Takashi Iwai
2011-01-21 11:48 ` Torsten Schenk
2011-01-22 16:35 ` Takashi Iwai
2011-01-24 12:10 ` Torsten Schenk
2011-01-25 10:25 ` Takashi Iwai
2011-01-25 14:12 ` Torsten Schenk
2011-03-31 19:25 ` TerraTec DMX 6Fire USB updates Torsten Schenk
2011-04-01 12:52 ` Takashi Iwai
2011-04-03 12:30 ` Torsten Schenk
2011-04-04 7:28 ` Takashi Iwai
2011-04-04 9:41 ` Torsten Schenk
2011-04-04 9:45 ` [PATCH 1/5] " Torsten Schenk
2011-04-04 10:29 ` Takashi Iwai
2011-04-04 9:47 ` [PATCH 2/5] " Torsten Schenk
2011-04-04 9:49 ` Torsten Schenk [this message]
2011-04-04 9:49 ` [PATCH 4/5] " Torsten Schenk
2011-04-04 9:50 ` [PATCH 5/5] " Torsten Schenk
2011-06-16 19:06 ` [PATCH] final issues in snd-usb-6fire concerning signedness bug Torsten Schenk
2011-06-16 19:33 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=12f1fea5072.-2538109497311885351.4184985179110801240@zoho.com \
--to=torsten.schenk@zoho.com \
--cc=alsa-devel@alsa-project.org \
--cc=clemens@ladisch.de \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.