zenilib: Zeni::Sound Class Reference

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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

The Sound Singleton. More...

`#include <Sound.h>`

Inherits Zeni::Singleton< Sound >.

## Public Member Functions

float | get_BGM_gain ()
| Get the gain. More...
float | get_BGM_pitch ()
| Get the pitch. More...
float | get_BGM_time ()
| Get the current position in the BGM, offset in seconds. More...
Sound_Buffer & | get_Hello_World_Buffer () const
| Initialize m_bgm if needed and return a corresponding Sound_Source. More...
std::pair< Vector3f, Vector3f > | get_listener_forward_and_up () const
| Set the orientation of the listener. More...
float | get_listener_gain () const
| Get the listener gain. More...
Point3f | get_listener_position () const
| Get the position of the listener and BGM. More...
Vector3f | get_listener_velocity () const
| Get the velocity of the listener and BGM. More...
Sound_Renderer & | get_Renderer ()
| Get the current Sound_Renderer. More...
bool | is_BGM_looping ()
| Check to see if the BGM is set to loop back to the start once it is done playing. More...
bool | is_listener_muted () const
| Is the listener muted. More...
void | pause_BGM ()
| Pause BackGround Music. More...
bool | paused_BGM ()
| Check to see if BackGround Music is paused. More...
void | play_BGM ()
| Begin Playing BackGround Music. More...
bool | playing_BGM ()
| Check to see if BackGround Music is playing. More...
void | set_BGM (const String &filename)
| Set BackGround Music. More...
void | set_BGM_gain (const float &gain)
| Set the gain. More...
void | set_BGM_looping (const bool &looping)
| Set whether the BGM should loop back to the start once it is done playing. More...
void | set_BGM_pitch (const float &pitch)
| Set the pitch. More...
void | set_BGM_time (const float &time)
| Set the current position in the BGM, offset in seconds. More...
void | set_listener_forward_and_up (const Vector3f &forward, const Vector3f &up)
| Set the orientation of the listener. More...
void | set_listener_gain (const float &gain)
| Set the listener gain. More...
void | set_listener_muted (const bool &muted)
| Set whether the listener is muted. More...
void | set_listener_position (const Point3f &position)
| Set the position of the listener and BGM. More...
void | set_listener_velocity (const Vector3f &velocity)
| Set the velocity of the listener and BGM for the doppler effect. More...
void | stop_BGM ()
| Stop BackGround Music. More...
bool | stopped_BGM ()
| Check to see if BackGround Music is stopped. More...
void | update ()
| Update background music, as needed. More...
Public Member Functions inherited from Zeni::Singleton< Sound >
void | fax_post_reinit (Event::Handler *const &handler)
void | fax_pre_uninit (Event::Handler *const &handler)
void | give_post_reinit (Event::Handler *const &handler)
void | give_pre_uninit (Event::Handler *const &handler)
void | lend_post_reinit (Event::Handler *const &handler)
void | lend_pre_uninit (Event::Handler *const &handler)

## Friends

class | Singleton< Sound >

## Additional Inherited Members

Static Public Member Functions inherited from Zeni::Singleton< Sound >
static void | completely_destroy ()
static void | destroy ()
static Sound & | get ()
static bool | is_initialized ()
static void | remove_post_reinit (Event::Handler *const &handler)
static void | remove_pre_uninit (Event::Handler *const &handler)
Protected Member Functions inherited from Zeni::Singleton< Sound >
| Singleton ()
virtual | ~Singleton ()

## Detailed Description

The Sound Singleton.

The Sound Singleton is responsible for initializing and uninitializing OpenAL. It also controls a single Sound_Source that is positioned at the listener's current location so as to allow the playing of background music.

Author
  bazald

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

Definition at line 53 of file Sound.h.

## Member Function Documentation

float Zeni::Sound::get_BGM_gain | ( |  | ) |

inline

Get the gain.

Definition at line 99 of file Sound.hxx.

