Engine::SoundSource Class Reference

Plays a sound. More...

#include <Audio.h>

List of all members.

Public Member Functions

 SoundSource (const SoundBuffer &buffer)
 Create attached to a specific buffer.
 ~SoundSource ()
void set_looping (bool loop=true)
 Make the sound either stop when it finishes or loop continuously.
void set_position (btVector3 position)
 Set the global position where the sound originates from.
void set_velocity (btVector3 velocity)
 Set the velocity of the sound for doppler shift.
void set_gain (ALfloat gain)
 Set how loud the noise is.
void set_pitch (ALfloat pitch)
void play ()
 Start making the noise.
void stop ()
 Stop making the noise.
const SoundBufferget_buffer () const

Private Member Functions

 SoundSource (const SoundSource &source)
SoundSourceoperator= (const SoundSource &source)

Private Attributes

const SoundBufferm_buffer
bool m_looping
ALfloat m_gain
ALfloat m_pitch
btVector3 m_position
btVector3 m_velocity
bool m_playing
bool m_started
 True if OpenAL started playing, false if it should start from the begining.

Friends

class Audio


Detailed Description

Plays a sound.

Makes a sound when play() is called. Deleting stops the noise. First load the sound you want using a SoundBuffer.

This is not directly a wrapper for openAL's sources. A SoundSource creates as many OpenAL sources as there are SoundListners. OpenAL is fixed to one listner.

Definition at line 162 of file Audio.h.


Constructor & Destructor Documentation

Engine::SoundSource::SoundSource ( const SoundBuffer buffer  ) 

Create attached to a specific buffer.

The buffer contains the sound that will be played, so don't delete it until you have deleted the SoundSource.

Definition at line 404 of file Audio.cpp.

Engine::SoundSource::~SoundSource (  ) 

Definition at line 417 of file Audio.cpp.

Engine::SoundSource::SoundSource ( const SoundSource source  )  [private]


Member Function Documentation

const SoundBuffer & Engine::SoundSource::get_buffer (  )  const

Definition at line 463 of file Audio.cpp.

SoundSource& Engine::SoundSource::operator= ( const SoundSource source  )  [private]

void Engine::SoundSource::play (  ) 

Start making the noise.

Definition at line 452 of file Audio.cpp.

void Engine::SoundSource::set_gain ( ALfloat  gain  ) 

Set how loud the noise is.

Parameters:
gain Gain for the sound. Must be positive.

Definition at line 442 of file Audio.cpp.

void Engine::SoundSource::set_looping ( bool  loop = true  ) 

Make the sound either stop when it finishes or loop continuously.

Parameters:
loop true to repeat, false to play once.

Definition at line 422 of file Audio.cpp.

void Engine::SoundSource::set_pitch ( ALfloat  pitch  ) 

Definition at line 447 of file Audio.cpp.

void Engine::SoundSource::set_position ( btVector3  position  ) 

Set the global position where the sound originates from.

Definition at line 432 of file Audio.cpp.

void Engine::SoundSource::set_velocity ( btVector3  velocity  ) 

Set the velocity of the sound for doppler shift.

Definition at line 437 of file Audio.cpp.

void Engine::SoundSource::stop (  ) 

Stop making the noise.

Definition at line 458 of file Audio.cpp.


Friends And Related Function Documentation

friend class Audio [friend]

Definition at line 164 of file Audio.h.


Member Data Documentation

const SoundBuffer& Engine::SoundSource::m_buffer [private]

Definition at line 196 of file Audio.h.

ALfloat Engine::SoundSource::m_gain [private]

Definition at line 199 of file Audio.h.

bool Engine::SoundSource::m_looping [private]

Definition at line 198 of file Audio.h.

ALfloat Engine::SoundSource::m_pitch [private]

Definition at line 200 of file Audio.h.

bool Engine::SoundSource::m_playing [private]

Definition at line 203 of file Audio.h.

btVector3 Engine::SoundSource::m_position [private]

Definition at line 201 of file Audio.h.

bool Engine::SoundSource::m_started [private]

True if OpenAL started playing, false if it should start from the begining.

Definition at line 207 of file Audio.h.

btVector3 Engine::SoundSource::m_velocity [private]

Definition at line 202 of file Audio.h.


The documentation for this class was generated from the following files:
Get Racer at SourceForge.net. Fast, secure and Free Open Source software downloads

Generated at Mon Sep 6 00:41:17 2010 by Doxygen version 1.4.7 for Racer version svn335.