All Classes Functions Typedefs
Sound.hpp
1 // ==============================================================
2 // ORBITER AUX LIBRARY: Dan's MFD Sound C++ wrapper
3 // http://sf.net/projects/enjomitchsorbit
4 // Part of the ORBITER SDK
5 //
6 // Copyright (C) 2011 Szymon "Enjo" Ender
7 // All rights reserved
8 //
9 // Sound - Hides all the dynamic sample loading
10 //
11 // Multiple Vessels Support is free software: you can redistribute it
12 // and/or modify it under the terms of the GNU Lesser General Public
13 // License as published by the Free Software Foundation, either version
14 // 3 of the License, or (at your option) any later version.
15 //
16 // Multiple Vessels Support is distributed in the hope that it will
17 // be useful, but WITHOUT ANY WARRANTY; without even the implied
18 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 // See the GNU Lesser General Public License for more details.
20 //
21 // You should have received a copy of the GNU Lesser General Public
22 // License along with Multiple Vessels Support. If not, see
23 // <http://www.gnu.org/licenses/>.
24 // ==============================================================
25 
26 #ifndef SOUND_HPP_INCLUDED
27 #define SOUND_HPP_INCLUDED
28 
29 #include "SoundMap.hpp"
30 #include <string>
31 
32 namespace EnjoLib
33 {
34 namespace MFDGoodies
35 {
37 
43 class Sound
44 {
45 public:
47 
50  Sound( const SoundMap & soundMap );
52  virtual ~Sound();
53 
54  void Reinit();
55 
57 
61  void PlaySound( const int sample );
62  void PlaySoundOnce( const int sample );
63  void ResetSoundOnce( const int sample );
64  void ResetSoundsOnce();
65 
67 
70  void SetUseSound( const bool use );
71 
73 
74  void SwitchUseSound();
75 
77 
81  void Connect( const char * uniqueName );
82 
83 private:
84  bool IsUsingSound();
85 
86  const static int m_maxSlotID;
87  const SoundMap & m_soundMap;
88  std::map<int, bool> m_soundPlayOnceFlags;
89  int m_soundSystemID;
90  int m_numReinited;
91  int m_currentlyLoadedSampleOnLastSlot;
92  bool m_useSoundUser;
93 };
94 }
95 }
96 
97 #endif // SOUND_HPP_INCLUDED