Copperfield Engine 0.1
C++ Game Engine
Loading...
Searching...
No Matches
soundsource.h
1#pragma once
2#include <string>
3
4#include "AL/al.h"
5#include "AL/alc.h"
6#include "math/vector_3.h"
7
8class SoundBuffer;
9
10class SoundSource {
11 public:
12 SoundSource(std::string name, const SoundBuffer& b, coma::Vec3 pos,
13 coma::Vec3 speed,
14 float gain = 1.0f, float pitch = 1.0f);
15 ~SoundSource();
16 SoundSource& operator=(const SoundSource& src) = default;
17 //TODO:bad constructor, copy constructor reference shoul always be const
18 //SoundSource(SoundSource& other) noexcept;
19 SoundSource(const SoundSource& other) = default;
20 SoundSource(SoundSource&& other) noexcept;
21
22 void setLoop(bool state);
23 void setPos(coma::Vec3 pos);
24 coma::Vec3 getPos();
25 void setVelocity(coma::Vec3 speed);
26 coma::Vec3 getVelocity();
27 void updatePos(coma::Vec3 pos);
28 void updateGain(float gain);
29 void updatePitch(float pitch);
30 void setGain(float gain);
31 void setPitch(float pitch);
32
33 float Gain() const;
34 float Pitch() const;
35 bool Loop() const;
36 int Source() const;
37 bool getStatus() const;
38
39 bool addSound(SoundBuffer* b);
40 void unbindSound();
41 bool isPlaying();
42 void Play();
43 void Stop();
44 std::string Name();
45
46 bool destructible_;
47
48 private:
49
50
51 std::string name_;
52 ALfloat pos_[3];
53 ALfloat speed_[3];
54 float gain_;
55 float pitch_;
56 bool loop_;
57
58 bool start_;
59 bool stop_;
60
61 bool isPlaying_;
62
63 ALuint src_;
64};
represents mathematical vector with 3 components
Definition: vector_3.h:12