References Zeni::Sound_Stream_AL::get_gain(), and ZENI_DEFAULT_GAIN.

float Zeni::Sound::get_BGM_pitch | ( |  | ) |

inline

Get the pitch.

Definition at line 90 of file Sound.hxx.

References Zeni::Sound_Stream_AL::get_pitch(), and ZENI_DEFAULT_PITCH.

float Zeni::Sound::get_BGM_time | ( |  | ) |

inline

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

Definition at line 117 of file Sound.hxx.

References Zeni::Sound_Stream_AL::get_time().

Sound_Buffer & Zeni::Sound::get_Hello_World_Buffer | ( |  | ) | const

Initialize m_bgm if needed and return a corresponding Sound_Source.

Definition at line 193 of file Sound.cpp.

Referenced by set_BGM().

std::pair< Vector3f, Vector3f > Zeni::Sound::get_listener_forward_and_up | ( |  | ) | const

Set the orientation of the listener.

Definition at line 138 of file Sound.cpp.

References Zeni::Sound_Renderer::get_listener_forward_and_up().

float Zeni::Sound::get_listener_gain | ( |  | ) | const

inline

Get the listener gain.

Definition at line 34 of file Sound.hxx.

Point3f Zeni::Sound::get_listener_position | ( |  | ) | const

Get the position of the listener and BGM.

Definition at line 120 of file Sound.cpp.

References Zeni::Sound_Stream_AL::get_position().

Vector3f Zeni::Sound::get_listener_velocity | ( |  | ) | const

Get the velocity of the listener and BGM.

Definition at line 129 of file Sound.cpp.

References Zeni::Sound_Stream_AL::get_velocity().

Sound_Renderer & Zeni::Sound::get_Renderer | ( |  | ) |

inline

Get the current Sound_Renderer.

Definition at line 30 of file Sound.hxx.

Referenced by Zeni::Popup_Menu_State::Sound_Check_Box::render_impl(), and Zeni::Sound_Source_HW::set_buffer().

bool Zeni::Sound::is_BGM_looping | ( |  | ) |

inline

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

Definition at line 108 of file Sound.hxx.

References Zeni::Sound_Stream_AL::is_looping().

bool Zeni::Sound::is_listener_muted | ( |  | ) | const

inline

Is the listener muted.

Definition at line 38 of file Sound.hxx.

void Zeni::Sound::pause_BGM | ( |  | ) |

inline

Pause BackGround Music.

Definition at line 163 of file Sound.hxx.

References Zeni::Sound_Stream_AL::pause().

bool Zeni::Sound::paused_BGM | ( |  | ) |

inline

Check to see if BackGround Music is paused.

Definition at line 135 of file Sound.hxx.

References Zeni::Sound_Stream_AL::is_paused().

void Zeni::Sound::play_BGM | ( |  | ) |

inline

Begin Playing BackGround Music.

Definition at line 153 of file Sound.hxx.

References Zeni::Sound_Stream_AL::play().

bool Zeni::Sound::playing_BGM | ( |  | ) |

inline

Check to see if BackGround Music is playing.

Definition at line 126 of file Sound.hxx.

References Zeni::Sound_Stream_AL::is_playing().

void Zeni::Sound::set_BGM | ( | const String & | filename | ) |

Set BackGround Music.

Definition at line 142 of file Sound.cpp.

