Wav to OGG - Samples missing, Missing samples while ogg convertion |
![]() ![]() |
Wav to OGG - Samples missing, Missing samples while ogg convertion |
Dec 15 2009, 13:40
Post
#1
|
|
|
Group: Members Posts: 1 Joined: 15-December 09 Member No.: 75970 |
Hi Everyone,
I M facing one problem in OGG Compression. I m trying to convert wav files to ogg files. But I found out that the OGG file i created has less samples than the original wav file. The code i used for compressing ogg is as follows. Can anyone please tell me where i m going wrong. bool write (const int** samplesToWrite, int numSamples) { if (numSamples > 0) { float** const vorbisBuffer = vorbis_analysis_buffer (&vd, numSamples); for (int i = numChannels; --i >= 0;) { float* const dst = vorbisBuffer[i]; const int* const src = samplesToWrite [i]; if (src != 0 && dst != 0) { for (int j = 0; j < numSamples; ++j) dst[j] = (float) src[j]; } } } vorbis_analysis_wrote (&vd, numSamples); while (vorbis_analysis_blockout (&vd, &vb) == 1) { vorbis_analysis (&vb, 0); vorbis_bitrate_addblock (&vb); while (vorbis_bitrate_flushpacket (&vd, &op)) { ogg_stream_packetin (&os, &op); for (;;) { if (ogg_stream_pageout (&os, &og) == 0) break; mywrite (og.header, og.header_len); mywrite (og.body, og.body_len); if (ogg_page_eos (&og)) break; } } } return true; } Thanks and regards Godwin |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 24th May 2013 - 03:19 |