-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAudioSystem.h
71 lines (60 loc) · 1.75 KB
/
AudioSystem.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#pragma once
#include <unordered_map>
#include <string>
#include "SoundEvent.h"
namespace FMOD
{
class System;
namespace Studio
{
class Bank;
class EventDescription;
class EventInstance;
class System;
class Bus;
}
}
class AudioSystem
{
public:
AudioSystem(class Game* game);
~AudioSystem();
bool Initialize();
void ShutDown();
void Update(float deltaTime);
// Function for loading the bank, and sample data
void LoadBank(const std::string& name);
void UnloadBank(const std::string& name);
void UnloadAllBanks();
SoundEvent PlayEvent(const std::string& name);
// Functions for controlling the buses
float GetBusVolume(const std::string& name) const;
bool GetBusPaused(const std::string& name) const;
void SetBusVolume(const std::string& name, float volume);
void SetBusPaused(const std::string& name, bool pause);
// Getters and setters
void IncrementNextID() { sNextID++; }
int GetNextID() const { return sNextID; }
protected:
friend class SoundEvent;
FMOD::Studio::EventInstance* GetEventInstance(unsigned int ID);
private:
// game member variable
class Game* mGame;
// setting the ID for the next event instance
static int sNextID;
//FMOD
FMOD::Studio::System* mSystem;
//FMOD low level
FMOD::System* mLowLevelSystem;
// Banks
// Map of loaded banks. The string is the filename of the bank
std::unordered_map<std::string, FMOD::Studio::Bank*> mBanks;
// Map of event name to event description. The string is the name assigned
// by FMOD for the event.
std::unordered_map<std::string, FMOD::Studio::EventDescription*> mEvents;
// Maps unsigned ints to event instances
std::unordered_map<unsigned int, FMOD::Studio::EventInstance*> mEventInstances;
// Map of buses
std::unordered_map<std::string, FMOD::Studio::Bus*> mBuses;
};