[xiph-cvs] cvs commit: vorbis-tools/oggenc audio.c

Michael Smith msmith at xiph.org
Sun May 27 03:30:45 PDT 2001



msmith      01/05/27 03:30:45

  Modified:    oggenc   audio.c
  Log:
  8 bit mode was broken in the contributed patch, my fix was incomplete.

Revision  Changes    Path
1.12      +5 -6      vorbis-tools/oggenc/audio.c

Index: audio.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/oggenc/audio.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- audio.c	2001/05/27 09:49:35	1.11
+++ audio.c	2001/05/27 10:30:45	1.12
@@ -281,7 +281,7 @@
         format.blocksize = READ_U32_BE(buf2+4);
 
         if( format.blocksize == 0 &&
-		format.samplesize == 16)
+		(format.samplesize == 16 || format.samplesize == 8))
         {
                 /* From here on, this is very similar to the wav code. Oh well. */
                 
@@ -310,7 +310,7 @@
         {
                 fprintf(stderr, 
                                 "Warning: OggEnc does not support this type of AIFF/AIFC file\n"
-				" Must be 16 bit PCM.\n");
+				" Must be 8 or 16 bit PCM.\n");
                 return 0;
         }
 }
@@ -385,7 +385,7 @@
 
         if(format.format == 1)
         {
-		samplesize = 2;
+		samplesize = format.samplesize/8;
                 opt->read_samples = wav_read;
         }
         else if(format.format == 3)
@@ -404,7 +404,7 @@
 
 
         if( format.align == format.channels*samplesize &&
-		format.samplesize == 8*samplesize)
+			format.samplesize == samplesize*8)
         {
                 if(format.samplerate != 44100)
                         fprintf(stderr, "Warning: Vorbis is currently not tuned for input\n"
@@ -478,8 +478,7 @@
                 {
                         for(j=0; j < f->channels; j++)
                         {
-				buffer[j][i] = ( (int)(bufu[i*f->channels + j + 1]) - 128 ) 
-					/ 255.0f ;
+				buffer[j][i]=((int)(bufu[i*f->channels + j])-128)/128.0f;
                         }
                 }
         }

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list