GluonAudio::Sound Class Reference

#include <sound.h>

Inheritance diagram for GluonAudio::Sound:
QObject

List of all members.

Classes

class  SoundPrivate

Public Slots

void play ()
void pause ()
void stop ()
void rewind ()
void setLoop (bool enabled=true)
void setPosition (QVector3D position)
void setPosition (ALfloat x=0.0, ALfloat y=0.0, ALfloat z=0.0)
void setVolume (ALfloat volume=1.0f)
void setPitch (ALfloat pitch=1.0f)
void setRadius (ALfloat radius=10000.0f)
void setMinVolume (ALfloat min=0.0f)
void setMaxVolume (ALfloat max=10.0f)
void setVelocity (ALfloat vx, ALfloat vy, ALfloat vz)
void setDirection (ALfloat dx, ALfloat dy, ALfloat dz)
void setTimePosition (ALfloat time)

Public Member Functions

 Sound (QObject *parent=0)
 Sound (const QString &soundFile, QObject *parent=0)
 Sound (Buffer *buffer, QObject *parent=0)
 Sound (ALuint buffer, QObject *parent=0)
void load (const QString &soundFile)
void load (Buffer *buffer)
void load (ALuint buffer)
 ~Sound ()
ALfloat elapsedTime () const
ALint status () const
bool isPlaying ()
bool isLooping ()
QString lastError () const
QVector3D position () const
ALfloat x () const
ALfloat y () const
ALfloat z () const
ALfloat volume () const
ALfloat pitch () const
ALfloat radius () const
ALfloat duration () const
ALuint source () const

Protected Member Functions

void setupSource ()

Detailed Description

Definition at line 34 of file sound.h.


Constructor & Destructor Documentation

Sound::Sound ( QObject parent = 0  ) 

Definition at line 67 of file sound.cpp.

Sound::Sound ( const QString &  soundFile,
QObject parent = 0 
) [explicit]

This is the default constructor

Parameters:
soundFile the path of the file to play

Definition at line 73 of file sound.cpp.

Sound::Sound ( Buffer buffer,
QObject parent = 0 
) [explicit]

This is the default constructor

Parameters:
KALBuffer the buffer

Definition at line 80 of file sound.cpp.

Sound::Sound ( ALuint  buffer,
QObject parent = 0 
) [explicit]

This is the default constructor

Parameters:
ALuint the buffer

Definition at line 87 of file sound.cpp.

Sound::~Sound (  ) 

Destructor

Definition at line 94 of file sound.cpp.


Member Function Documentation

ALfloat Sound::duration (  )  const

Definition at line 282 of file sound.cpp.

ALfloat Sound::elapsedTime (  )  const
Returns:
the time since the sound started playing

Definition at line 135 of file sound.cpp.

bool Sound::isLooping (  ) 

Definition at line 150 of file sound.cpp.

bool Sound::isPlaying (  ) 

Definition at line 157 of file sound.cpp.

QString GluonAudio::Sound::lastError (  )  const
Todo:
this function isn't defined!
Returns:
the last error reported
void Sound::load ( ALuint  buffer  ) 

Definition at line 111 of file sound.cpp.

void Sound::load ( Buffer buffer  ) 

Definition at line 105 of file sound.cpp.

void Sound::load ( const QString &  soundFile  ) 

Definition at line 99 of file sound.cpp.

void Sound::pause (  )  [slot]

Pauses the sound currently played

See also:
play, stop, rewind

Definition at line 240 of file sound.cpp.

ALfloat Sound::pitch (  )  const
Returns:
the pitch currently applied
See also:
setPitch

Definition at line 194 of file sound.cpp.

void Sound::play (  )  [slot]

Plays the sound file from the beginning or from the moment pause() was called

See also:
pause, stop, rewind

Definition at line 235 of file sound.cpp.

QVector3D Sound::position (  )  const
Returns:
the coordinates of the sound postion relative to the listener
See also:
setPosition, x ,y ,z

Definition at line 169 of file sound.cpp.

ALfloat Sound::radius (  )  const

Definition at line 199 of file sound.cpp.

void Sound::rewind (  )  [slot]

If the sound was paused, this will rewind it so that next time play() is called, it will play from the start

Definition at line 250 of file sound.cpp.

