[673] | 1 | #ifndef _AudioManager_H__ |
---|
| 2 | #define _AudioManager_H__ |
---|
[349] | 3 | |
---|
[409] | 4 | #include "AudioIncludes.h" |
---|
[349] | 5 | |
---|
[919] | 6 | #include "core/Tickable.h" |
---|
| 7 | |
---|
[729] | 8 | #include "AudioPrereqs.h" |
---|
| 9 | |
---|
[349] | 10 | #include "AudioBuffer.h" |
---|
| 11 | #include "AudioSource.h" |
---|
[419] | 12 | #include "AudioStream.h" |
---|
[349] | 13 | |
---|
| 14 | namespace audio |
---|
| 15 | { |
---|
[919] | 16 | class _AudioExport AudioManager : public orxonox::Tickable |
---|
[349] | 17 | { |
---|
| 18 | public: |
---|
[419] | 19 | |
---|
[349] | 20 | // Init audio |
---|
| 21 | AudioManager(); |
---|
[419] | 22 | |
---|
[349] | 23 | // Kill audio and set buffers, sources and memory free |
---|
| 24 | ~AudioManager(); |
---|
[419] | 25 | |
---|
[349] | 26 | // Set listener position |
---|
| 27 | void setPos(std::vector<float> newPosition); |
---|
[419] | 28 | |
---|
[349] | 29 | // Set listener speed |
---|
| 30 | void setSpeed(std::vector<float> newSpeed); |
---|
[419] | 31 | |
---|
[349] | 32 | // Set listener orientation (first is direction |
---|
| 33 | // the listener looks at, the second is the direction |
---|
| 34 | // upwards the listener) |
---|
| 35 | void setOri(std::vector<float> at, std::vector<float> up); |
---|
[419] | 36 | |
---|
[377] | 37 | // Parses given xml string |
---|
| 38 | void loadParams(); |
---|
[419] | 39 | |
---|
| 40 | // Update |
---|
[919] | 41 | void tick(float dt); |
---|
[419] | 42 | |
---|
[715] | 43 | void ambientAdd(std::string file); |
---|
[430] | 44 | void ambientStart(); |
---|
| 45 | void ambientStop(); |
---|
| 46 | |
---|
[349] | 47 | private: |
---|
[377] | 48 | |
---|
[430] | 49 | // Background sound |
---|
| 50 | std::vector<AudioStream> bgSounds; |
---|
| 51 | int currentBgSound; |
---|
| 52 | |
---|
| 53 | |
---|
| 54 | |
---|
[715] | 55 | std::string ambientPath; |
---|
[377] | 56 | |
---|
[349] | 57 | // Vector containing all audio files |
---|
| 58 | std::vector<AudioBuffer> buffers; |
---|
| 59 | // Vector containing all audio sources which referer to one buffer |
---|
| 60 | std::vector<AudioSource> sources; |
---|
| 61 | // The ambient background sound |
---|
| 62 | AudioSource ambient; |
---|
| 63 | |
---|
| 64 | std::vector<float> listenerPosition; |
---|
| 65 | std::vector<float> listenerSpeed; |
---|
| 66 | std::vector<float> listenerAt; |
---|
| 67 | std::vector<float> listenerup; |
---|
| 68 | }; |
---|
| 69 | } |
---|
| 70 | |
---|
[673] | 71 | #endif /* _AudioManager_H__ */ |
---|