Go to the documentation of this file.
17 #ifndef _GAZEBO_UTIL_OPENAL_HH_
18 #define _GAZEBO_UTIL_OPENAL_HH_
25 #include <ignition/math/Vector3.hh>
26 #include <ignition/math/Pose3.hh>
31 #include "gazebo/gazebo_config.h"
44 class OpenALSourcePrivate;
57 private:
virtual ~
OpenAL();
61 public:
bool Load(sdf::ElementPtr _sdf = sdf::ElementPtr());
79 public: std::set<std::string> DeviceList()
const;
83 private: std::unique_ptr<OpenALPrivate> dataPtr;
102 public:
bool SetPose(
const ignition::math::Pose3d &_pose);
107 public:
bool SetVelocity(
const ignition::math::Vector3d &_vel);
123 public:
bool Load(sdf::ElementPtr _sdf);
128 public:
bool SetPose(
const ignition::math::Pose3d &_pose);
133 public:
bool SetVelocity(
const ignition::math::Vector3d &_vel);
138 public:
bool SetPitch(
float _p);
143 public:
bool SetGain(
float _g);
148 public:
bool SetLoop(
bool _state);
155 public:
bool OnContact()
const;
160 public: std::vector<std::string> CollisionNames()
const;
165 public:
bool HasCollisionName(
const std::string &_name)
const;
171 public:
void Pause();
177 public:
void Rewind();
180 public:
bool IsPlaying();
187 public:
bool FillBufferFromPCM(uint8_t *_pcmData,
unsigned int _dataCount,
192 public:
void FillBufferFromFile(
const std::string &_audioFile);
196 private: std::unique_ptr<OpenALSourcePrivate> dataPtr;
bool SetLoop(bool _state)
Set whether the source loops the audio.
bool IsPlaying()
Is the audio playing.
Forward declarations for the common classes.
Definition: Animation.hh:26
virtual ~OpenALSource()
Destructor.
3D audio setup and playback.
Definition: OpenAL.hh:51
bool HasCollisionName(const std::string &_name) const
Get whether the source has a collision name set.
bool SetVelocity(const ignition::math::Vector3d &_vel)
Set the velocity of the source.
std::set< std::string > DeviceList() const
Get a list of available audio devices.
Singleton template class.
Definition: SingletonT.hh:33
std::shared_ptr< OpenALSource > OpenALSourcePtr
Definition: UtilTypes.hh:48
bool SetPose(const ignition::math::Pose3d &_pose)
Set the position of the source.
bool OnContact() const
Return true if the audio source is played on contact with another object.
OpenAL Listener. This can be thought of as a microphone.
Definition: OpenAL.hh:91
void Pause()
Pause a sound.
bool SetVelocity(const ignition::math::Vector3d &_vel)
Set the velocity of the sink.
bool FillBufferFromPCM(uint8_t *_pcmData, unsigned int _dataCount, int _sampleRate)
Fill the OpenAL audio buffer from PCM data.
virtual ~OpenALSink()
Destructor.
bool SetGain(float _g)
Set the pitch of the source.
void FillBufferFromFile(const std::string &_audioFile)
Fill the OpenAL audio buffer with data from a sound file.
std::shared_ptr< OpenALSink > OpenALSinkPtr
Definition: UtilTypes.hh:44
bool SetPitch(float _p)
Set the pitch of the source.
bool Load(sdf::ElementPtr _sdf=sdf::ElementPtr())
Load the OpenAL server.
OpenALSource()
Constructor.
OpenALSourcePtr CreateSource(sdf::ElementPtr _sdf)
Create an OpenALSource object.
void Rewind()
Rewind the sound to the beginning.
std::vector< std::string > CollisionNames() const
Get a vector of all the collision names.
bool SetPose(const ignition::math::Pose3d &_pose)
Set the position of the sink.
OpenAL Source. This can be thought of as a speaker.
Definition: OpenAL.hh:112
bool Load(sdf::ElementPtr _sdf)
Load the source from sdf.
OpenALSinkPtr CreateSink(sdf::ElementPtr _sdf)
Create an audio listener.