5
5
* License: GNU General Public License version 2.0
6
6
*/
7
7
8
- #include < string>
9
- #include < sstream>
10
- #include < iomanip>
11
- #include < map>
12
8
#include < WDL/db2val.h>
9
+
13
10
#include < cstdint>
14
- #include " osara.h"
11
+ #include < iomanip>
12
+ #include < map>
13
+ #include < sstream>
14
+ #include < string>
15
+
15
16
#include " config.h"
16
- #include " paramsUi.h"
17
17
#include " midiEditorCommands.h"
18
+ #include " osara.h"
19
+ #include " paramsUi.h"
18
20
#include " translation.h"
19
21
20
22
using namespace std ;
@@ -39,7 +41,7 @@ const uint8_t TC_UNARMED = 1 << 5;
39
41
template <uint8_t enableFlag, uint8_t disableFlag>
40
42
class TrackCacheState {
41
43
public:
42
- TrackCacheState (uint8_t & value): value(value) {}
44
+ TrackCacheState (uint8_t & value) : value(value) {}
43
45
44
46
// Check if a supplied new state has changed from the cached state.
45
47
bool hasChanged (bool isEnabled) {
@@ -64,9 +66,10 @@ class TrackCacheState {
64
66
uint8_t & value;
65
67
};
66
68
67
- /* ** A control surface to obtain certain info that can only be retrieved that way.
69
+ /* ** A control surface to obtain certain info that can only be retrieved that
70
+ * way.
68
71
*/
69
- class Surface : public IReaperControlSurface {
72
+ class Surface : public IReaperControlSurface {
70
73
public:
71
74
virtual const char * GetTypeString () override {
72
75
return " OSARA" ;
@@ -146,8 +149,7 @@ class Surface: public IReaperControlSurface {
146
149
return ;
147
150
}
148
151
auto cache = this ->cachedTrackState <TC_MUTED, TC_UNMUTED>(track);
149
- if (!isParamsDialogOpen && !this ->wasCausedByCommand () &&
150
- cache.hasChanged (mute)) {
152
+ if (!isParamsDialogOpen && !this ->wasCausedByCommand () && cache.hasChanged (mute)) {
151
153
ostringstream s;
152
154
this ->reportTrackIfDifferent (track, s);
153
155
s << (mute ? translate (" muted" ) : translate (" unmuted" ));
@@ -166,8 +168,7 @@ class Surface: public IReaperControlSurface {
166
168
return ;
167
169
}
168
170
auto cache = this ->cachedTrackState <TC_SOLOED, TC_UNSOLOED>(track);
169
- if (!isParamsDialogOpen && !this ->wasCausedByCommand () &&
170
- cache.hasChanged (solo)) {
171
+ if (!isParamsDialogOpen && !this ->wasCausedByCommand () && cache.hasChanged (solo)) {
171
172
ostringstream s;
172
173
this ->reportTrackIfDifferent (track, s);
173
174
s << (solo ? translate (" soloed" ) : translate (" unsoloed" ));
@@ -181,8 +182,7 @@ class Surface: public IReaperControlSurface {
181
182
return ;
182
183
}
183
184
auto cache = this ->cachedTrackState <TC_ARMED, TC_UNARMED>(track);
184
- if (!isParamsDialogOpen && !this ->wasCausedByCommand () &&
185
- cache.hasChanged (arm)) {
185
+ if (!isParamsDialogOpen && !this ->wasCausedByCommand () && cache.hasChanged (arm)) {
186
186
ostringstream s;
187
187
this ->reportTrackIfDifferent (track, s);
188
188
s << (arm ? translate (" armed" ) : translate (" unarmed" ));
@@ -214,7 +214,8 @@ class Surface: public IReaperControlSurface {
214
214
postGoToTrack (0 , track);
215
215
}
216
216
217
- virtual int Extended (int call, void * parm1, void * parm2, void * parm3) override {
217
+ virtual int Extended (int call, void * parm1, void * parm2, void * parm3)
218
+ override {
218
219
if (call == CSURF_EXT_SETFXPARAM) {
219
220
if (!this ->shouldHandleParamChange ()) {
220
221
return 0 ; // Unsupported.
@@ -243,8 +244,9 @@ class Surface: public IReaperControlSurface {
243
244
s << chunk << " " ;
244
245
}
245
246
this ->lastParam = param;
246
- TrackFX_FormatParamValueNormalized (track, fx, param, normVal, chunk,
247
- sizeof (chunk));
247
+ TrackFX_FormatParamValueNormalized (
248
+ track, fx, param, normVal, chunk, sizeof (chunk)
249
+ );
248
250
if (chunk[0 ]) {
249
251
s << chunk;
250
252
} else {
@@ -276,14 +278,15 @@ class Surface: public IReaperControlSurface {
276
278
// Only handle param changes if the last change was 100ms or more ago.
277
279
return now - prevChangeTime >= 100 ;
278
280
}
281
+
279
282
DWORD lastParamChangeTime = 0 ;
280
283
281
284
bool reportTrackIfDifferent (MediaTrack* track, ostringstream& output) {
282
285
bool different = track != this ->lastChangedTrack ;
283
286
if (different) {
284
287
this ->lastChangedTrack = track;
285
- int trackNum = ( int )( size_t ) GetSetMediaTrackInfo (track, " IP_TRACKNUMBER " ,
286
- nullptr );
288
+ int trackNum =
289
+ ( int )( size_t ) GetSetMediaTrackInfo (track, " IP_TRACKNUMBER " , nullptr );
287
290
if (trackNum <= 0 ) {
288
291
output << translate (" master" );
289
292
} else {
0 commit comments