diff options
author | Monty <xiphmont@xiph.org> | 2001-08-13 11:40:43 +0000 |
---|---|---|
committer | Monty <xiphmont@xiph.org> | 2001-08-13 11:40:43 +0000 |
commit | 88fcb841c3b76b4673e80522a9ea8e18e9f97a89 (patch) | |
tree | 56358a6a4e14887c6d282d60b9778d60ce6cb0c0 | |
parent | 2491915fdb61371e95f5b7675982767463781dd0 (diff) | |
download | libvorbis-git-1.0.0rc2.tar.gz |
Oops, roll this back to the right versionv1.0.0rc2
svn path=/trunk/vorbis/; revision=1883
-rw-r--r-- | examples/encoder_example.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/examples/encoder_example.c b/examples/encoder_example.c index 8ed6d099..9fb65ef5 100644 --- a/examples/encoder_example.c +++ b/examples/encoder_example.c @@ -11,7 +11,7 @@ ******************************************************************** function: simple example encoder - last mod: $Id: encoder_example.c,v 1.22 2001/08/13 11:33:39 xiphmont Exp $ + last mod: $Id: encoder_example.c,v 1.23 2001/08/13 11:40:43 xiphmont Exp $ ********************************************************************/ @@ -36,7 +36,7 @@ #endif #define READ 1024 -signed char readbuffer[READ*2+44]; /* out of the data segment, not the stack */ +signed char readbuffer[READ*4+44]; /* out of the data segment, not the stack */ int main(){ ogg_stream_state os; /* take physical pages, weld into a logical @@ -79,7 +79,7 @@ int main(){ /* choose an encoding mode */ /* (mode 0: 44kHz stereo uncoupled, roughly 128kbps VBR) */ vorbis_info_init(&vi); - vorbis_encode_init(&vi,1,44100, -1, 999000, -1); + vorbis_encode_init(&vi,2,44100, -1, 128000, -1); /* add a comment */ vorbis_comment_init(&vc); @@ -128,7 +128,7 @@ int main(){ while(!eos){ long i; - long bytes=fread(readbuffer,1,READ*2,stdin); /* stereo hardwired here */ + long bytes=fread(readbuffer,1,READ*4,stdin); /* stereo hardwired here */ if(bytes==0){ /* end of file. this can be done implicitly in the mainline, @@ -144,11 +144,13 @@ int main(){ float **buffer=vorbis_analysis_buffer(&vd,READ); /* uninterleave samples */ - for(i=0;i<bytes/2;i++){ - buffer[0][i]=((readbuffer[i*2+1]<<8)| - (0x00ff&(int)readbuffer[i*2]))/32768.f; + for(i=0;i<bytes/4;i++){ + buffer[0][i]=((readbuffer[i*4+1]<<8)| + (0x00ff&(int)readbuffer[i*4]))/32768.f; + buffer[1][i]=((readbuffer[i*4+3]<<8)| + (0x00ff&(int)readbuffer[i*4+2]))/32768.f; } - + /* tell the library how much we actually submitted */ vorbis_analysis_wrote(&vd,i); } |