zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Zeni::Sound_Source_HW Class Reference

Plays Sound Data. More...

#include <Sound_Source.h>

Public Types

enum  STATE { STOPPED, PAUSED, PLAYING }
 

Public Member Functions

const Sound_Bufferget_buffer () const
 Get the Sound_Buffer. More...
 
float get_duration () const
 Get the duration of the Sound_Buffer in seconds. More...
 
float get_gain () const
 Get the gain. More...
 
float get_max_distance () const
 
float get_pitch () const
 Get the pitch. More...
 
Point3f get_position () const
 Get the position of the Sound_Buffer. More...
 
float get_reference_distance () const
 
float get_rolloff () const
 
STATE get_state () const
 Get PLAYING/PAUSED/STOPPED. More...
 
float get_time () const
 Get the current position in the Sound_Buffer, offset in seconds. More...
 
Vector3f get_velocity () const
 Get the velocity of the Sound_Buffer. More...
 
bool is_looping () const
 Check to see if the Sound_Buffer is set to loop back to the start once it is done playing. More...
 
bool is_paused () const
 Check to see if the Sound_Source_HW is paused. More...
 
bool is_playing () const
 Check to see if the Sound_Source_HW is playing. More...
 
bool is_stopped () const
 Check to see if the Sound_Source_HW is stopped. More...
 
void pause ()
 Pause the Sound_Source_HW. More...
 
void play ()
 Begin playing or unpause the Sound_Source_HW. More...
 
void set_buffer (const Sound_Buffer &buffer)
 Set the Sound_Buffer to be played. More...
 
void set_gain (const float &gain=ZENI_DEFAULT_GAIN)
 Set the gain. More...
 
void set_looping (const bool &looping)
 Set whether the Sound_Buffer should loop back to the start once it is done playing. More...
 
void set_max_distance (const float &max_distance=ZENI_DEFAULT_MAX_SOUND_DISTANCE)
 
void set_pitch (const float &pitch=ZENI_DEFAULT_PITCH)
 Set the pitch. More...
 
void set_position (const Point3f &position)
 Set the position of the Sound_Source_HW. More...
 
void set_reference_distance (const float &reference_distance=ZENI_DEFAULT_REFERENCE_DISTANCE)
 
void set_rolloff (const float &rolloff=ZENI_DEFAULT_ROLLOFF)
 
void set_time (const float &time)
 Set the current position in the Sound_Buffer, offset in seconds. More...
 
void set_velocity (const Vector3f &velocity)
 Set the velocity of the Sound_Source_HW for the doppler effect. More...
 
void stop ()
 Stop the Sound_Source_HW. (Essentially the same as pause but resets the current time.) More...
 

Friends

class Sound_Source_Pool
 

Detailed Description

Plays Sound Data.

This Sound_Source is directly tied to the OpenAL driver "hardware". This is the original Zeni::Sound_Source, which has been replaced by a much saner frontend to Sound_Source_Pool (which in turn manages the Sound_Source_HW objects).

Warning
Don't use this unless you find that you need to.
Author
bazald

Contact: bazal.nosp@m.d@ze.nosp@m.nipex.nosp@m..com

Definition at line 69 of file Sound_Source.h.

Member Enumeration Documentation

Enumerator
STOPPED 
PAUSED 
PLAYING 

Definition at line 87 of file Sound_Source.h.

Member Function Documentation

const Sound_Buffer & Zeni::Sound_Source_HW::get_buffer ( ) const

Get the Sound_Buffer.

Definition at line 245 of file Sound_Source.cpp.

References assert.

float Zeni::Sound_Source_HW::get_duration ( ) const

Get the duration of the Sound_Buffer in seconds.

Definition at line 250 of file Sound_Source.cpp.

References Zeni::Sound_Buffer::get_duration(), and Zeni::get_Sound().

Referenced by Zeni::Sound_Source::get_duration().

float Zeni::Sound_Source_HW::get_gain ( ) const

Get the gain.

Definition at line 270 of file Sound_Source.cpp.

References AL_GAIN, Zeni::Sound_Renderer_AL::alGetSourcef(), Zeni::get_Sound(), and ZENI_DEFAULT_GAIN.

Referenced by set_buffer().

float Zeni::Sound_Source_HW::get_max_distance ( ) const
float Zeni::Sound_Source_HW::get_pitch ( ) const

Get the pitch.

Definition at line 262 of file Sound_Source.cpp.

References AL_PITCH, Zeni::Sound_Renderer_AL::alGetSourcef(), and ZENI_DEFAULT_PITCH.

Point3f Zeni::Sound_Source_HW::get_position ( ) const

Get the position of the Sound_Buffer.

Definition at line 287 of file Sound_Source.cpp.

References AL_POSITION, and Zeni::Sound_Renderer_AL::alGetSourcefv().

float Zeni::Sound_Source_HW::get_reference_distance ( ) const
float Zeni::Sound_Source_HW::get_rolloff ( ) const
Sound_Source_HW::STATE Zeni::Sound_Source_HW::get_state ( ) const

Get PLAYING/PAUSED/STOPPED.

Definition at line 402 of file Sound_Source.cpp.

References AL_PAUSED, AL_PLAYING, AL_SOURCE_STATE, AL_STOPPED, Zeni::Sound_Renderer_AL::alGetSourcei(), Zeni::get_Sound(), PAUSED, PLAYING, and STOPPED.

