-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcfg.H
112 lines (107 loc) · 1.88 KB
/
cfg.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// $Id$
#ifndef CFG_H_
#define CFG_H_
/**
\defgroup pd_cfg prodatum Configurations
@{
*/
#ifdef WIN32
# include <direct.h>
# define mkdir(x,m) _mkdir(x)
#else
# define mkdir(x,m) mkdir(x,m)
#endif
#include "config.h"
#define MAX_ARPS 300
#define MAX_RIFFS 1000
#include <vector>
/**
* Enum of config options
*/
enum CONFIG
{
CFG_MIDI_OUT,
CFG_MIDI_IN,
CFG_MIDI_THRU,
CFG_CONTROL_CHANNEL,
CFG_AUTOMAP,
CFG_DEVICE_ID,
CFG_MASTER_VOLUME,
CFG_SPEED,
CFG_CLOSED_LOOP_UPLOAD,
CFG_CLOSED_LOOP_DOWNLOAD,
CFG_TOOLTIPS,
CFG_KNOBMODE,
CFG_CONFIRM_EXIT,
CFG_CONFIRM_RAND,
CFG_CONFIRM_DISMISS,
CFG_SYNCVIEW,
CFG_DRLS,
CFG_LOG_SYSEX_OUT,
CFG_LOG_SYSEX_IN,
CFG_LOG_EVENTS_OUT,
CFG_LOG_EVENTS_IN,
CFG_WINDOW_WIDTH,
CFG_WINDOW_HEIGHT,
CFG_BGR,
CFG_BGG,
CFG_BGB,
CFG_BG2R,
CFG_BG2G,
CFG_BG2B,
CFG_FGR,
CFG_FGG,
CFG_FGB,
CFG_SLR,
CFG_SLG,
CFG_SLB,
CFG_INR,
CFG_ING,
CFG_INB,
CFG_KNOB_COLOR1,
CFG_KNOB_COLOR2,
NOOPTION
};
/**
* Configuration class.
* loads, saves and manages all configuration options
*/
class Cfg
{
/// configuration directory
char config_dir[PATH_MAX];
/// path to export directory
char export_dir[PATH_MAX];
std::vector<int> defaults;
std::vector<int> option;
public:
/**
* CTOR parses config file
*/
Cfg(int id = -1);
/**
* DTOR saves config file
*/
~Cfg();
/// returns the config directory path
const char* get_config_dir() const;
const char* get_export_dir() const;
bool set_export_dir(const char* dir);
/**
* updates a configuration value
* @param option the parameter to update
* @param value the new value for the parameter
*/
void set_cfg_option(int option, int value);
/**
* get a configuration option
* @param option parameter to get
* @return parameter value
*/
int get_cfg_option(int) const;
int get_default(int) const;
int getset_default(int);
void apply(bool colors_only = false);
};
#endif /* CFG_H_ */
/** @} */