From 150c23c7abdc3b915ff3763d639768e081af7759 Mon Sep 17 00:00:00 2001 From: musil Date: Thu, 11 Dec 2008 19:38:44 +0000 Subject: soundfile_info puts out a 8th float: format code svn path=/trunk/externals/iemlib/; revision=10445 --- iemlib1/soundfile_info-help.pd | 76 ++++++++++++++++++++++-------------------- iemlib1/src/iemlib1.c | 2 +- iemlib1/src/soundfile_info.c | 12 ++++--- 3 files changed, 48 insertions(+), 42 deletions(-) (limited to 'iemlib1') diff --git a/iemlib1/soundfile_info-help.pd b/iemlib1/soundfile_info-help.pd index 631960c..ce76a99 100644 --- a/iemlib1/soundfile_info-help.pd +++ b/iemlib1/soundfile_info-help.pd @@ -1,36 +1,40 @@ -#N canvas 153 56 725 412 10; -#X obj 31 45 openpanel; -#X obj 31 26 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 --1; -#X msg 31 92 read \$1; -#X obj 31 166 soundfile_info; -#X obj 31 217 print; -#X text 40 146 "read"-message needs a symbol (soundfile in wave format) -; -#X symbolatom 131 75 66 0 0 0 - - -; -#X text 50 184 "list"-message output with 7 items; -#X text 91 224 4.item: header-size in bytes; -#X text 91 194 1.item: samplerate in Hz; -#X text 91 204 2.item: file-name; -#X text 91 234 5.item: number of channels; -#X text 7 2 soundfile_info; -#X text 130 2 show the header-data of a wav-file; -#X text 91 254 7.item: endianness ("l" for little); -#X text 260 264 ("b" for big); -#X text 214 279 (eg. little endian "wav" is natural format on Intel-machines) -; -#X text 214 314 (eg. big endian "aiff" is natural format on Macintosh-machines) -; -#X text 91 214 3.item: sound-data-length in samples; -#X text 91 244 6.item: sample-resolution in bytes; -#X text 95 328 IEM KUG; -#X text 79 316 musil; -#X text 109 316 @; -#X text 115 316 iem.at; -#X text 30 305 (c) Thomas Musil 2000 - 2005; -#X text 78 338 Graz \, Austria; -#X connect 0 0 2 0; -#X connect 0 0 6 0; -#X connect 1 0 0 0; -#X connect 2 0 3 0; -#X connect 3 0 4 0; +#N canvas 153 56 730 458 10; +#X obj 31 45 openpanel; +#X obj 31 26 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 31 92 read \$1; +#X obj 31 166 soundfile_info; +#X obj 31 217 print; +#X text 40 146 "read"-message needs a symbol (soundfile in wave format) +; +#X symbolatom 131 75 66 0 0 0 - - -; +#X text 50 184 "list"-message output with 7 items; +#X text 91 224 4.item: header-size in bytes; +#X text 91 194 1.item: samplerate in Hz; +#X text 91 204 2.item: file-name; +#X text 91 234 5.item: number of channels; +#X text 7 2 soundfile_info; +#X text 130 2 show the header-data of a wav-file; +#X text 91 254 7.item: endianness ("l" for little); +#X text 260 264 ("b" for big); +#X text 214 279 (eg. little endian "wav" is natural format on Intel-machines) +; +#X text 214 304 (eg. big endian "aiff" is natural format on Macintosh-machines) +; +#X text 91 214 3.item: sound-data-length in samples; +#X text 91 244 6.item: sample-resolution in bytes; +#X text 75 388 IEM KUG; +#X text 55 376 musil; +#X text 89 376 @; +#X text 97 376 iem.at; +#X text 58 398 Graz \, Austria; +#X text 10 365 (c) Thomas Musil 2000 - 2008; +#X text 90 325 8.item: format code (1 .. linear PCM); +#X text 286 335 (3 .. IEEE-float); +#X text 286 345 (6 .. 8 bit ALAW); +#X text 286 355 (7 .. 8 bit MULAW); +#X connect 0 0 2 0; +#X connect 0 0 6 0; +#X connect 1 0 0 0; +#X connect 2 0 3 0; +#X connect 3 0 4 0; diff --git a/iemlib1/src/iemlib1.c b/iemlib1/src/iemlib1.c index f7123d2..811b545 100644 --- a/iemlib1/src/iemlib1.c +++ b/iemlib1/src/iemlib1.c @@ -75,6 +75,6 @@ void iemlib1_setup(void) v2db_setup(); vcf_filter_tilde_setup(); - post("iemlib1 (R-1.17) library loaded! (c) Thomas Musil 03.2008"); + post("iemlib1 (R-1.17) library loaded! (c) Thomas Musil 11.2008"); post(" musil%ciem.at iem KUG Graz Austria", '@'); } diff --git a/iemlib1/src/soundfile_info.c b/iemlib1/src/soundfile_info.c index 2b0903d..1a84403 100644 --- a/iemlib1/src/soundfile_info.c +++ b/iemlib1/src/soundfile_info.c @@ -1,7 +1,7 @@ /* For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. -iemlib1 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ +iemlib1 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2008 */ #include "m_pd.h" #include "iemlib.h" @@ -17,8 +17,9 @@ iemlib1 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 #define SFI_HEADER_CHANNELS 4 #define SFI_HEADER_BYTES_PER_SAMPLE 5 #define SFI_HEADER_ENDINESS 6 +#define SFI_HEADER_FORMAT_CODE 7 -#define SFI_HEADER_SIZE 7 +#define SFI_HEADER_SIZE 8 @@ -143,16 +144,17 @@ soundfile_info_fmt: cvec += 4; ss = soundfile_info_str2short(cvec); /* format */ - if(ss != 1) /* PCM = 1 */ + if((ss != 1) && (ss != 3) && (ss != 6) && (ss != 7)) /* PCM = 1 ; IEEE-FLOAT = 3 ; ALAW = 6 ; MULAW = 7 */ { - post("soundfile_info_read-error: %s is not PCM-format coded", completefilename); + post("soundfile_info_read-error: %s has unknown format code", completefilename); goto soundfile_info_end; } + SETFLOAT(x->x_atheader+SFI_HEADER_FORMAT_CODE, (t_float)ss); header_size += 2; cvec += 2; ss = soundfile_info_str2short(cvec); /* channels */ - if((ss < 1) || (ss > 100)) + if((ss < 1) || (ss > 1000)) { post("soundfile_info_read-error: %s has no common channel-number", completefilename); goto soundfile_info_end; -- cgit v1.2.1