void Sound::setDirection ( ALfloat  dx,
ALfloat  dy,
ALfloat  dz 
) [slot]

Definition at line 271 of file sound.cpp.

void Sound::setLoop ( bool  enabled = true  )  [slot]

Makes the sound play in a loop when play() is called enabled play in a loop if set to true

See also:
play

Definition at line 164 of file sound.cpp.

void Sound::setMaxVolume ( ALfloat  max = 10.0f  )  [slot]

Specify the maximum index value of the volume,

Parameters:
max is 10.0f by default

Definition at line 260 of file sound.cpp.

void Sound::setMinVolume ( ALfloat  min = 0.0f  )  [slot]

Specify the minimum index value of the volume,

Parameters:
min is 0 by default

Definition at line 255 of file sound.cpp.

void Sound::setPitch ( ALfloat  pitch = 1.0f  )  [slot]

Specify the pitch to be applied, either at source, or on mixer results, at listener.

Parameters:
pitch a value between 0.5 and 2.0

Definition at line 223 of file sound.cpp.

void Sound::setPosition ( ALfloat  x = 0.0,
ALfloat  y = 0.0,
ALfloat  z = 0.0 
) [slot]

Definition at line 204 of file sound.cpp.

void Sound::setPosition ( QVector3D  position  )  [slot]

Set the position of the sound relative to the listener. This is used to create 3D sounds using effects to alter the perception of the sound origin. The three scalars of the vector correspond to x, y and z in the coordinate system.

The OpenAL documentation defines the underlying variable as: "Specify the current location in three dimensional space. OpenAL, like OpenGL, uses a right handed coordinate system, where in a frontal default view x (thumb) points right, y points up (index finger), and z points towards the viewer/camera (middle finger). To switch from a left handed coordinate system, flip the sign on the Z coordinate. Listener position is always in the world coordinate system."

Definition at line 210 of file sound.cpp.

void Sound::setRadius ( ALfloat  radius = 10000.0f  )  [slot]

Specify the distance from which the sound can no longer be heard

Parameters:
radius A length

Definition at line 229 of file sound.cpp.

void Sound::setTimePosition ( ALfloat  time  )  [slot]

Specify the current time position.

Parameters:
time must be inferior than duration.
See also:
duration()

Definition at line 277 of file sound.cpp.

void Sound::setupSource (  )  [protected]

Definition at line 118 of file sound.cpp.

void Sound::setVelocity ( ALfloat  vx,
ALfloat  vy,
ALfloat  vz 
) [slot]

Definition at line 265 of file sound.cpp.

void Sound::setVolume ( ALfloat  volume = 1.0f  )  [slot]

Change the volume (volume amplification) applied

The OpenAL documentation defines the underlying variable as: "A value of 1.0 means un-attenuated/unchanged. Each division by 2 equals an attenuation of -6dB. Each multiplicaton with 2 equals an amplification of +6dB. A value of 0.0 is meaningless with respect to a logarithmic scale; it is interpreted as zero volume - the channel is effectively disabled."

See also:
volume

Definition at line 217 of file sound.cpp.

ALuint Sound::source (  )  const

Definition at line 286 of file sound.cpp.

ALint Sound::status (  )  const
Returns:
the sound status

Definition at line 142 of file sound.cpp.

void Sound::stop (  )  [slot]

Stops the sound currently played

See also:
play, pause, rewind

Definition at line 245 of file sound.cpp.

ALfloat Sound::volume (  )  const
Returns:
the volume currently applied
See also:
setvolume

Definition at line 189 of file sound.cpp.

ALfloat Sound::x (  )  const
Returns:
the x coordinate of the sound position relative to the listener
See also:
setPosition, y, z

Definition at line 174 of file sound.cpp.

ALfloat Sound::y (  )  const
Returns:
the y coordinate of the sound position relative to the listener
See also:
setPosition, x, z

Definition at line 179 of file sound.cpp.

ALfloat Sound::z (  )  const
Returns:
the z coordinate of the sound position relative to the listener
See also:
setPosition, x, y

Definition at line 184 of file sound.cpp.


The documentation for this class was generated from the following files:
Generated on Mon Dec 27 13:13:42 2010 for Gluon by  doxygen 1.6.3