aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/ui_hd24trackchannel.fl
blob: 748313e8dd106a292e61a32076248bf1c3c02b7b (plain)
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# data file for the Fltk User Interface Designer (fluid)
version 1.0107 
header_name {.h} 
code_name {.cxx}
decl {\#include <config.h>} {public
} 

decl {\#include <FL/FLTKstuff.H>} {public
} 

decl {\#include <ui_hd24connect.h>} {public
} 

class HD24TrackChannel {open : {public Fl_Group}
} {
  decl {\#define PEAKMODE_NOHOLD 0} {public
  }
  decl {\#define PEAKMODE_TEMPHOLD 1} {public
  }
  decl {\#define PEAKMODE_CONTHOLD 2} {public
  }
  decl {\#define PEAKMODE_MAXHOLD 33} {public
  }
  decl {int mode;} {}
  decl {int maxledslit; /* for peak hold */} {public
  }
  decl {int holdtime;} {public
  }
  decl {RecorderUI* ui;} {selected
  }
  decl {Fl_Box* levelled[10];} {public
  }
  decl {Fl_Window* win;} {}
  decl {unsigned int channel;} {}
  Function {make_window()} {open
  } {
    Fl_Window ledchannel {open
      xywh {20 74 20 120} type Double color 0 labelcolor 7
      code0 {o->position(parent()->x(),parent()->y());}
      class Fl_Group visible
    } {
      Fl_Box tracknum {
        label 1
        xywh {3 76 12 6} box FLAT_BOX color 0 labelfont 1 labelsize 10 labelcolor 6 align 2
      }
      Fl_Box led1 {
        xywh {3 76 12 6} box FLAT_BOX color 6 labelfont 1 labelsize 10 labelcolor 6 align 2 hide
        code0 {levelled[0]=led1;}
      }
      Fl_Box recled {
        xywh {3 96 12 6} box FLAT_BOX color 1 labelfont 1 labelsize 10 labelcolor 1 align 2 hide
      }
      Fl_Box inputled {
        xywh {3 104 12 6} box FLAT_BOX color 6 labelfont 1 labelsize 10 labelcolor 6 align 2 hide
      }
      Fl_Box led2 {
        xywh {3 68 12 6} box FLAT_BOX color 6 labelfont 1 labelsize 10 labelcolor 6 align 2 hide
        code0 {levelled[1]=led2;}
      }
      Fl_Box led3 {
        xywh {3 60 12 6} box FLAT_BOX color 6 labelfont 1 labelsize 10 labelcolor 6 align 2 hide
        code0 {levelled[2]=led3;}
      }
      Fl_Box led4 {
        xywh {3 52 12 6} box FLAT_BOX color 6 labelfont 1 labelsize 10 labelcolor 6 align 2 hide
        code0 {levelled[3]=led4;}
      }
      Fl_Box led5 {
        xywh {3 44 12 6} box FLAT_BOX color 6 labelfont 1 labelsize 10 labelcolor 6 align 2 hide
        code0 {levelled[4]=led5;}
      }
      Fl_Box led6 {
        xywh {3 36 12 6} box FLAT_BOX color 6 labelfont 1 labelsize 10 labelcolor 6 align 2 hide
        code0 {levelled[5]=led6;}
      }
      Fl_Box led7 {
        xywh {3 28 12 6} box FLAT_BOX color 93 labelfont 1 labelsize 10 labelcolor 93 align 2 hide
        code0 {levelled[6]=led7;}
      }
      Fl_Box led8 {
        xywh {3 20 12 6} box FLAT_BOX color 93 labelfont 1 labelsize 10 labelcolor 93 align 2 hide
        code0 {levelled[7]=led8;}
      }
      Fl_Box led9 {
        xywh {3 12 12 6} box FLAT_BOX color 93 labelfont 1 labelsize 10 labelcolor 93 align 2 hide
        code0 {levelled[8]=led9;}
      }
      Fl_Box led10 {
        xywh {3 4 12 6} box FLAT_BOX color 1 labelfont 1 labelsize 10 labelcolor 1 align 2 hide
        code0 {levelled[9]=led10;}
      }
    }
  }
  Function {setval(float levelval)} {open
  } {
    code {int lednum=0;
double myval=(double)levelval;

// reset peaks if desired
switch (mode) {
	case PEAKMODE_NOHOLD: this->peakreset(); break;	
	case PEAKMODE_TEMPHOLD: 		
		if (this->holdtime>PEAKMODE_MAXHOLD) {
			peakreset(); 
		} else {
			this->holdtime++;
		}
		break;	
	case PEAKMODE_CONTHOLD:
		break;
	default:
		this->mode=PEAKMODE_NOHOLD;
		peakreset();
		break;
}

int ledslit=0;

if (myval>= ledlimit[lednum]) { ledslit=1; this->levelled[lednum++]->show(); } else { this->levelled[lednum++]->hide(); }
if (myval>= ledlimit[lednum]) { ledslit=2; this->levelled[lednum++]->show(); } else { this->levelled[lednum++]->hide(); }
if (myval>= ledlimit[lednum]) { ledslit=3; this->levelled[lednum++]->show(); } else { this->levelled[lednum++]->hide(); }
if (myval>= ledlimit[lednum]) { ledslit=4; this->levelled[lednum++]->show(); } else { this->levelled[lednum++]->hide(); }
if (myval>= ledlimit[lednum]) { ledslit=5; this->levelled[lednum++]->show(); } else { this->levelled[lednum++]->hide(); }
if (myval>= ledlimit[lednum]) { ledslit=6; this->levelled[lednum++]->show(); } else { this->levelled[lednum++]->hide(); }
if (myval>= ledlimit[lednum]) { ledslit=7; this->levelled[lednum++]->show(); } else { this->levelled[lednum++]->hide(); }
if (myval>= ledlimit[lednum]) { ledslit=8; this->levelled[lednum++]->show(); } else { this->levelled[lednum++]->hide(); }
if (myval>= ledlimit[lednum]) { ledslit=9; this->levelled[lednum++]->show(); } else { this->levelled[lednum++]->hide(); }
if (myval>= ledlimit[lednum]) { ledslit=10; this->levelled[lednum++]->show(); } else { this->levelled[lednum++]->hide(); }

if (ledslit >this->maxledslit  ) {
	this->maxledslit=ledslit;
	this->holdtime=0;
} else {
	if ((this->maxledslit)>0) {
		this->levelled[maxledslit-1]->show();
	}
}

checkblink();} {}
  }
  Function {init_window()} {open return_type void
  } {
    code {this->mode=PEAKMODE_NOHOLD;
this->win=(Fl_Window*)make_window();
this->ui=NULL;
this->channel=0;
this->maxledslit=0;
this->holdtime=0;
this->ledlimit[0]=(double)pow(10,(double)((double)-30/(double)10)); // -30 dB
this->ledlimit[1]=(double)pow(10,(double)((double)-24/(double)10)); // -24 dB
this->ledlimit[2]=(double)pow(10,(double)((double)-18/(double)10)); 
this->ledlimit[3]=(double)pow(10,(double)((double)-12/(double)10)); //...
this->ledlimit[4]=(double)pow(10,(double)((double)-7.5/(double)10));
this->ledlimit[5]=(double)pow(10,(double)((double)-4.5/(double)10));
this->ledlimit[6]=(double)pow(10,(double)((double)-3/(double)10)); 
this->ledlimit[7]=(double)pow(10,(double)((double)-1.5/(double)10));
this->ledlimit[8]=(double)pow(10,(double)((double)-.5/(double)10)); 
this->ledlimit[9]=(double)pow(10,(double)((double)0/(double)10)); // -0 dB

this->setval(0);

return;} {}
  }
  Function {HD24TrackChannel(int a,int b,int c,int d,const char* e):Fl_Group(a,b,c,d,e)} {open
  } {
    code {init_window();} {}
  }
  Function {HD24TrackChannel(int a,int b,int c,int d):Fl_Group(a,b,c,d,NULL)} {open
  } {
    code {init_window();} {}
  }
  Function {setchnum(__uint32 i)} {open
  } {
    code {/* As copy_label does not work on older versions of fltk,
   the label now persists within the object but outside this
   function. This solves the problem that is nowadays addressed
   by copy_label, but without requiring an up-to-date version
   of FLTK (1.1.6 or later). */
channel=i;
snprintf(&labeltext[0],8,"%ld",i);
this->tracknum->label(labeltext);} {}
  }
  Function {setui(RecorderUI* p_ui)} {open
  } {
    code {this->ui=p_ui;} {}
  }
  Function {checkblink()} {open
  } {
    code {if (ui==NULL) return;
/*
TODO: Make available
if (ui->currenthd24==NULL) return;
*/
if (channel==0) return;


bool showinputled=false;
/*
if (ui->currenthd24->isallinput()) {
	if (ui->control->song()==NULL) {
		// no song, show all input leds
		showinputled=true;
	} else {
		// song selected, only show as many 
		// input leds as channels in the song
		if (channel<=ui->control->song()->logical_channels()) {
			showinputled=ui->control->song()->istrackmonitoringinput(channel);			
		}		
	}
} else {
*/
	if (ui->control->song()!=NULL) {
			showinputled=ui->control->song()->istrackmonitoringinput(channel);			
	}
/*
}
*/

if (ui->control->song()!=NULL) {
if (ui->control->song()->logical_channels()<channel) {
   this->recled->hide();
} else {
	if (ui->control->song()->trackarmed(channel)) {
		if (ui->blinkcounter<8) {
		   this->recled->hide();  
		} else {
		   this->recled->show(); 
		}
	} else {
		this->recled->hide(); 
	}
}
}
if (showinputled) {
	this->inputled->show();
} else {
	this->inputled->hide();  
}

return;} {}
  }
  decl {double ledlimit[10];} {}
  Function {peakreset()} {return_type void
  } {
    code {maxledslit=0;
holdtime=0;} {}
  }
  Function {peakmode(int p_peakmode)} {return_type void
  } {
    code {this->mode=p_peakmode;
peakreset();} {}
  }
  decl {char labeltext[10];} {}
} 

