YSE sound engine  1.0
cross platform sound engine
 All Classes Namespaces Functions Pages
system.hpp
1 /*
2  ==============================================================================
3 
4  system.hpp
5  Created: 27 Jan 2014 7:14:31pm
6  Author: yvan
7 
8  ==============================================================================
9 */
10 
11 #ifndef SYSTEM_H_INCLUDED
12 #define SYSTEM_H_INCLUDED
13 
14 #include "headers/types.hpp"
15 #include "utils/vector.hpp"
16 #include "classes.hpp"
17 
18 namespace YSE {
19 
20  typedef Flt(*occlusionFunc)(const Vec& source, const Vec& listener);
21 
22  class API system {
23  public:
24  system();
25  ~system();
26 
27  Bool init();
28  void update();
29  void close();
30 
36  reverb & getGlobalReverb();
37 
38  // audio device
39  //void speakerPos(Int nr, Flt angle);
40  //Int activeDevice();
41  const std::vector<device> & getDevices();
42  void openDevice(const deviceSetup & object, CHANNEL_TYPE conf = CT_AUTO);
43  void closeCurrentDevice();
44 
45  // effects
46  //void insideCave(Bool status);
47 
48  // sound occlusion
49  /* you should provide your own function for occlusion checks.
50  Assuming that your game uses physics, this is quite easy to implement.
51  All you have to do is a raycast form the first to the second position and see
52  if there are any objects inbetween that should occlude the sound and decide how
53  much you want to occlude it.
54  */
55  system& occlusionCallback(Flt(*func)(const YSE::Vec&, const YSE::Vec&));
56  occlusionFunc occlusionCallback();
57 
58  system & underWaterFX(const channel & target);
59  system & setUnderWaterDepth(Flt value);
60 
61 
62  // config
63  //system& dopplerScale(Flt scale); Flt dopplerScale();
64  //system& distanceFactor(Flt factor); Flt distanceFactor();
65  //system& rolloffScale(Flt scale); Flt rolloffScale();
66  system& maxSounds(Int value); Int maxSounds(); // the maximum amount of sounds that are actually used. If the number of sounds exeeds this, the least significant ones will be turned virtual
67 
68  // statistics
69  Flt cpuLoad(); // cpu load of the audio steam (not the YSE update system)
70  void sleep(UInt ms); // usefull for console applications if you don't want to run update at max speed
71  private:
72  Flt(*occlusionPtr)(const Vec& source, const Vec& listener);
73  };
74 
75  API system & System();
76 }
77 
78 
79 
80 #endif // SYSTEM_H_INCLUDED
Channels are used to control groups of sounds simultaniously.
Reverb objects are actually just a collection of reverb settings.
The Listener is a singleton object used to control your position in the virtual space.
Definition: listener.hpp:29