25 #define OV_EXCLUDE_STATIC_CALLBACKS
27 #undef OV_EXCLUDE_STATIC_CALLBACKS
32 #if defined(_DEBUG) && defined(_WINDOWS)
33 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
41 template class Singleton<Sound>;
43 Sound * Sound::create() {
48 : m_hello_world_buffer(0),
50 m_listener_gain(1.0
f),
51 m_listener_muted(
false)
53 #if !defined(DISABLE_AL)
55 m_sound_renderer =
new Sound_Renderer_AL;
57 catch(Sound_Init_Failure &) {
59 #if defined(ENABLE_SLES)
61 m_sound_renderer =
new Sound_Renderer_SLES;
63 catch(Sound_Init_Failure &) {
65 m_sound_renderer =
new Sound_Renderer_NULL;
66 #if defined(ENABLE_SLES)
69 #if !defined(DISABLE_AL)
76 delete m_hello_world_buffer;
77 delete m_sound_renderer;
82 get_BGM_Source().set_position(position);
84 init_BGM_Sound_Stream_AL();
94 get_BGM_Source().set_velocity(velocity);
96 init_BGM_Sound_Stream_AL();
109 m_listener_gain = gain;
115 m_listener_muted = muted;
122 return get_BGM_Source().get_position();
124 init_BGM_Sound_Stream_AL();
131 return get_BGM_Source().get_velocity();
133 init_BGM_Sound_Stream_AL();
146 bool playing = bgm_source.
is_playing() ?
true :
false;
161 init_BGM_Sound_Stream_AL();
165 const float gain = m_bgm->
get_gain();
194 if(!m_hello_world_buffer)
197 return *m_hello_world_buffer;
214 void Sound::init_BGM_Sound_Stream_AL()
const {
216 m_bgm =
new Sound_Stream_AL(
"sfx/104469__dkmedic__world");
void set_buffer(const Sound_Buffer &buffer)
Set the Sound_Buffer to be played.
void stop()
Stop the Sound_Source. (Essentially the same as pause but resets the current time.)
virtual void set_listener_position(const Point3f &)
Set the position of the listener and BGM.
void set_reference_distance(const float &reference_distance=ZENI_DEFAULT_REFERENCE_DISTANCE)
void set_max_distance(const float &max_distance=ZENI_DEFAULT_MAX_SOUND_DISTANCE)
#define ZENI_DEFAULT_MUSIC_PRIORITY
void set_listener_gain(const float &gain)
Set the listener gain.
Point3f get_position() const
Get the position of the Sound_Buffer.
Sound_Buffer & get_Hello_World_Buffer() const
Initialize m_bgm if needed and return a corresponding Sound_Source.
Sound_Renderer & get_Renderer()
Get the current Sound_Renderer.
float get_gain() const
Get the gain.
float get_reference_distance() const
void play()
Begin playing or unpause the Sound_Source.
std::pair< Vector3f, Vector3f > get_listener_forward_and_up() const
Set the orientation of the listener.
virtual void set_listener_forward_and_up(const Vector3f &, const Vector3f &)
Set the orientation of the listener.
Vector3f get_velocity() const
Get the velocity of the Sound_Buffer.
A 3D Point represented with floats.
void set_rolloff(const float &rolloff=ZENI_DEFAULT_ROLLOFF)
Sound & get_Sound()
Get access to the singleton.
virtual void set_listener_velocity(const Vector3f &)
Set the velocity of the listener and BGM for the doppler effect.
A Featureful 3-Space Vector Class.
float get_pitch() const
Get the pitch.
void set_listener_forward_and_up(const Vector3f &forward, const Vector3f &up)
Set the orientation of the listener.
bool is_looping() const
Check to see if the Sound_Buffer is set to loop back to the start once it is done playing...
void set_gain(const float &gain=ZENI_DEFAULT_GAIN)
Set the gain.
void set_time(const float &time)
Set the current position in the Sound_Buffer, offset in seconds.
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 fo...
void set_listener_muted(const bool &muted)
Set whether the listener is muted.
float get_rolloff() const
void set_listener_velocity(const Vector3f &velocity)
Set the velocity of the listener and BGM for the doppler effect.
virtual void set_listener_gain(const float &)
Set the listener gain.
void set_listener_position(const Point3f &position)
Set the position of the listener and BGM.
void play()
Begin playing or unpause the Sound_Source.
bool is_playing() const
Check to see if the Sound_Source is playing.
bool is_playing() const
Check to see if the Sound_Source is playing.
virtual std::pair< Vector3f, Vector3f > get_listener_forward_and_up() const
Set the orientation of the listener.
Point3f get_listener_position() const
Get the position of the listener and BGM.
void set_BGM(const String &filename)
Set BackGround Music.
Vector3f get_listener_velocity() const
Get the velocity of the listener and BGM.
void set_position(const Point3f &position)
Set the position of the Sound_Source_HW.
void set_pitch(const float &pitch=ZENI_DEFAULT_PITCH)
Set the pitch.
void set_velocity(const Vector3f &velocity)
Set the velocity of the Sound_Source_HW for the doppler effect.
float get_max_distance() const