1 /*
2  *  This file is part of Dune Legacy.
3  *
4  *  Dune Legacy is free software: you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation, either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  Dune Legacy is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with Dune Legacy.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef SFXMANAGER_H
19 #define SFXMANAGER_H
20 
21 #include <SDL_mixer.h>
22 #include <DataTypes.h>
23 
24 #include <string>
25 
26 #define NUM_MAPCHOICEPIECES 28
27 #define NUM_MAPCHOICEARROWS 9
28 
29 // Voice
30 typedef enum {
31     HarvesterDeployed,
32     UnitDeployed,
33     UnitLaunched,
34     ConstructionComplete,
35     VehicleRepaired,
36     FrigateHasArrived,
37     YourMissionIsComplete,
38     YouHaveFailedYourMission,
39     RadarActivated,
40     RadarDeactivated,
41     BloomLocated,
42     WarningWormSign,
43     BaseIsUnderAttack,  ///< unused
44     SaboteurApproaching,
45     MissileApproaching,
46     YesSir,
47     Reporting,
48     Acknowledged,
49     Affirmative,
50     MovingOut,
51     InfantryOut,
52     SomethingUnderTheSand,
53     HouseHarkonnen,
54     HouseAtreides,
55     HouseOrdos,
56     NUM_VOICE
57 } Voice_enum;
58 
59 // Sound
60 typedef enum {
61     Sound_PlaceStructure,
62     Sound_ButtonClick,
63     Sound_InvalidAction,
64     Sound_CreditsTick,
65     Sound_Tick,
66     Sound_RadarNoise,
67     Sound_ExplosionGas,
68     Sound_ExplosionTiny,
69     Sound_ExplosionSmall,
70     Sound_ExplosionMedium,
71     Sound_ExplosionLarge,
72     Sound_ExplosionStructure,
73     Sound_WormAttack,
74     Sound_Gun,
75     Sound_Rocket,
76     Sound_Bloom,
77     Sound_Scream1,
78     Sound_Scream2,
79     Sound_Scream3,
80     Sound_Scream4,
81     Sound_Scream5,
82     Sound_Trumpet,
83     Sound_Drop,
84     Sound_Squashed,
85     Sound_MachineGun,
86     Sound_Sonic,
87     Sound_RocketSmall,
88     NUM_SOUNDCHUNK
89 } Sound_enum;
90 
91 
92 class SFXManager {
93 public:
94     SFXManager();
95     ~SFXManager();
96 
97     Mix_Chunk*      getVoice(Voice_enum id, int house);
98     Mix_Chunk*      getSound(Sound_enum id);
99 
100 private:
101     Mix_Chunk*      loadMixFromADL(const std::string& adlFile, int index, int volume = MIX_MAX_VOLUME/2);
102 
103     void            loadEnglishVoice();
104     Mix_Chunk*      getEnglishVoice(Voice_enum id, int house);
105 
106     void            loadNonEnglishVoice(const std::string& languagePrefix);
107     Mix_Chunk*      getNonEnglishVoice(Voice_enum id, int house);
108 
109     Mix_Chunk**     lngVoice;
110     int             numLngVoice;
111     Mix_Chunk*      soundChunk[NUM_SOUNDCHUNK];
112 };
113 
114 #endif // SFXMANAGER_H
115