Clipping of samples in ogg encoder


Hi all,
I have a strange bug. I m trying to convert wav file into ogg file. I changed the JUCE OGG format writer code to accept VBR mode. And also to accept various constant bitrate modes from -1 to 10. ( it was “Low Quality” , “Medium Quality” and “High Quality” )

[code]//The Changes is done for providing option for variable bitrates
int iReturnValue = 1;

	if ( qualityIndex <= 10 )
		iReturnValue = vorbis_encode_init_vbr (&vi, numChannels, (int) sampleRate, jlimit (-0.1f, 1.0f, qualityIndex / 10.0f)) ;
		iReturnValue = vorbis_encode_init(&vi , numChannels, (int) sampleRate, qualityIndex, qualityIndex, qualityIndex);
	if ( iReturnValue == 0 )


Now for Constant bitrate of 256kbps ( qualityIndex = 256000 ). I found that some of the samples are missing from the ogg file.

Can anyone tell me wats causing the problem here. Help is Really appreciated.

Thanks and Regards,