flimEngine
flimSound.h
Go to the documentation of this file.
1 #pragma once
2 #ifndef FLIMSOUND_H
3 #define FLIMSOUND_H
4 
5 
6 // audio engine includes
7 #include "SoundEngine.h"
8 #include "SoundCall.h"
9 #include "SoundCallRegistry.h"
10 #include "..\Flim\GameObject.h"
11 #include "flimReverb.h"
12 #include "flimFilter.h"
13 #include "..\Cottage.h"
14 #include "AzulCore.h"
15 
21 
22 enum class DistanceCurve
23 {
24  Linear,
27 };
28 
34 
35 enum class SourceType
36 {
37  Point,
38  Plane
39 };
40 
41 // a collidable with a soundcall; corresponds to emitter on game side
42 
51 
52 class flimSound : public GameObject
53 {
54 public:
55 
68 
69  flimSound(SoundCallID id, bool is3DSound = false, bool occ = false);
70 
71  flimSound() = delete;
72  flimSound(const flimSound&) = default;
73  flimSound& operator=(const flimSound&) = default;
74  ~flimSound();
75 
76  // 3D methods
77  snd_err getOrientation(Vect& out) const;
78  snd_err setOrientation(const Vect& orient);
79 
92 
93  snd_err getPosition(Vect& out) const;
94 
107 
108  snd_err setPosition(const Vect& orient);
109 
110  //snd_err setOrientation(float xF, float yF, float zF, float xU, float yU, float zU);
111 
127 
128  snd_err SetOrientation(const Vect & vect, float xU = 0.0f, float yU = 1.0f, float zU = 0.0f);
129 
142 
143  snd_err getDistanceCurve(DistanceCurve& out);
144 
157 
158  snd_err setDistanceCurve(const DistanceCurve& distCurve);
159 
172 
173  snd_err getReverb(flimReverb& out) const;
174 
187 
188  snd_err getFilter(flimFilter& out) const;
189 
190  // pass through methods -- to soundcall
191 
205 
206  snd_err Pan(float p, int triggerTime = 0);
207 
223 
224  snd_err Pan(float from, float to, float time, int triggerTime = 0);
225 
239 
240  snd_err Loop(bool toLoop, int triggerTime = 0);
241 
255 
256  snd_err Pitch(float p, int triggerTime = 0);
257 
273 
274  snd_err Pitch(float from, float to, float time, int triggerTime = 0);
275 
289 
290  snd_err Volume(float p, int triggerTime = 0);
291 
307 
308  snd_err Volume(float from, float to, float time, int triggerTime = 0);
309 
324 
325  snd_err Play(bool toLoop = false, int t = 0, int _priority = 0);
326 
339 
340  snd_err Stop(int t = 0);
341 
354 
355  snd_err Pause(int t = 0);
356 
369 
370  snd_err IsPlaying(bool&);
371 
384 
385  snd_err GetTimeSinceStarted(int&);
386 
399 
400  snd_err GetVolume(float&);
401 
414 
415  snd_err GetPitch(float&);
416 
429 
430  snd_err GetPan(float&);
431 
444 
445  snd_err GetPriority(int&);
446 
459 
460  snd_err GetLoop(bool&);
461 
474 
475  snd_err SubmitSoundEndedCallback(CallbackCommand* cmd);
476 
477  // game object stuff
478  errcode Update() override;
479 
492 
493  errcode Collision(GameObject *);
494 
507 
508  errcode Collision(Collidable *) override { return errcode::success; };
509 
522 
523  errcode CollisionTerrain(const CollisionVolumeAABB& aabb) override;
524 
537 
538  errcode CollisionEnter(Collidable*);
539 
550 
551  errcode CollisionExit();
552 
553 
554  // reverb
555 
568 
569  errcode SetReverbLevel(float level);
570 
583 
584  errcode SetReverbTime(float time);
585 
598 
599  errcode SetReverbPreDelay(float time);
600 
613 
614  errcode SetReverbSize(float size);
615 
628 
629  errcode SetReverbDensity(float density);
630 
631 private:
634 
635  bool is3D;
636  bool occlusionEnabled; // some sort of collision registration with a ray to the listener
638  Vect position;
642 
643  //Reverb
644  // reverb object -- getters and setters, parameters adjusted internally
646 
647  //Filter
648  // filter object -- getters and setters, parameters adjusted internally
650 };
651 
652 
653 
654 #endif
DistanceCurve
Values that represent distance curves.
Definition: flimSound.h:22
SourceType sourceType
Definition: flimSound.h:641
Definition: ThreadCommands.h:22
Definition: ThreadCommands.h:43
Definition: ThreadCommands.h:41
A flim filter.
Definition: flimFilter.h:31
Definition: ThreadCommands.h:25
Definition: Flim/err.h:13
SoundCallID sndID
Definition: flimSound.h:632
Model * occlusionSphere
Definition: flimSound.h:637
bool occlusionEnabled
Definition: flimSound.h:636
DistanceCurve distanceCurve
Definition: flimSound.h:640
flimReverb reverb
Definition: flimSound.h:645
Definition: ThreadCommands.h:17
Definition: ThreadCommands.h:42
Vect orientation
Definition: flimSound.h:639
Definition: ThreadCommands.h:20
Definition: ThreadCommands.h:21
Definition: ThreadCommands.h:44
Definition: ThreadCommands.h:23
Definition: GameObject.h:17
errcode
Values that represent errcodes.
Definition: Flim/err.h:11
bool is3D
Definition: flimSound.h:635
SoundCallID
Values that represent sound call Identifiers.
Definition: SoundCallRegistry.h:11
A collidable.
Definition: Collidable.h:40
Definition: ThreadCommands.h:18
A flim sound.
Definition: flimSound.h:52
Definition: CollisionVolumeAABB.h:12
flimFilter filter
Definition: flimSound.h:649
errcode Collision(Collidable *) override
Collisions the given parameter 1.
Definition: flimSound.h:508
SourceType
Values that represent source types.
Definition: flimSound.h:35
Definition: CallbackCommand.h:12
Definition: SoundCall.h:11
Definition: flimReverb.h:6
SoundCall * snd
Definition: flimSound.h:633
snd_err
Definition: snd_err.h:7
Vect position
Definition: flimSound.h:638