/
VSoundLoader.h
56 lines (46 loc) · 1.45 KB
/
VSoundLoader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
#include "VGeneral.h"
#include "VIdentifier.h"
#include "../logic/LMessageLoader.h"
#include <QtMultimedia/QSoundEffect>
NAMESPACE_VIEW_B
class VSoundLoader
{
public:
enum SoundEffect
{
BUILDING_PLACED,
TRASSE_PLACED,
OBJECT_REMOVED,
OPERATION_CANCELED,
POWERPLANT_SWITCH_ON,
POWERPLANT_SWITCH_OFF,
SABOTAGE_RECEIVED,
SABOTAGE_EMITTED,
ENERGY_LOW,
GAME_OVER,
GAME_WON
};
private:
VSoundLoader() = delete;
VSoundLoader(const VSoundLoader&) = delete;
VSoundLoader(const VSoundLoader&&) = delete;
VSoundLoader& operator=(const VSoundLoader&) = delete;
VSoundLoader& operator=(const VSoundLoader&&) = delete;
~VSoundLoader() = delete;
static void setSoundEffectHelper(const SoundEffect soundEffect, const std::string& filename);
private:
DEBUG_EXPRESSION(static bool initDone);
static CScene* scene; //Background music needs to be added to scene
static std::list<CAudio> sound3DLoop;
static std::unordered_map<VIdentifier::VIdentifier, std::pair<std::string, float>> sound3DLoopData; //pair = (path, radius)
static std::unordered_map<SoundEffect, QSoundEffect> soundeffects;
public:
static void init(CScene* scene);
static void playBackgroundMusicIngame();
static void playBackgroundMusicMainMenu();
static void play3DSoundLoop(const VIdentifier::VIdentifier building, CPlacement* placement);
static void playSoundeffect(const SoundEffect soundEffect, CPlacement* placement);
static void stopSound();
};
NAMESPACE_VIEW_E