zenilib
0.5.3.0
|
#include <Sound_Source.h>
Public Member Functions | |
Sound_Source () | |
Sound_Source (const Sound_Buffer &buffer, const float &pitch=ZENI_DEFAULT_PITCH, const float &gain=ZENI_DEFAULT_GAIN, const Point3f &position=Point3f(), const Vector3f &velocity=Vector3f(), const bool &looping=false) | |
~Sound_Source () | |
float | calculate_gain (const Point3f &listener_position) const |
Get the actual volume gain, given gain+position+near_clamp+far_clamp+rolloff. More... | |
const Sound_Buffer & | get_buffer () const |
Get the Sound_Buffer's OpenAL id. 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... | |
int | get_priority () const |
Get the Sound_Source's priority. More... | |
float | get_reference_distance () const |
float | get_rolloff () const |
float | get_time () const |
Get the current position in the Sound_Buffer, offset in seconds. More... | |
Time_HQ | get_unstop_time () const |
Get the Time_HQ at which the Sound_Source was most recently played or unpaused. More... | |
Vector3f | get_velocity () const |
Get the velocity of the Sound_Buffer. More... | |
bool | is_assigned () const |
Check to see if the Sound_Source is assigned to actual hardware. 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 is paused. More... | |
bool | is_playing () const |
Check to see if the Sound_Source is playing. More... | |
bool | is_stopped () const |
Check to see if the Sound_Source is stopped. More... | |
void | pause () |
Pause the Sound_Source. More... | |
void | play () |
Begin playing or unpause the Sound_Source. 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. More... | |
void | set_priority (const int &priority=ZENI_DEFAULT_SOUND_PRIORITY) |
Set the priority that this Sound_Source should have. Higher numbers are more likely to be selected for play. 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 for the doppler effect. More... | |
void | stop () |
Stop the Sound_Source. (Essentially the same as pause but resets the current time.) More... | |
Friends | |
class | Sound_Source_Pool |
Plays Sound Data.
A Sound_Source plays sound data from a Sound_Buffer. The term comes from the idea that OpenAL is built for 3D positional sound. A Sound_Source is defined by the Sound_Buffer it is playing as well as its position, velocity, and several other factors.
Contact: bazal d@ze nipex .com
Definition at line 147 of file Sound_Source.h.
Zeni::Sound_Source::Sound_Source | ( | ) |
Definition at line 529 of file Sound_Source.cpp.
References Zeni::get_Sound_Source_Pool().
Zeni::Sound_Source::Sound_Source | ( | const Sound_Buffer & | buffer, |
const float & | pitch = ZENI_DEFAULT_PITCH , |
||
const float & | gain = ZENI_DEFAULT_GAIN , |
||
const Point3f & | position = Point3f() , |
||
const Vector3f & | velocity = Vector3f() , |
||
const bool & | looping = false |
||
) |
Definition at line 549 of file Sound_Source.cpp.
References Zeni::get_Sound_Source_Pool().
Zeni::Sound_Source::~Sound_Source | ( | ) |
Definition at line 576 of file Sound_Source.cpp.
References Zeni::get_Sound_Source_Pool().
Get the actual volume gain, given gain+position+near_clamp+far_clamp+rolloff.
Definition at line 611 of file Sound_Source.cpp.
Referenced by Zeni::Sound_Source_Pool::Positional_Replacement_Policy::operator()().
|
inline |
Get the Sound_Buffer's OpenAL id.
Definition at line 62 of file Sound_Source.hxx.
References assert.
|
inline |
Get the duration of the Sound_Buffer in seconds.
Definition at line 63 of file Sound_Source.hxx.
References Zeni::Sound_Source_HW::get_duration().
Referenced by get_time().
|
inline |
Get the gain.
Definition at line 65 of file Sound_Source.hxx.
Referenced by Zeni::Sound_Source_Pool::Replacement_Policy::operator()().
|
inline |
Definition at line 70 of file Sound_Source.hxx.
|
inline |
Get the pitch.
Definition at line 64 of file Sound_Source.hxx.
|
inline |
Get the position of the Sound_Buffer.
Definition at line 66 of file Sound_Source.hxx.
|
inline |
Get the Sound_Source's priority.
Definition at line 60 of file Sound_Source.hxx.
Referenced by Zeni::Sound_Source_Pool::Replacement_Policy::operator()(), and Zeni::Sound_Source_Pool::Positional_Replacement_Policy::operator()().
|
inline |
Definition at line 69 of file Sound_Source.hxx.
|
inline |
Definition at line 71 of file Sound_Source.hxx.
float Zeni::Sound_Source::get_time | ( | ) | const |
Get the current position in the Sound_Buffer, offset in seconds.
Definition at line 581 of file Sound_Source.cpp.
References get_duration(), Zeni::Time_HQ::get_seconds_since(), and Zeni::Sound_Source_HW::get_time().
|
inline |
Get the Time_HQ at which the Sound_Source was most recently played or unpaused.
Definition at line 61 of file Sound_Source.hxx.
Referenced by Zeni::Sound_Source_Pool::Replacement_Policy::operator()(), and Zeni::Sound_Source_Pool::Positional_Replacement_Policy::operator()().
|
inline |
Get the velocity of the Sound_Buffer.
Definition at line 67 of file Sound_Source.hxx.
|
inline |
Check to see if the Sound_Source is assigned to actual hardware.
Definition at line 81 of file Sound_Source.hxx.
Referenced by Zeni::Sound_Source_Pool::update().
|
inline |
Check to see if the Sound_Buffer is set to loop back to the start once it is done playing.
Definition at line 68 of file Sound_Source.hxx.
|
inline |
Check to see if the Sound_Source is paused.
Definition at line 78 of file Sound_Source.hxx.
|
inline |
Check to see if the Sound_Source is playing.
Definition at line 77 of file Sound_Source.hxx.
Referenced by Zeni::Sound_Source_Pool::Replacement_Policy::operator()(), Zeni::Sound_Source_Pool::Positional_Replacement_Policy::operator()(), and Zeni::Sound::set_BGM().
|
inline |
Check to see if the Sound_Source is stopped.
Definition at line 79 of file Sound_Source.hxx.
|
inline |
Pause the Sound_Source.
Definition at line 74 of file Sound_Source.hxx.
References Zeni::Sound_Source_HW::pause(), Zeni::Sound_Source_HW::PAUSED, and Zeni::Time_HQ::update().
|
inline |
Begin playing or unpause the Sound_Source.
Definition at line 73 of file Sound_Source.hxx.
References Zeni::Sound_Source_HW::play(), Zeni::Sound_Source_HW::PLAYING, and Zeni::Time_HQ::update().
Referenced by Zeni::Sound::set_BGM().
|
inline |
Set the Sound_Buffer to be played.
Definition at line 40 of file Sound_Source.hxx.
References Zeni::Sound_Source_HW::set_buffer().
Referenced by Zeni::Sound::set_BGM().
|
inline |
Set the gain.
Definition at line 42 of file Sound_Source.hxx.
References Zeni::Sound_Source_HW::set_gain().
Set whether the Sound_Buffer should loop back to the start once it is done playing.
Definition at line 45 of file Sound_Source.hxx.
References Zeni::Sound_Source_HW::set_looping().
|
inline |
Definition at line 57 of file Sound_Source.hxx.
References Zeni::Sound_Source_HW::set_max_distance().
|
inline |
Set the pitch.
Definition at line 41 of file Sound_Source.hxx.
References Zeni::Sound_Source_HW::set_pitch().
Set the position of the Sound_Source.
Definition at line 43 of file Sound_Source.hxx.
References Zeni::Sound_Source_HW::set_position().
|
inline |
Set the priority that this Sound_Source should have. Higher numbers are more likely to be selected for play.
Definition at line 39 of file Sound_Source.hxx.
|
inline |
Definition at line 56 of file Sound_Source.hxx.
References Zeni::Sound_Source_HW::set_reference_distance().
|
inline |
Definition at line 58 of file Sound_Source.hxx.
References Zeni::Sound_Source_HW::set_rolloff().
Set the current position in the Sound_Buffer, offset in seconds.
Definition at line 47 of file Sound_Source.hxx.
References Zeni::Sound_Source_HW::set_time(), and Zeni::Time_HQ::update().
Referenced by Zeni::Sound::set_BGM().
Set the velocity of the Sound_Source for the doppler effect.
Definition at line 44 of file Sound_Source.hxx.
References Zeni::Sound_Source_HW::set_velocity().
|
inline |
Stop the Sound_Source. (Essentially the same as pause but resets the current time.)
Definition at line 75 of file Sound_Source.hxx.
References Zeni::Sound_Source_HW::stop(), and Zeni::Sound_Source_HW::STOPPED.
Referenced by Zeni::Sound::set_BGM().
|
friend |
Definition at line 148 of file Sound_Source.h.