QSDK 1.1 Documentation
Main Page | Modules | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

Q::SimpleSound Struct Reference
[Audio]

Non-positional audio playback. More...

#include <Q/q.h>

Inheritance diagram for Q::SimpleSound:

Q::Object Q::ObjectBase List of all members.

Public Member Functions

 SimpleSound ()
 SimpleSound (const char *name)
Sample sample () const
float volume () const
float fadeIn () const
float fadeOut () const
bool playing () const
AudioEffect audioEffect () const
Utils::Result setVolume (float)
Utils::Result setFade (float in, float out)
Utils::Result setSample (const Sample &)
Utils::Result setAudioEffect (const AudioEffect &)
Utils::Result play (bool looping, bool remove=false)
Utils::Result stop ()
Utils::Result getFilename (Q::Text *) const

Static Public Member Functions

SimpleSound create (const char *name, const Database &db=Database())
SimpleSound createFromFile (const char *filename)
SimpleSound find (const char *name)
ClassType classType ()
SimpleSound cast (const ObjectBase &)

Detailed Description

Non-positional audio playback.

A SimpleSound object represents a non-directional sound emitter. A SimpleSound object has a default volume of 0.0f, a default fade in of 0.0f and a default fade out of 0.0f

See also:
Sound, SoundInstance, Environment, AudioEffect.

QDemo2 production guide for guidance on how to build and import sound files in Q files.


Constructor & Destructor Documentation

Q::SimpleSound::SimpleSound  )  [inline]
 

Create a null SimpleSound reference

Q::SimpleSound::SimpleSound const char *  name  ) 
 

Search the currently attached databases for a simple sound with the given name.


Member Function Documentation

AudioEffect Q::SimpleSound::audioEffect  )  const
 

Return the effect of this sound.

SimpleSound Q::SimpleSound::cast const ObjectBase  )  [static]
 

If the object referenced by obj is a simple sound, then return a suitable SimpleSound reference to the object.

Note:
Casting this object will cause it to be loaded from the database if it is not currently resident.

ClassType Q::SimpleSound::classType  )  [static]
 

Return the type for this class.

SimpleSound Q::SimpleSound::create const char *  name,
const Database db = Database()
[static]
 

Create a new simple sound named name in the given databse, db, (or the most recently attached read-write database if db is null).

SimpleSound Q::SimpleSound::createFromFile const char *  filename  )  [static]
 

Create a lightweight simple sound whose audio source comes from a file with the specified filename.

float Q::SimpleSound::fadeIn  )  const
 

Return the time taken to go from silence up to playback volume when the SimpleSound starts playing.

Note:
The silence volume is returned by SpeakerSet::silenceVolume.

float Q::SimpleSound::fadeOut  )  const
 

Return the time taken to go from playback volume to silence when SimpleSound::stop is called or when the playback reaches its end.

Note:
The silence volume is returned by SpeakerSet::silenceVolume.

SimpleSound Q::SimpleSound::find const char *  name  )  [static]
 

Search the currently attached databases for a SimpleSound with the given name and return that object, if it exists.

Utils::Result Q::SimpleSound::getFilename Q::Text  )  const
 

If the SimpleSound was created by SimpleSound::createFromFile, the method returns Utils::Success and the parameter gets passed the value of the filename. Otherwise, the method returns Utils::Failure.

Utils::Result Q::SimpleSound::play bool  looping,
bool  remove = false
 

Start playing the sound. If remove is true, the SimpleSound object will be destroyed when the playback finishes or stop() is called.

Warning:
This feature is not yet implemented.

bool Q::SimpleSound::playing  )  const
 

Query whether the sound is playing.

Sample Q::SimpleSound::sample  )  const
 

Obtain the sample associated with this SimpleSound.

Note:
if the SimpleSound was created by SimpleSound::createFromFile, the result will be invalid.
See also:
getFilename.

Utils::Result Q::SimpleSound::setAudioEffect const AudioEffect  ) 
 

Set the effect of this sound.

Utils::Result Q::SimpleSound::setFade float  in,
float  out
 

Set the fading times (in and out). The parameter in indicates the time taken to go from silence up to playback volume when the SimpleSound starts playing. The parameter out indicates the time taken to go from playback volume to silence when SimpleSound::stop is called or when the playback reaches its end. In the latter case, the playback starts fading out when the time left to play is less than out.

Note:
The silence volume is returned by SpeakerSet::silenceVolume.

Utils::Result Q::SimpleSound::setSample const Sample  ) 
 

Set the sample to use.

Utils::Result Q::SimpleSound::setVolume float   ) 
 

Set the volume of the sound. The volume is represented as an attenuation in decibels (dBFS).

Note:
To set the volume to be silence, use SpeakerSet::silenceVolume.

Utils::Result Q::SimpleSound::stop  ) 
 

Stop the sound.

float Q::SimpleSound::volume  )  const
 

Return the sound's volume (in dBFS).

Return to QSDK documentation Contents page. Contact details for support, information and fault-reporting.
Qube Software Limited © 2000-2004