Game Development Reference
In-Depth Information
20. The FBitsPerSample structure is set to 16 bits, and later we tell the decoder to
output the sound data as a 16 bit signal:
FBitsPerSample = 16;
}
21. In the destructor, FVorbisFile is cleared:
virtual ~OggProvider() { OGG_ov_clear( &FVorbisFile ); }
22. The ReadFromFile() function uses the OGG library for stream decoding:
virtual int ReadFromFile(int Size, int BytesRead)
{
return (int)OGG_ov_read( &FVorbisFile,
&FBuffer[0] + BytesRead,
Size - BytesRead,
23. Here, we assume that we are running on a little-endian CPU, such as Intel Atom, Intel
Core, or some other ARM processor usually encountered in mobile Android devices
( http://en.wikipedia.org/wiki/Endianness ). If this is not the case, for
example, the processor is a PowerPC or MIPS in a big-endian mode, you should
provide 1 as an argument to the OGG_ov_read() function:
0, // 0 for LITTLE_ENDIAN, 1 for BIG_ENDIAN
FBitsPerSample >> 3,
1,
&FOGGCurrentSection );
}
24. The Seek() member function rewinds the stream to the speciied time:
virtual void Seek( float Time )
{
FEof = false;
OGG_ov_time_seek( &FVorbisFile, Time );
}
25. At the end of the class deinition, the OGG_Callbacks.h ile is included where
static callback functions are implemented:
private:
#include "OGG_Callbacks.h"
};
26. The functions in the OGG_Callbacks.h ile implement a FILE* -like interface,
which the OGG library uses to read our memory block. We pass an instance of
OggProvider as the void* DataSource argument in all of these functions.
27. The OGG_ReadFunc() function reads the speciied number of bytes and checks
for the end of the data:
 
Search WWH ::




Custom Search