Mastering Android NDK by Kosarevsky Sergey & Latypov Viktor

Mastering Android NDK by Kosarevsky Sergey & Latypov Viktor

Author:Kosarevsky, Sergey & Latypov, Viktor
Language: eng
Format: epub
Publisher: Packt Publishing
Published: 2015-09-29T16:00:00+00:00


The stream parameters, like the number of channels, sampling rate and bits per sample, are retrieved here:

vorbis_info* VorbisInfo = OGG_ov_info ( &FVorbisFile, -1 ); FChannels = VorbisInfo->channels; FSamplesPerSec = VorbisInfo->rate; FBitsPerSample = 16; }

The destructor is trivial:

virtual ~clOggProvider() { OGG_ov_clear( &FVorbisFile ); }

The ReadFromFile() and Seek() methods are pretty much similar in spirit to what we have done when dealing with MiniMP3:

virtual int ReadFromFile( int Size, int BytesRead ) override { return ( int )OGG_ov_read( &FVorbisFile, &FBuffer[0] + BytesRead, Size - BytesRead, 0, FBitsPerSample / 8, 1, &FOGGCurrentSection ); } virtual void Seek( float Time ) override { FEof = false; OGG_ov_time_seek( &FVorbisFile, Time ); } private:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.