All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | List of all members
gazebo::util::OpenALSource Class Reference

OpenAL Source. More...

#include <OpenAL.hh>

Public Member Functions

 OpenALSource ()
 Constructor. More...
 
virtual ~OpenALSource ()
 Destructor. More...
 
void FillBufferFromFile (const std::string &_audioFile)
 Fill the OpenAL audio buffer with data from a sound file. More...
 
bool FillBufferFromPCM (uint8_t *_pcmData, unsigned int _dataCount, int _sampleRate)
 Fill the OpenAL audio buffer from PCM data. More...
 
std::vector< std::string > GetCollisionNames () const
 Get a vector of all the collision names. More...
 
bool GetOnContact () const
 Return true if the audio source is played on contact with another object. More...
 
bool HasCollisionName (const std::string &_name) const
 Get whether the source has a collision name set. More...
 
bool IsPlaying ()
 Is the audio playing. More...
 
bool Load (sdf::ElementPtr _sdf)
 Load the source from sdf. More...
 
void Pause ()
 Pause a sound. More...
 
void Play ()
 Play a sound. More...
 
void Rewind ()
 Rewind the sound to the beginning. More...
 
bool SetGain (float _g)
 Set the pitch of the source. More...
 
bool SetLoop (bool _state)
 Set whether the source loops the audio. More...
 
bool SetPitch (float _p)
 Set the pitch of the source. More...
 
bool SetPose (const math::Pose &_pose)
 Set the position of the source. More...
 
bool SetVelocity (const math::Vector3 &_vel)
 Set the velocity of the source. More...
 
void Stop ()
 Stop a sound. More...
 

Detailed Description

OpenAL Source.

This can be thought of as a speaker.

Constructor & Destructor Documentation

gazebo::util::OpenALSource::OpenALSource ( )

Constructor.

virtual gazebo::util::OpenALSource::~OpenALSource ( )
virtual

Destructor.

Member Function Documentation

void gazebo::util::OpenALSource::FillBufferFromFile ( const std::string &  _audioFile)

Fill the OpenAL audio buffer with data from a sound file.

Parameters
[in]_audioFileName and an audio file.
bool gazebo::util::OpenALSource::FillBufferFromPCM ( uint8_t *  _pcmData,
unsigned int  _dataCount,
int  _sampleRate 
)

Fill the OpenAL audio buffer from PCM data.

Parameters
[in]_pcmDataPointer to the PCM audio data.
[in]_dataCountSize of the PCM data.
[in]_sampleRateSample rate for the PCM data.
Returns
True on success.
std::vector<std::string> gazebo::util::OpenALSource::GetCollisionNames ( ) const

Get a vector of all the collision names.

Returns
All the collision names used to trigger audio playback on contact.
bool gazebo::util::OpenALSource::GetOnContact ( ) const

Return true if the audio source is played on contact with another object.

Contact is determine based on a set of collision objects.

Returns
True if audio is played on contact.
See Also
AddCollision()
bool gazebo::util::OpenALSource::HasCollisionName ( const std::string &  _name) const

Get whether the source has a collision name set.

Parameters
[in]_nameName of a collision to check for.
Returns
True if the collision name was found.
bool gazebo::util::OpenALSource::IsPlaying ( )

Is the audio playing.

bool gazebo::util::OpenALSource::Load ( sdf::ElementPtr  _sdf)

Load the source from sdf.

Parameters
[in]_sdfSDF element parameters for an audio_source.
Returns
True on success.
void gazebo::util::OpenALSource::Pause ( )

Pause a sound.

void gazebo::util::OpenALSource::Play ( )

Play a sound.

void gazebo::util::OpenALSource::Rewind ( )

Rewind the sound to the beginning.

bool gazebo::util::OpenALSource::SetGain ( float  _g)

Set the pitch of the source.

Parameters
[in]_gGain value.
Returns
True on success.
bool gazebo::util::OpenALSource::SetLoop ( bool  _state)

Set whether the source loops the audio.

Parameters
[in]_stateTrue to cause playback to loop.
Returns
True on success.
bool gazebo::util::OpenALSource::SetPitch ( float  _p)

Set the pitch of the source.

Parameters
[in]_pPitch value.
Returns
True on success.
bool gazebo::util::OpenALSource::SetPose ( const math::Pose _pose)

Set the position of the source.

Parameters
[in]_poseNew pose of the source.
Returns
True on success.
bool gazebo::util::OpenALSource::SetVelocity ( const math::Vector3 _vel)

Set the velocity of the source.

Parameters
[in]_velNew velocity of the source.
Returns
True on success.
void gazebo::util::OpenALSource::Stop ( )

Stop a sound.


The documentation for this class was generated from the following file: