zenilib: zenilib/jni/external/zenilib/zeni_audio/Zeni/Sound.hxx Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Sound.hxx
Go to the documentation of this file.
1 /* This file is part of the Zenipex Library (zenilib).
2 * Copyright (C) 2011 Mitchell Keith Bloch (bazald).
3 *
4 * zenilib is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * zenilib is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with zenilib. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifndef ZENI_SOUND_HXX
19 #define ZENI_SOUND_HXX
20
21 // HXXed below
22 #include <Zeni/Sound_Source.h>
23
24 #include <Zeni/Sound.h>
25
26 #include <Zeni/Define.h>
27
28 namespace Zeni {
29
30 Sound_Renderer & Sound::get_Renderer() {
31 return *m_sound_renderer;
32 }
33
34 float Sound::get_listener_gain() const {
35 return m_listener_gain;
36 }
37
38 bool Sound::is_listener_muted() const {
39 return m_listener_muted;
40 }
41
42 void Sound::set_BGM_pitch(const float & pitch) {
43 #ifdef DISABLE_AL
44 get_BGM_Source().set_pitch(pitch);
45 #else
46 init_BGM_Sound_Stream_AL();
47 if(m_bgm)
48 m_bgm->set_pitch(pitch);
49 #endif
50 }
51
52 void Sound::set_BGM_gain(const float &gain) {
53 #ifdef DISABLE_AL
54 get_BGM_Source().set_gain(gain);
55 #else
56 init_BGM_Sound_Stream_AL();
57 if(m_bgm)
58 m_bgm->set_gain(gain);
59 #endif
60 }
61
62 void Sound::set_BGM_looping(const bool &looping) {
63 #ifdef DISABLE_AL
64 get_BGM_Source().set_looping(looping);
65 #else
66 init_BGM_Sound_Stream_AL();
67 if(m_bgm)
68 m_bgm->set_looping(looping);
69 #endif
70 }
71
72 void Sound::set_BGM_time(const float &time) {
73 #ifdef DISABLE_AL
74 get_BGM_Source().set_time(time);
75 #else
76 init_BGM_Sound_Stream_AL();
77 if(m_bgm)
78 m_bgm->set_time(time);
79 #endif
80 }
81
82 void Sound::update() {
83 #ifndef DISABLE_AL
84 init_BGM_Sound_Stream_AL();
85 if(m_bgm)
86 m_bgm->update();
87 #endif
88 }
89
90 float Sound::get_BGM_pitch() {
91 #ifdef DISABLE_AL
92 return get_BGM_Source().get_pitch();
93 #else
94 init_BGM_Sound_Stream_AL();
95 return m_bgm ? m_bgm->get_pitch() : ZENI_DEFAULT_PITCH;
96 #endif
97 }
98
99 float Sound::get_BGM_gain() {
100 #ifdef DISABLE_AL
101 return get_BGM_Source().get_gain();
102 #else
103 init_BGM_Sound_Stream_AL();
104 return m_bgm ? m_bgm->get_gain() : ZENI_DEFAULT_GAIN;
105 #endif
106 }
107
108 bool Sound::is_BGM_looping() {
109 #ifdef DISABLE_AL
110 return get_BGM_Source().is_looping();
111 #else
112 init_BGM_Sound_Stream_AL();
113 return m_bgm ? m_bgm->is_looping() : false;
114 #endif
115 }
116
117 float Sound::get_BGM_time() {
118 #ifdef DISABLE_AL
119 return get_BGM_Source().get_time();
120 #else
121 init_BGM_Sound_Stream_AL();
122 return m_bgm ? m_bgm->get_time() : 0.0f;
123 #endif
124 }
125
126 bool Sound::playing_BGM() {
127 #ifdef DISABLE_AL
128 return get_BGM_Source().is_playing();
129 #else
130 init_BGM_Sound_Stream_AL();
131 return m_bgm ? m_bgm->is_playing() : false;
132 #endif
133 }
134
135 bool Sound::paused_BGM() {
136 #ifdef DISABLE_AL
137 return get_BGM_Source().is_paused();
138 #else
139 init_BGM_Sound_Stream_AL();
140 return m_bgm ? m_bgm->is_paused() : false;
141 #endif
142 }
143
144 bool Sound::stopped_BGM() {
145 #ifdef DISABLE_AL
146 return get_BGM_Source().is_stopped();
147 #else
148 init_BGM_Sound_Stream_AL();
149 return m_bgm ? m_bgm->is_stopped() : true;
150 #endif
151 }
152
153 void Sound::play_BGM() {
154 #ifdef DISABLE_AL
155 get_BGM_Source().play();
156 #else
157 init_BGM_Sound_Stream_AL();
158 if(m_bgm)
159 m_bgm->play();
160 #endif
161 }
162
163 void Sound::pause_BGM() {
164 #ifdef DISABLE_AL
165 get_BGM_Source().pause();
166 #else
167 init_BGM_Sound_Stream_AL();
168 if(m_bgm)
169 m_bgm->pause();
170 #endif
171 }
172
173 void Sound::stop_BGM() {
174 #ifdef DISABLE_AL
175 get_BGM_Source().stop();
176 #else
177 init_BGM_Sound_Stream_AL();
178 if(m_bgm)
179 m_bgm->stop();
180 #endif
181 }
182
183 }
184
185 #include <Zeni/Undefine.h>
186
187 #include <Zeni/Sound_Source.hxx>
188
189 #endif
Zeni::Sound::get_BGM_gain
float get_BGM_gain()
Get the gain.
Definition: Sound.hxx:99
Zeni::Sound::stop_BGM
void stop_BGM()
Stop BackGround Music.
Definition: Sound.hxx:173
Zeni::Sound::get_BGM_time
float get_BGM_time()
Get the current position in the BGM, offset in seconds.
Definition: Sound.hxx:117
Sound_Source.h
Zeni::Sound::get_BGM_pitch
float get_BGM_pitch()
Get the pitch.
Definition: Sound.hxx:90
ZENI_DEFAULT_PITCH
#define ZENI_DEFAULT_PITCH
Definition: Define.h:54
Zeni::Sound_Renderer
Definition: Sound_Renderer.h:44
Zeni::Sound::get_Renderer
Sound_Renderer & get_Renderer()
Get the current Sound_Renderer.
Definition: Sound.hxx:30
Zeni::Sound_Stream_AL::get_gain
float get_gain() const
Get the gain.
Definition: Sound_Stream_AL.cpp:102
Undefine.h
Zeni::Sound::stopped_BGM
bool stopped_BGM()
Check to see if BackGround Music is stopped.
Definition: Sound.hxx:144
ZENI_DEFAULT_GAIN
#define ZENI_DEFAULT_GAIN
Definition: Define.h:55
Zeni::Sound_Stream_AL::get_pitch
float get_pitch() const
Get the pitch.
Definition: Sound_Stream_AL.cpp:96
Zeni::Sound::is_BGM_looping
bool is_BGM_looping()
Check to see if the BGM is set to loop back to the start once it is done playing. ...
Definition: Sound.hxx:108
Define.h
Zeni::Sound_Stream_AL::set_time
void set_time(const float &time)
Set the current position in the Sound_Buffer, offset in seconds.
Definition: Sound_Stream_AL.cpp:75
Zeni::Sound_Stream_AL::pause
void pause()
Pause the Sound_Source.
Definition: Sound_Stream_AL.cpp:157
Zeni::Sound_Stream_AL::is_looping
bool is_looping() const
Check to see if the Sound_Buffer is set to loop back to the start once it is done playing...
Definition: Sound_Stream_AL.cpp:122
Zeni::Sound::play_BGM
void play_BGM()
Begin Playing BackGround Music.
Definition: Sound.hxx:153
Zeni::Sound::set_BGM_time
void set_BGM_time(const float &time)
Set the current position in the BGM, offset in seconds.
Definition: Sound.hxx:72
Zeni::Sound_Stream_AL::set_gain
void set_gain(const float &gain=ZENI_DEFAULT_GAIN)
Set the gain.
Definition: Sound_Stream_AL.cpp:58
Zeni::Sound_Stream_AL::get_time
float get_time() const
Get the current position in the Sound_Buffer, offset in seconds.
Definition: Sound_Stream_AL.cpp:126
Zeni::Sound_Stream_AL::stop
void stop()
Stop the Sound_Source. (Essentially the same as pause but resets the current time.)
Definition: Sound_Stream_AL.cpp:161
Zeni::Sound::playing_BGM
bool playing_BGM()
Check to see if BackGround Music is playing.
Definition: Sound.hxx:126
Zeni::Sound::set_BGM_pitch
void set_BGM_pitch(const float &pitch)
Set the pitch.
Definition: Sound.hxx:42
Zeni::Sound::set_BGM_looping
void set_BGM_looping(const bool &looping)
Set whether the BGM should loop back to the start once it is done playing.
Definition: Sound.hxx:62
Zeni::Sound_Stream_AL::play
void play()
Begin playing or unpause the Sound_Source.
Definition: Sound_Stream_AL.cpp:148
Zeni::Sound::is_listener_muted
bool is_listener_muted() const
Is the listener muted.
Definition: Sound.hxx:38
Zeni::Sound_Stream_AL::is_playing
bool is_playing() const
Check to see if the Sound_Source is playing.
Definition: Sound_Stream_AL.cpp:165
Zeni::Sound::pause_BGM
void pause_BGM()
Pause BackGround Music.
Definition: Sound.hxx:163
Zeni::Sound_Stream_AL::is_stopped
bool is_stopped() const
Check to see if the Sound_Source is stopped.
Definition: Sound_Stream_AL.cpp:177
Zeni::Sound_Stream_AL::is_paused
bool is_paused() const
Check to see if the Sound_Source is paused.
Definition: Sound_Stream_AL.cpp:171
Zeni::Sound_Stream_AL::set_looping
void set_looping(const bool &looping)
Set whether the Sound_Buffer should loop back to the start once it is done playing.
Definition: Sound_Stream_AL.cpp:71
Zeni::Sound_Stream_AL::update
void update()
Definition: Sound_Stream_AL.cpp:183
Sound.h
Zeni::Sound_Stream_AL::set_pitch
void set_pitch(const float &pitch=ZENI_DEFAULT_PITCH)
Set the pitch.
Definition: Sound_Stream_AL.cpp:54
Zeni::Sound::update
void update()
Update background music, as needed.
Definition: Sound.hxx:82
Zeni::Sound::paused_BGM
bool paused_BGM()
Check to see if BackGround Music is paused.
Definition: Sound.hxx:135
Zeni::Sound::get_listener_gain
float get_listener_gain() const
Get the listener gain.
Definition: Sound.hxx:34
Sound_Source.hxx
Zeni::Sound::set_BGM_gain
void set_BGM_gain(const float &gain)
Set the gain.
Definition: Sound.hxx:52