30 #ifndef __OGGFILEREADER_H__
31 #define __OGGFILEREADER_H__
36 #include <vorbis/vorbisfile.h>
51 type_name =
"OggFileReader";
57 ov_clear( &ogg_file );
62 unsigned int load(
const string &_url );
66 return ov_time_total( &ogg_file, -1 );
71 ov_raw_seek( &ogg_file, 0 );
76 return (
unsigned int)( ov_pcm_total( &ogg_file, -1 ) * bitsPerSample() / 8 );
82 return info->channels;
94 virtual unsigned int read(
char *buffer,
unsigned int size );
104 static bool supportsFileType(
const string &url );
113 OggVorbis_File ogg_file;
119 vorbis_comment *comment;
Header file for H3DSoundFileNode, X3D scene-graph node.
This abstract node type is used to derive node types that can stream PCM sound data from a file.
Definition: H3DSoundFileNode.h:46
OggFileReader uses the libVorbis (http://www.vorbis.com) decoder library to support Ogg Vorbis files.
Definition: OggFileReader.h:45
virtual unsigned int totalDataSize()
Returns the total size of the PCM data of the current stream.
Definition: OggFileReader.h:75
virtual unsigned int samplesPerSecond()
Returns the number of samples per second for the current PCM data stream.
Definition: OggFileReader.h:98
virtual void reset()
Reset the stream to the beginning of the sound stream.
Definition: OggFileReader.h:70
OggFileReader()
Constructor.
Definition: OggFileReader.h:49
virtual unsigned int bitsPerSample()
Returns the number of bits for a sample.
Definition: OggFileReader.h:86
virtual H3DTime duration()
The duration in seconds for the the PCM data.
Definition: OggFileReader.h:65
virtual unsigned int nrChannels()
Returns the number of channels per second for the current PCM data stream.
Definition: OggFileReader.h:81
~OggFileReader()
Destructor.
Definition: OggFileReader.h:55
static FileReaderRegistration reader_registration
Register this node to the H3DSoundFileNodes available.
Definition: OggFileReader.h:110
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: OggFileReader.h:107
H3D API namespace.
Definition: Anchor.h:38
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194
Class used to register a class to the registered file readers.
Definition: H3DSoundFileNode.h:58