References sort_controllers::filename, Zeni::Sound_Stream_AL::get_gain(), get_Hello_World_Buffer(), Zeni::Sound_Stream_AL::get_max_distance(), Zeni::Sound_Stream_AL::get_pitch(), Zeni::Sound_Stream_AL::get_position(), Zeni::Sound_Stream_AL::get_reference_distance(), Zeni::Sound_Stream_AL::get_rolloff(), Zeni::Sound_Stream_AL::get_velocity(), Zeni::Sound_Stream_AL::is_looping(), Zeni::Sound_Stream_AL::is_playing(), Zeni::Sound_Source::is_playing(), Zeni::Sound_Stream_AL::play(), Zeni::Sound_Source::play(), Zeni::Sound_Source::set_buffer(), Zeni::Sound_Stream_AL::set_gain(), Zeni::Sound_Stream_AL::set_max_distance(), Zeni::Sound_Stream_AL::set_pitch(), Zeni::Sound_Stream_AL::set_position(), Zeni::Sound_Stream_AL::set_reference_distance(), Zeni::Sound_Stream_AL::set_rolloff(), Zeni::Sound_Source::set_time(), Zeni::Sound_Stream_AL::set_velocity(), and Zeni::Sound_Source::stop().

void Zeni::Sound::set_BGM_gain | ( | const float & | gain | ) |

inline

Set the gain.

Definition at line 52 of file Sound.hxx.

References Zeni::Sound_Stream_AL::set_gain().

void Zeni::Sound::set_BGM_looping | ( | const bool & | looping | ) |

inline

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

Definition at line 62 of file Sound.hxx.

References Zeni::Sound_Stream_AL::set_looping().

void Zeni::Sound::set_BGM_pitch | ( | const float & | pitch | ) |

inline

Set the pitch.

Definition at line 42 of file Sound.hxx.

References Zeni::Sound_Stream_AL::set_pitch().

void Zeni::Sound::set_BGM_time | ( | const float & | time | ) |

inline

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

Definition at line 72 of file Sound.hxx.

References Zeni::Sound_Stream_AL::set_time().

void Zeni::Sound::set_listener_forward_and_up | ( | const Vector3f & | forward,
|  | const Vector3f & | up
| ) |  |

Set the orientation of the listener.

Definition at line 104 of file Sound.cpp.

References Zeni::Sound_Renderer::set_listener_forward_and_up().

void Zeni::Sound::set_listener_gain | ( | const float & | gain | ) |

Set the listener gain.

Definition at line 108 of file Sound.cpp.

References Zeni::Sound_Renderer::set_listener_gain().

void Zeni::Sound::set_listener_muted | ( | const bool & | muted | ) |

Set whether the listener is muted.

Definition at line 114 of file Sound.cpp.

References Zeni::Sound_Renderer::set_listener_gain().

Referenced by Zeni::Popup_Menu_State::Sound_Check_Box::on_accept().

void Zeni::Sound::set_listener_position | ( | const Point3f & | position | ) |

Set the position of the listener and BGM.

Definition at line 80 of file Sound.cpp.

References Zeni::Sound_Renderer::set_listener_position(), and Zeni::Sound_Stream_AL::set_position().

void Zeni::Sound::set_listener_velocity | ( | const Vector3f & | velocity | ) |

Set the velocity of the listener and BGM for the doppler effect.

Definition at line 92 of file Sound.cpp.

References Zeni::Sound_Renderer::set_listener_velocity(), and Zeni::Sound_Stream_AL::set_velocity().

void Zeni::Sound::stop_BGM | ( |  | ) |

inline

Stop BackGround Music.

Definition at line 173 of file Sound.hxx.

References Zeni::Sound_Stream_AL::stop().

bool Zeni::Sound::stopped_BGM | ( |  | ) |

inline

Check to see if BackGround Music is stopped.

Definition at line 144 of file Sound.hxx.

References Zeni::Sound_Stream_AL::is_stopped().

void Zeni::Sound::update | ( |  | ) |

inline

Update background music, as needed.

Definition at line 82 of file Sound.hxx.

References Zeni::Sound_Stream_AL::update().

Referenced by Zeni::Game::run().

## Friends And Related Function Documentation

friend class Singleton< Sound >

friend

Definition at line 54 of file Sound.h.

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

- zenilib/jni/external/zenilib/zeni_audio/Zeni/Sound.h
- zenilib/jni/external/zenilib/zeni_audio/Sound.cpp
- zenilib/jni/external/zenilib/zeni_audio/Zeni/Sound.hxx