Main Page   Namespace List   Class Hierarchy   Compound List   Namespace Members   Compound Members   Related Pages  

Audio Class Reference

Play audio clips. More...

List of all members.


Public Methods

 Audio (const std::string &url, Doc *relative=0)
 Constructor.

 ~Audio ()
 Destructor.

bool setURL (const std::string &url, Doc *relative=0)
 Set the URL of the audio file and read it from the document object.

bool tryURLs (const MFString &urls, Doc *relative=0)
 Try a list of URLs.

const char * url () const
 Get the URL of the clip.

AudioEncoding encoding () const
int channels () const
int bitsPerSample () const
int samplesPerSec () const
int sampleBlockSize () const
int numSamples () const
int numBytes () const
const unsigned char * samples () const
double duration () const
int getByteIndex (double time_index) const

Private Methods

bool wavread (FILE *fp)
 Read a WAV file.


Private Attributes

Doc_doc
AudioEncoding _encoding
int _channels
int _bits_per_sample
int _samples_per_sec
int _sample_blocksize
int _num_samples
unsigned char * _samples

Detailed Description

Play audio clips.


Constructor & Destructor Documentation

Audio const std::string &    url,
Doc   relative = 0
[explicit]
 

Constructor.

Parameters:
url URL string.
relative Doc object.

~Audio  
 

Destructor.


Member Function Documentation

bool setURL const std::string &    url,
Doc   relative = 0
 

Set the URL of the audio file and read it from the document object.

Parameters:
url URL string.
relative Doc object.
Returns:
true if the URL was read; false otherwise.

bool tryURLs const MFString   urls,
Doc   relative = 0
 

Try a list of URLs.

Parameters:
urls list of URLs.
relative Doc object.

const char * url   const
 

Get the URL of the clip.

Returns:
the URL, or 0 if none exists.

bool wavread FILE *    fp [private]
 

Read a WAV file.

Parameters:
fp file handle.
Returns:
true if the read succeeded; false otherwise.