Referenced by is_paused(), is_playing(), and is_stopped().

float Zeni::Sound_Source_HW::get_time ( ) const

Get the current position in the Sound_Buffer, offset in seconds.

Definition at line 321 of file Sound_Source.cpp.

References AL_SEC_OFFSET, Zeni::Sound_Renderer_AL::alGetSourcef(), and Zeni::get_Sound().

Referenced by Zeni::Sound_Source::get_time().

Vector3f Zeni::Sound_Source_HW::get_velocity ( ) const

Get the velocity of the Sound_Buffer.

Definition at line 295 of file Sound_Source.cpp.

References AL_VELOCITY, and Zeni::Sound_Renderer_AL::alGetSourcefv().

bool Zeni::Sound_Source_HW::is_looping ( ) const

Check to see if the Sound_Buffer is set to loop back to the start once it is done playing.

Definition at line 303 of file Sound_Source.cpp.

References AL_FALSE, AL_LOOPING, Zeni::Sound_Renderer_AL::alGetSourcei(), and Zeni::get_Sound().

Referenced by set_buffer().

bool Zeni::Sound_Source_HW::is_paused ( ) const

Check to see if the Sound_Source_HW is paused.

Definition at line 429 of file Sound_Source.cpp.

References get_state(), and PAUSED.

bool Zeni::Sound_Source_HW::is_playing ( ) const

Check to see if the Sound_Source_HW is playing.

Definition at line 425 of file Sound_Source.cpp.

References get_state(), and PLAYING.

bool Zeni::Sound_Source_HW::is_stopped ( ) const

Check to see if the Sound_Source_HW is stopped.

Definition at line 433 of file Sound_Source.cpp.

References get_state(), and STOPPED.

void Zeni::Sound_Source_HW::pause ( )
void Zeni::Sound_Source_HW::play ( )

Begin playing or unpause the Sound_Source_HW.

Definition at line 362 of file Sound_Source.cpp.

References Zeni::Sound_Renderer_AL::alSourcePlay(), Zeni::get_Sound(), and ZENI_LOGD().

Referenced by Zeni::Sound_Source::play().

void Zeni::Sound_Source_HW::set_buffer ( const Sound_Buffer buffer)
void Zeni::Sound_Source_HW::set_gain ( const float &  gain = ZENI_DEFAULT_GAIN)

Set the gain.

Definition at line 144 of file Sound_Source.cpp.

References AL_GAIN, Zeni::Sound_Renderer_AL::alSourcef(), Zeni::get_Sound(), and max.

Referenced by Zeni::Sound_Source::set_gain().

void Zeni::Sound_Source_HW::set_looping ( const bool &  looping)

Set whether the Sound_Buffer should loop back to the start once it is done playing.

Definition at line 181 of file Sound_Source.cpp.

References AL_LOOPING, Zeni::Sound_Renderer_AL::alSourcei(), and Zeni::get_Sound().

Referenced by Zeni::Sound_Source::set_looping().

void Zeni::Sound_Source_HW::set_max_distance ( const float &  max_distance = ZENI_DEFAULT_MAX_SOUND_DISTANCE)
void Zeni::Sound_Source_HW::set_pitch ( const float &  pitch = ZENI_DEFAULT_PITCH)

Set the pitch.

Definition at line 134 of file Sound_Source.cpp.

References AL_PITCH, and Zeni::Sound_Renderer_AL::alSourcef().

Referenced by Zeni::Sound_Source::set_pitch().

void Zeni::Sound_Source_HW::set_position ( const Point3f position)

Set the position of the Sound_Source_HW.

Definition at line 161 of file Sound_Source.cpp.

References AL_POSITION, and Zeni::Sound_Renderer_AL::alSourcefv().

Referenced by Zeni::Sound_Source::set_position().

void Zeni::Sound_Source_HW::set_reference_distance ( const float &  reference_distance = ZENI_DEFAULT_REFERENCE_DISTANCE)
void Zeni::Sound_Source_HW::set_rolloff ( const float &  rolloff = ZENI_DEFAULT_ROLLOFF)
void Zeni::Sound_Source_HW::set_time ( const float &  time)

Set the current position in the Sound_Buffer, offset in seconds.

Definition at line 198 of file Sound_Source.cpp.

References AL_SEC_OFFSET, Zeni::Sound_Renderer_AL::alSourcef(), and Zeni::get_Sound().

Referenced by Zeni::Sound_Source::set_time().

void Zeni::Sound_Source_HW::set_velocity ( const Vector3f velocity)

Set the velocity of the Sound_Source_HW for the doppler effect.

Definition at line 171 of file Sound_Source.cpp.

References AL_VELOCITY, and Zeni::Sound_Renderer_AL::alSourcefv().

Referenced by Zeni::Sound_Source::set_velocity().

void Zeni::Sound_Source_HW::stop ( )

Stop the Sound_Source_HW. (Essentially the same as pause but resets the current time.)

Definition at line 389 of file Sound_Source.cpp.

References Zeni::Sound_Renderer_AL::alSourceStop(), and Zeni::get_Sound().

Referenced by Zeni::Sound_Source::stop().

Friends And Related Function Documentation

friend class Sound_Source_Pool
friend

Definition at line 70 of file Sound_Source.h.


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