class TrackInfo {: {public Fl_Group}
} {
  Function {make_window()} {} {
    Fl_Window ledchannel {
      xywh {5 69 20 120} type Double color 0 labelcolor 7 align 16 hide
      code0 {o->position(parent()->x(),parent()->y());}
      class Fl_Group
    } {
      Fl_Box led1 {
        label {-60}
        xywh {3 76 12 6} box FLAT_BOX color 0 labelfont 1 labelsize 9 labelcolor 6 align 16
      }
      Fl_Box recled {
        label REC
        xywh {3 96 12 6} box FLAT_BOX color 0 labelfont 1 labelsize 9 labelcolor 1 align 16
      }
      Fl_Box inputled {
        label INP
        xywh {3 104 12 6} box FLAT_BOX color 0 labelfont 1 labelsize 9 labelcolor 6 align 16
      }
      Fl_Box led2 {
        label {-48}
        xywh {3 68 12 6} box FLAT_BOX color 0 labelfont 1 labelsize 9 labelcolor 6 align 16
      }
      Fl_Box led3 {
        label {-36}
        xywh {3 60 12 6} box FLAT_BOX color 0 labelfont 1 labelsize 9 labelcolor 6 align 16
      }
      Fl_Box led4 {
        label {-24}
        xywh {3 52 12 6} box FLAT_BOX color 0 labelfont 1 labelsize 9 labelcolor 6 align 16
      }
      Fl_Box led5 {
        label {-15}
        xywh {3 44 12 6} box FLAT_BOX color 0 labelfont 1 labelsize 9 labelcolor 1 align 16
      }
      Fl_Box led6 {
        label {-9}
        xywh {3 36 12 6} box FLAT_BOX color 0 labelfont 1 labelsize 9 labelcolor 6 align 16
      }
      Fl_Box led7 {
        label {-6}
        xywh {3 28 12 6} box FLAT_BOX color 0 labelfont 1 labelsize 9 labelcolor 93 align 16
      }
      Fl_Box led8 {
        label {-3}
        xywh {3 20 12 6} box FLAT_BOX color 0 labelfont 1 labelsize 9 labelcolor 93 align 16
      }
      Fl_Box led9 {
        label {-1}
        xywh {3 12 12 6} box FLAT_BOX color 0 labelfont 1 labelsize 9 labelcolor 93 align 16
      }
      Fl_Box led10 {
        label CLIP
        xywh {0 4 22 6} box FLAT_BOX color 0 labelfont 1 labelsize 8 labelcolor 1 align 16
      }
    }
  }
  Function {TrackInfo(int a,int b,int c,int d,const char* e):Fl_Group(a,b,c,d,e)} {open
  } {
    code {make_window();} {}
  }
  Function {TrackInfo(int a,int b,int c,int d):Fl_Group(a,b,c,d,NULL)} {open
  } {
    code {make_window();} {}
  }
}