Loading [MathJax]/extensions/MathMenu.js
Cytopia  0.3
A city building simulation game
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AudioConfig.hxx File Reference
#include "Soundtrack.hxx"
#include <unordered_map>
#include <vector>
#include <betterEnums.hxx>
#include <json.hxx>
+ Include dependency graph for AudioConfig.hxx:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  AudioConfig
 
struct  AudioConfig::SoundtrackConfiguration
 

Typedefs

template<typename Key , typename Value >
using Mapping = std::unordered_map< Key, Value >
 
using string = std::string
 
template<typename Type >
using Vector = std::vector< Type >
 

Functions

 BETTER_ENUM (AudioTrigger, int, MainMenu, MainTheme, NatureSounds)
 the types of triggers More...
 
void from_json (const json &j, AudioConfig &config)
 
void from_json (const json &j, AudioConfig::SoundtrackConfiguration &config)
 

Typedef Documentation

◆ Mapping

template<typename Key , typename Value >
using Mapping = std::unordered_map<Key, Value>

Definition at line 13 of file AudioConfig.hxx.

◆ string

using string = std::string

Definition at line 14 of file AudioConfig.hxx.

◆ Vector

template<typename Type >
using Vector = std::vector<Type>

Definition at line 15 of file AudioConfig.hxx.

Function Documentation

◆ BETTER_ENUM()

BETTER_ENUM ( AudioTrigger  ,
int  ,
MainMenu  ,
MainTheme  ,
NatureSounds   
)

the types of triggers

◆ from_json() [1/2]

void from_json ( const json j,
AudioConfig config 
)

Definition at line 3 of file AudioConfig.cxx.

4 {
5  j["Music"].get_to(config.Music);
6  j["Sound"].get_to(config.Sound);
7 }

◆ from_json() [2/2]

void from_json ( const json j,
AudioConfig::SoundtrackConfiguration config 
)

Definition at line 9 of file AudioConfig.cxx.

10 {
11  j["path"].get_to(config.stereoFilePath);
12  j["monopath"].get_to(config.monoFilePath);
13  std::vector<string> triggers;
14  j["triggers"].get_to(triggers);
15  std::transform(triggers.begin(), triggers.end(), std::back_inserter(config.triggers),
16  [](const string &trigger) { return AudioTrigger::_from_string(trigger.c_str()); });
17 }
AudioConfig::SoundtrackConfiguration::stereoFilePath
string stereoFilePath
Definition: AudioConfig.hxx:26
AudioConfig::SoundtrackConfiguration::triggers
Vector< AudioTrigger > triggers
Definition: AudioConfig.hxx:28
AudioConfig::Sound
Mapping< string, SoundtrackConfiguration > Sound
Definition: AudioConfig.hxx:31
AudioConfig::Music
Mapping< string, SoundtrackConfiguration > Music
Definition: AudioConfig.hxx:30
AudioConfig::SoundtrackConfiguration::monoFilePath
string monoFilePath
Definition: AudioConfig.hxx:27