29 #ifndef __AUDIOFILEREADER_H__
30 #define __AUDIOFILEREADER_H__
34 #ifdef HAVE_LIBAUDIOFILE
35 #include <audiofile.h>
54 type_name =
"AudioFileReader";
65 unsigned int load(
const string &_url );
69 afSeekFrame( file, AF_DEFAULT_TRACK, 0 );
74 return (
unsigned int ) afGetTrackBytes( file, AF_DEFAULT_TRACK );
80 return afGetChannels( file, AF_DEFAULT_TRACK );
86 return (
unsigned int) afGetRate( file, AF_DEFAULT_TRACK );
91 int sample_format, sample_width;
92 afGetVirtualSampleFormat( file, AF_DEFAULT_TRACK,
93 &sample_format, &sample_width );
99 return afGetFrameCount(file, AF_DEFAULT_TRACK) /
100 afGetRate(file, AF_DEFAULT_TRACK);
107 virtual unsigned int read(
char *buffer,
unsigned int size );
111 static bool supportsFileType(
const string &url );
Header file for H3DSoundFileNode, X3D scene-graph node.
AudioFileReader uses the Audio File Library ( http://www.68k.org/~michael/audiofile/ ) to read sound ...
Definition: AudioFileReader.h:48
virtual H3DTime duration()
The duration in seconds for the the PCM data.
Definition: AudioFileReader.h:98
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: AudioFileReader.h:114
virtual void reset()
Reset the stream to the beginning of the sound stream.
Definition: AudioFileReader.h:68
virtual unsigned int totalDataSize()
Returns the total size of the PCM data of the current stream.
Definition: AudioFileReader.h:73
virtual unsigned int bitsPerSample()
Returns the number of bits for a sample.
Definition: AudioFileReader.h:90
~AudioFileReader()
Destructor.
Definition: AudioFileReader.h:58
AudioFileReader()
Constructor.
Definition: AudioFileReader.h:52
virtual unsigned int samplesPerSecond()
Returns the number of samples per second for the current PCM data stream.
Definition: AudioFileReader.h:85
static FileReaderRegistration reader_registration
Register this node to the H3DSoundFileNodes available.
Definition: AudioFileReader.h:117
virtual unsigned int nrChannels()
Returns the number of channels per second for the current PCM data stream.
Definition: AudioFileReader.h:79
This abstract node type is used to derive node types that can stream PCM sound data from a file.
Definition: H3DSoundFileNode.h:46
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