Annwvyn::AnnAudioSource Class Reference

Represent an audio source in the engine. More...

#include <AnnAudioEngine.hpp>

Collaboration diagram for Annwvyn::AnnAudioSource:

Public Member Functions

 AnnAudioSource ()
 Private constructor. You have to call AnnAudioEngine::createAudioSource() to get an AnnAudioSource object. More...
 
 ~AnnAudioSource ()
 Destroy audio source. More...
 
void setPositon (AnnVect3 position)
 Put the audio source at this position in space. More...
 
void setVolume (float gain) const
 
void rewind () const
 Put the audio read position at the origin. More...
 
void play () const
 Play the sound. More...
 
void pause () const
 Pause the sound. More...
 
void stop () const
 Stop playing the sound. More...
 
void changeSound (std::string name)
 Change the sound buffer this source plays. More...
 
void setLooping (bool looping=true) const
 If looping is activated, the sound will replay when finished. More...
 
void setPositionRelToPlayer (bool relToPlayer=true)
 If true, the sound position will use (and update) the player's current position as origin. More...
 

Private Attributes

std::string bufferName
 Name of the buffer (filename) More...
 
ALuint source
 OpenAL source object. More...
 
AnnVect3 pos
 Position of this source. More...
 
bool posRelToPlayer
 Relative to player, or not. More...
 

Friends

class AnnAudioEngine
 

Detailed Description

Represent an audio source in the engine.

Definition at line 37 of file AnnAudioEngine.hpp.

Constructor & Destructor Documentation

◆ AnnAudioSource()

AnnAudioSource::AnnAudioSource ( )

Private constructor. You have to call AnnAudioEngine::createAudioSource() to get an AnnAudioSource object.

Definition at line 384 of file AnnAudioEngine.cpp.

◆ ~AnnAudioSource()

AnnAudioSource::~AnnAudioSource ( )

Destroy audio source.

Definition at line 391 of file AnnAudioEngine.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ changeSound()

void AnnAudioSource::changeSound ( std::string  name)

Change the sound buffer this source plays.

Definition at line 430 of file AnnAudioEngine.cpp.

Here is the call graph for this function:

◆ pause()

void AnnAudioSource::pause ( ) const

Pause the sound.

Definition at line 420 of file AnnAudioEngine.cpp.

◆ play()

void AnnAudioSource::play ( ) const

Play the sound.

Definition at line 415 of file AnnAudioEngine.cpp.

◆ rewind()

void AnnAudioSource::rewind ( ) const

Put the audio read position at the origin.

Definition at line 410 of file AnnAudioEngine.cpp.

◆ setLooping()

void AnnAudioSource::setLooping ( bool  looping = true) const

If looping is activated, the sound will replay when finished.

Definition at line 439 of file AnnAudioEngine.cpp.

◆ setPositionRelToPlayer()

void AnnAudioSource::setPositionRelToPlayer ( bool  relToPlayer = true)

If true, the sound position will use (and update) the player's current position as origin.

Definition at line 444 of file AnnAudioEngine.cpp.

◆ setPositon()

void AnnAudioSource::setPositon ( AnnVect3  position)

Put the audio source at this position in space.

Definition at line 399 of file AnnAudioEngine.cpp.

◆ setVolume()

void AnnAudioSource::setVolume ( float  gain) const

Set the volume at the given gain (between 0 & 1)

Parameters
gainvalue between 0 and 1

Definition at line 405 of file AnnAudioEngine.cpp.

◆ stop()

void AnnAudioSource::stop ( ) const

Stop playing the sound.

Definition at line 425 of file AnnAudioEngine.cpp.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ AnnAudioEngine

friend class AnnAudioEngine
friend

Definition at line 68 of file AnnAudioEngine.hpp.

Member Data Documentation

◆ bufferName

std::string Annwvyn::AnnAudioSource::bufferName
private

Name of the buffer (filename)

Definition at line 70 of file AnnAudioEngine.hpp.

◆ pos

AnnVect3 Annwvyn::AnnAudioSource::pos
private

Position of this source.

Definition at line 74 of file AnnAudioEngine.hpp.

◆ posRelToPlayer

bool Annwvyn::AnnAudioSource::posRelToPlayer
private

Relative to player, or not.

Definition at line 76 of file AnnAudioEngine.hpp.

◆ source

ALuint Annwvyn::AnnAudioSource::source
private

OpenAL source object.

Definition at line 72 of file AnnAudioEngine.hpp.


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