StarTrekV3_Linux  Version3
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Pages
SoundManager.h
Go to the documentation of this file.
1 //
2 // ___.--------._____________,------' -----.`----._
3 // \ ` - . _ /\
4 // `.__________ ` - | | __,---"-._
5 // `-----------.______ ,'_/ ________,------'___________`----.___________
6 // `-----.____,' \===========================================/
7 // | :| >--------------.----------.---------------'
8 // / :| _,--' ,--' `--.__.--'
9 // / : |--'______________/_
10 // ,---,' : \__________________`--.
11 // `__________ |/|
12 // `------._ |\|
13 // `--._________,-'
14 //
15 //
16 //
17 // Credits go to Paramount pictures for the star - trek concept and universe.
18 
19 
20 // Copyright (C) 2015 - 2016 E.J.M. Martens
21 //
22 // This program is free software; you can redistribute it and/or
23 // modify it under the terms of the GNU General Public License
24 // as published by the Free Software Foundation; either version 2
25 // of the License, or (at your option) any later version.
26 //
27 // This program is distributed in the hope that it will be useful,
28 // but WITHOUT ANY WARRANTY; without even the implied warranty of
29 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 // GNU General Public License for more details.
31 //
32 // You should have received a copy of the GNU General Public License
33 // along with this program; if not, write to the Free Software
34 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
35 
36 
37 
38 #ifndef _SOUNDMANAGER
39 #define _SOUNDMANAGER
40 
41 #include <vector>
42 #include <list>
43 #include <string>
44 #include <allegro5/allegro.h>
45 #include <allegro5/allegro_audio.h>
46 #include <allegro5/allegro_acodec.h>
47 
48 using namespace std;
49 
50 
51 namespace SOUND
52 {
53  enum SOUNDNAME
54  {
55  PHOTON = 0,
60  ON,
61  OFF,
62  DISRUPTOR = 11,
64  };
65 
66 }
67 
68 namespace SoundManager
69 {
70 
71 void Init_SoundManager(int a_nNumberOfSamples);
72 void DeInit_SoundManager();
73 void LoadSounds();
74 void PlaySound(SOUND::SOUNDNAME a_Name,double a_dVolume );
75 void LoopSound(SOUND::SOUNDNAME a_Name,double a_dVolume, ALLEGRO_SAMPLE_ID * a_rID );
76 void StopSound(ALLEGRO_SAMPLE_ID * a_rID);
77 
78 class SoundManagerException: public exception
79 {
80  private:
81  string m_strError;
82 
83  public:
84 
85  SoundManagerException(string a_strError)
86  {
87  m_strError = a_strError;
88  }
89 
90  virtual const char* what() const throw()
91  {
92  return m_strError.c_str();
93  }
94 
95  virtual ~SoundManagerException() throw() { }
96 };
97 
98 }
99 
100 
101 #endif // _SOUNDMANAGER
102 
void LoopSound(SOUND::SOUNDNAME a_Name, double a_dVolume, ALLEGRO_SAMPLE_ID *a_rID)
Definition: SoundManager.cpp:73
SoundManagerException(string a_strError)
Definition: SoundManager.h:85
Definition: SoundManager.h:78
Definition: KeyMapper.h:56
void StopSound(ALLEGRO_SAMPLE_ID *a_ID)
Definition: SoundManager.cpp:79
Definition: SoundManager.h:59
Definition: SoundManager.h:57
Definition: KeyMapper.h:58
void PlaySound(SOUND::SOUNDNAME a_Name, double a_dVolume)
Definition: SoundManager.cpp:61
Definition: SoundManager.h:60
Definition: SoundManager.h:63
void LoadSounds()
Definition: SoundManager.cpp:37
Definition: SoundManager.h:62
virtual const char * what() const
Definition: SoundManager.h:90
void Init_SoundManager(int a_nNumberOfSamples)
Definition: SoundManager.cpp:11
void DeInit_SoundManager()
Definition: SoundManager.cpp:26
virtual ~SoundManagerException()
Definition: SoundManager.h:95
Definition: SoundManager.h:56
SOUNDNAME
Definition: SoundManager.h:53
Definition: SoundManager.h:61