- vorbis_encode_setup_managed(&vi,2,44100,-1,128000,-1);
- //vorbis_encode_init(&vi,2,44100,-1,128000,-1);
- //vorbis_encode_init_vbr(&vi,2,44100,.45);
- vorbis_encode_ctl(&vi,OV_ECTL_RATEMANAGE_AVG,NULL);
- vorbis_encode_setup_init(&vi);
+ /* choose an encoding mode. A few possibilities commented out, one
+ actually used: */
+
+ /*********************************************************************
+ Encoding using a VBR quality mode. The usable range is -.1
+ (lowest quality, smallest file) to 1. (highest quality, largest file).
+ Example quality mode .4: 44kHz stereo coupled, roughly 128kbps VBR
+
+ ret = vorbis_encode_init_vbr(&vi,2,44100,.4);
+
+ ---------------------------------------------------------------------
+
+ Encoding using an average bitrate mode (ABR).
+ example: 44kHz stereo coupled, average 128kbps VBR
+
+ ret = vorbis_encode_init(&vi,2,44100,-1,128000,-1);
+
+ ---------------------------------------------------------------------
+
+ Encode using a quality mode, but select that quality mode by asking for
+ an approximate bitrate. This is not ABR, it is true VBR, but selected
+ using the bitrate interface, and then turning bitrate management off:
+
+ ret = ( vorbis_encode_setup_managed(&vi,2,44100,-1,128000,-1) ||
+ vorbis_encode_ctl(&vi,OV_ECTL_RATEMANAGE2_SET,NULL) ||
+ vorbis_encode_setup_init(&vi));
+
+ *********************************************************************/
+
+ ret=vorbis_encode_init_vbr(&vi,2,44100,0.1);
+
+ /* do not continue if setup failed; this can happen if we ask for a
+ mode that libVorbis does not support (eg, too low a bitrate, etc,
+ will return 'OV_EIMPL') */
+
+ if(ret)exit(1);