File: conf.cpp

package info (click to toggle)
giada 0.15.2%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,700 kB
  • sloc: cpp: 30,043; sh: 1,056; makefile: 422; ansic: 1
file content (160 lines) | stat: -rw-r--r-- 5,087 bytes parent folder | download
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#include "../src/core/const.h"
#include "../src/core/conf.h"
#include <catch.hpp>


using std::string;
using namespace giada::m;


TEST_CASE("conf")
{
  conf::init();
  
  SECTION("test write")
  {
    conf::header = "GIADACONFTEST";
    conf::logMode = 1;
    conf::soundSystem = 2;
    conf::soundDeviceOut = 3;
    conf::soundDeviceIn = 4;
    conf::channelsOut = 5;
    conf::channelsIn = 6;
    conf::samplerate = 7;
    conf::buffersize = 8;
    conf::delayComp = 9;
    conf::limitOutput = true;
    conf::rsmpQuality = 10;
    conf::midiSystem = 11;
    conf::midiPortOut = 12;
    conf::midiPortIn = 13;
    conf::midiMapPath = "path/to/midi/map";
    conf::lastFileMap = "path/to/last/midi/map";
    conf::midiSync = 14;
    conf::midiTCfps = 15.1f;
    conf::midiInRewind = 16;
    conf::midiInStartStop = 17;
    conf::midiInActionRec = 18;
    conf::midiInInputRec = 19;
    conf::midiInMetronome = 20;
    conf::midiInVolumeIn = 21;
    conf::midiInVolumeOut = 22;
    conf::midiInBeatDouble = 23;
    conf::midiInBeatHalf = 24;
    conf::recsStopOnChanHalt = true;
    conf::chansStopOnSeqHalt = false;
    conf::treatRecsAsLoops = true;
    conf::resizeRecordings = false;
    conf::pluginPath = "path/to/plugins";
    conf::patchPath = "path/to/patches";
    conf::samplePath = "path/to/samples";
    conf::mainWindowX = 0;
    conf::mainWindowY = 0;
    conf::mainWindowW = 800;
    conf::mainWindowH = 600;
    conf::browserX = 0;
    conf::browserY = 0;
    conf::browserW = 800;
    conf::browserH = 600;
    conf::actionEditorX = 0;
    conf::actionEditorY = 0;
    conf::actionEditorW = 800;
    conf::actionEditorH = 600;
    conf::actionEditorZoom = 1;
    conf::actionEditorGridVal = 10;
    conf::actionEditorGridOn = 1;
    conf::sampleEditorX = 0;
    conf::sampleEditorY = 0;
    conf::sampleEditorW = 800;
    conf::sampleEditorH = 600;
    conf::sampleEditorGridVal = 4;
    conf::sampleEditorGridOn = 0;
    conf::pianoRollY = 0;
    conf::pianoRollH = 900;
    conf::pluginListX = 0;
    conf::pluginListY = 50;
    conf::configX = 20;
    conf::configY = 20;
    conf::bpmX = 30;
    conf::bpmY = 36;
    conf::beatsX = 1;
    conf::beatsY = 1;
    conf::aboutX = 2;
    conf::aboutY = 2;

    REQUIRE(conf::write() == 1);
  }

  SECTION("test read")
  {
    REQUIRE(conf::read() == 1);
    REQUIRE(conf::header == "GIADACONFTEST");
    REQUIRE(conf::logMode == 1);
    REQUIRE(conf::soundSystem == 2);
    REQUIRE(conf::soundDeviceOut == 3);
    REQUIRE(conf::soundDeviceIn == 4);
    REQUIRE(conf::channelsOut == 5);
    REQUIRE(conf::channelsIn == 6);
    REQUIRE(conf::samplerate == 44100);  // sanitized
    REQUIRE(conf::buffersize == 8);
    REQUIRE(conf::delayComp == 9);
    REQUIRE(conf::limitOutput == true);
    REQUIRE(conf::rsmpQuality == 0); // sanitized
    REQUIRE(conf::midiSystem == 11);
    REQUIRE(conf::midiPortOut == 12);
    REQUIRE(conf::midiPortIn == 13);
    REQUIRE(conf::midiMapPath == "path/to/midi/map");
    REQUIRE(conf::lastFileMap == "path/to/last/midi/map");
    REQUIRE(conf::midiSync == 14);
    REQUIRE(conf::midiTCfps == Approx(15.1));
    REQUIRE(conf::midiInRewind == 16);
    REQUIRE(conf::midiInStartStop == 17);
    REQUIRE(conf::midiInActionRec == 18);
    REQUIRE(conf::midiInInputRec == 19);
    REQUIRE(conf::midiInMetronome == 20);
    REQUIRE(conf::midiInVolumeIn == 21);
    REQUIRE(conf::midiInVolumeOut == 22);
    REQUIRE(conf::midiInBeatDouble == 23);
    REQUIRE(conf::midiInBeatHalf == 24);
    REQUIRE(conf::recsStopOnChanHalt == true);
    REQUIRE(conf::chansStopOnSeqHalt == false);
    REQUIRE(conf::treatRecsAsLoops == true);
    REQUIRE(conf::resizeRecordings == false);
    REQUIRE(conf::pluginPath == "path/to/plugins");
    REQUIRE(conf::patchPath == "path/to/patches");
    REQUIRE(conf::samplePath == "path/to/samples");
    REQUIRE(conf::mainWindowX == 0);
    REQUIRE(conf::mainWindowY == 0);
    REQUIRE(conf::mainWindowW == 800);
    REQUIRE(conf::mainWindowH == 600);
    REQUIRE(conf::browserX == 0);
    REQUIRE(conf::browserY == 0);
    REQUIRE(conf::browserW == 800);
    REQUIRE(conf::browserH == 600);
    REQUIRE(conf::actionEditorX == 0);
    REQUIRE(conf::actionEditorY == 0);
    REQUIRE(conf::actionEditorW == 800);
    REQUIRE(conf::actionEditorH == 600);
    REQUIRE(conf::actionEditorZoom == 100);  // sanitized
    REQUIRE(conf::actionEditorGridVal == 10);
    REQUIRE(conf::actionEditorGridOn == 1);
    REQUIRE(conf::sampleEditorX == 0);
    REQUIRE(conf::sampleEditorY == 0);
    REQUIRE(conf::sampleEditorW == 800);
    REQUIRE(conf::sampleEditorH == 600);
    REQUIRE(conf::sampleEditorGridVal == 4);
    REQUIRE(conf::sampleEditorGridOn == 0);
    REQUIRE(conf::pianoRollY == 0);
    REQUIRE(conf::pianoRollH == 900);
    REQUIRE(conf::pluginListX == 0);
    REQUIRE(conf::pluginListY == 50);
    REQUIRE(conf::configX == 20);
    REQUIRE(conf::configY == 20);
    REQUIRE(conf::bpmX == 30);
    REQUIRE(conf::bpmY == 36);
    REQUIRE(conf::beatsX == 1);
    REQUIRE(conf::beatsY == 1);
    REQUIRE(conf::aboutX == 2);
    REQUIRE(conf::aboutY == 2);
  }
}