1 | /* |
---|
2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | * > www.orxonox.net < * |
---|
4 | * |
---|
5 | * License notice: |
---|
6 | * |
---|
7 | * This program is free software; you can redistribute it and/or |
---|
8 | * modify it under the terms of the GNU General Public License |
---|
9 | * as published by the Free Software Foundation; either version 2 |
---|
10 | * of the License, or (at your option) any later version. |
---|
11 | * |
---|
12 | * This program is distributed in the hope that it will be useful, |
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | * GNU General Public License for more details. |
---|
16 | * |
---|
17 | * You should have received a copy of the GNU General Public License |
---|
18 | * along with this program; if not, write to the Free Software |
---|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
20 | * |
---|
21 | * Author: |
---|
22 | * Nicolas Perrenoud <nicolape_at_ee.ethz.ch> |
---|
23 | * Co-authors: |
---|
24 | * ... |
---|
25 | * |
---|
26 | */ |
---|
27 | |
---|
28 | #ifndef _AudioManager_H__ |
---|
29 | #define _AudioManager_H__ |
---|
30 | |
---|
31 | #include "AudioPrereqs.h" |
---|
32 | |
---|
33 | #include <vector> |
---|
34 | #include <string> |
---|
35 | |
---|
36 | #include "core/Tickable.h" |
---|
37 | |
---|
38 | namespace audio |
---|
39 | { |
---|
40 | class _AudioExport AudioManager : public orxonox::Tickable |
---|
41 | { |
---|
42 | public: |
---|
43 | |
---|
44 | // Init audio |
---|
45 | AudioManager(); |
---|
46 | |
---|
47 | // Kill audio and set buffers, sources and memory free |
---|
48 | ~AudioManager(); |
---|
49 | |
---|
50 | // Set listener position |
---|
51 | void setPos(std::vector<float> newPosition); |
---|
52 | |
---|
53 | // Set listener speed |
---|
54 | void setSpeed(std::vector<float> newSpeed); |
---|
55 | |
---|
56 | // Set listener orientation (first is direction |
---|
57 | // the listener looks at, the second is the direction |
---|
58 | // upwards the listener) |
---|
59 | void setOri(std::vector<float> at, std::vector<float> up); |
---|
60 | |
---|
61 | // Parses given xml string |
---|
62 | void loadParams(); |
---|
63 | |
---|
64 | // Update |
---|
65 | void tick(float dt); |
---|
66 | |
---|
67 | void ambientAdd(std::string file); |
---|
68 | void ambientStart(); |
---|
69 | void ambientStop(); |
---|
70 | |
---|
71 | private: |
---|
72 | |
---|
73 | // Background sound |
---|
74 | std::vector<AudioStream*> bgSounds; |
---|
75 | int currentBgSound; |
---|
76 | |
---|
77 | |
---|
78 | |
---|
79 | std::string ambientPath; |
---|
80 | |
---|
81 | // Vector containing all audio files |
---|
82 | std::vector<AudioBuffer*> buffers; |
---|
83 | // Vector containing all audio sources which referer to one buffer |
---|
84 | std::vector<AudioSource*> sources; |
---|
85 | // The ambient background sound |
---|
86 | AudioSource* ambient; |
---|
87 | |
---|
88 | std::vector<float> listenerPosition; |
---|
89 | std::vector<float> listenerSpeed; |
---|
90 | std::vector<float> listenerAt; |
---|
91 | std::vector<float> listenerup; |
---|
92 | }; |
---|
93 | } |
---|
94 | |
---|
95 | #endif /* _AudioManager_H__ */ |
---|