* [PATCH] aplay/arecord - Add support for IEEE float 32-bit WAV files
@ 2008-02-02 21:29 Andrew Paprocki
2008-02-06 13:34 ` Takashi Iwai
2008-02-06 14:03 ` Michael Gerdau
0 siblings, 2 replies; 4+ messages in thread
From: Andrew Paprocki @ 2008-02-02 21:29 UTC (permalink / raw)
To: alsa-devel
This patch modifies aplay/arecord to support playing/capturing IEEE float
32-bit WAV files. Tested on HDA hardware in both stereo and multi-channel
modes. Added the WAV file constant for Dolby AC-3 S/PDIF passthrough to
formats.h for future use when AC-3 passthrough is better supported.
Signed-off-by: Andrew Paprocki <andrew@ishiboo.com>
diff -r 675baf17b7c9 -r 711f7227eb13 aplay/aplay.c
--- a/aplay/aplay.c Mon Jan 21 10:42:48 2008 +0100
+++ b/aplay/aplay.c Sat Feb 02 17:28:32 2008 -0500
@@ -745,8 +745,9 @@ static ssize_t test_wavefile(int fd, u_c
check_wavefile_space(buffer, len, blimit);
test_wavefile_read(fd, buffer, &size, len, __LINE__);
f = (WaveFmtBody*) buffer;
- if (LE_SHORT(f->format) != WAV_PCM_CODE) {
- error(_("can't play not PCM-coded WAVE-files"));
+ if (LE_SHORT(f->format) != WAV_FMT_PCM &&
+ LE_SHORT(f->format) != WAV_FMT_IEEE_FLOAT) {
+ error(_("can't play WAVE-file format 0x%04x which is not PCM or FLOAT encoded"), LE_SHORT(f->format));
exit(EXIT_FAILURE);
}
if (LE_SHORT(f->modus) < 1) {
@@ -788,7 +789,10 @@ static ssize_t test_wavefile(int fd, u_c
}
break;
case 32:
- hwparams.format = SND_PCM_FORMAT_S32_LE;
+ if (LE_SHORT(f->format) == WAV_FMT_PCM)
+ hwparams.format = SND_PCM_FORMAT_S32_LE;
+ else if (LE_SHORT(f->format) == WAV_FMT_IEEE_FLOAT)
+ hwparams.format = SND_PCM_FORMAT_FLOAT_LE;
break;
default:
error(_(" can't play WAVE-files with sample %d bits wide"),
@@ -1778,6 +1782,7 @@ static void begin_wave(int fd, size_t cn
bits = 16;
break;
case SND_PCM_FORMAT_S32_LE:
+ case SND_PCM_FORMAT_FLOAT_LE:
bits = 32;
break;
case SND_PCM_FORMAT_S24_LE:
@@ -1796,7 +1801,10 @@ static void begin_wave(int fd, size_t cn
cf.type = WAV_FMT;
cf.length = LE_INT(16);
- f.format = LE_SHORT(WAV_PCM_CODE);
+ if (hwparams.format == SND_PCM_FORMAT_FLOAT_LE)
+ f.format = LE_SHORT(WAV_FMT_IEEE_FLOAT);
+ else
+ f.format = LE_SHORT(WAV_FMT_PCM);
f.modus = LE_SHORT(hwparams.channels);
f.sample_fq = LE_INT(hwparams.rate);
#if 0
diff -r 675baf17b7c9 -r 711f7227eb13 aplay/formats.h
--- a/aplay/formats.h Mon Jan 21 10:42:48 2008 +0100
+++ b/aplay/formats.h Sat Feb 02 17:28:32 2008 -0500
@@ -64,7 +64,11 @@ typedef struct voc_ext_block {
#define WAV_WAVE COMPOSE_ID('W','A','V','E')
#define WAV_FMT COMPOSE_ID('f','m','t',' ')
#define WAV_DATA COMPOSE_ID('d','a','t','a')
-#define WAV_PCM_CODE 1
+
+/* WAVE fmt block constants from Microsoft mmreg.h header */
+#define WAV_FMT_PCM 0x0001
+#define WAV_FMT_IEEE_FLOAT 0x0003
+#define WAV_FMT_DOLBY_AC3_SPDIF 0x0092
/* it's in chunks like .voc and AMIGA iff, but my source say there
are in only in this combination, so I combined them in one header;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] aplay/arecord - Add support for IEEE float 32-bit WAV files
2008-02-02 21:29 [PATCH] aplay/arecord - Add support for IEEE float 32-bit WAV files Andrew Paprocki
@ 2008-02-06 13:34 ` Takashi Iwai
2008-02-06 14:03 ` Michael Gerdau
1 sibling, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2008-02-06 13:34 UTC (permalink / raw)
To: Andrew Paprocki; +Cc: alsa-devel
At Sat, 02 Feb 2008 17:29:52 -0400,
Andrew Paprocki wrote:
>
> This patch modifies aplay/arecord to support playing/capturing IEEE float
> 32-bit WAV files. Tested on HDA hardware in both stereo and multi-channel
> modes. Added the WAV file constant for Dolby AC-3 S/PDIF passthrough to
> formats.h for future use when AC-3 passthrough is better supported.
>
> Signed-off-by: Andrew Paprocki <andrew@ishiboo.com>
Applied to HG tree now (as post 1.0.16). Thanks.
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] aplay/arecord - Add support for IEEE float 32-bit WAV files
2008-02-02 21:29 [PATCH] aplay/arecord - Add support for IEEE float 32-bit WAV files Andrew Paprocki
2008-02-06 13:34 ` Takashi Iwai
@ 2008-02-06 14:03 ` Michael Gerdau
2008-02-06 14:39 ` Clemens Ladisch
1 sibling, 1 reply; 4+ messages in thread
From: Michael Gerdau @ 2008-02-06 14:03 UTC (permalink / raw)
To: alsa-devel
[-- Attachment #1.1: Type: text/plain, Size: 471 bytes --]
> +/* WAVE fmt block constants from Microsoft mmreg.h header */
> +#define WAV_FMT_PCM 0x0001
> +#define WAV_FMT_IEEE_FLOAT 0x0003
> +#define WAV_FMT_DOLBY_AC3_SPDIF 0x0092
Does this mean "copy and paste" from M$ copyrighted work ?
And if yes, wouldn't that imply a copyright violation committed by ALSA ?
Just asking, best,
Michael
--
Michael Gerdau email: mgerdau@tiscali.de
GPG-keys available on request or at public keyserver
[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 194 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] aplay/arecord - Add support for IEEE float 32-bit WAV files
2008-02-06 14:03 ` Michael Gerdau
@ 2008-02-06 14:39 ` Clemens Ladisch
0 siblings, 0 replies; 4+ messages in thread
From: Clemens Ladisch @ 2008-02-06 14:39 UTC (permalink / raw)
To: Michael Gerdau; +Cc: alsa-devel
Michael Gerdau wrote:
>> +/* WAVE fmt block constants from Microsoft mmreg.h header */
>> +#define WAV_FMT_PCM 0x0001
>> +#define WAV_FMT_IEEE_FLOAT 0x0003
>> +#define WAV_FMT_DOLBY_AC3_SPDIF 0x0092
>
> Does this mean "copy and paste" from M$ copyrighted work ?
No, mmreg.h actually uses "WAVE_FORMAT_PCM".
Regards,
Clemens
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-02-06 14:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-02 21:29 [PATCH] aplay/arecord - Add support for IEEE float 32-bit WAV files Andrew Paprocki
2008-02-06 13:34 ` Takashi Iwai
2008-02-06 14:03 ` Michael Gerdau
2008-02-06 14:39 ` Clemens Ladisch
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.