|
@@ -0,0 +1,509 @@
|
|
1
|
+#include "cmGlobal.h"
|
|
2
|
+#include "cmFloatTypes.h"
|
|
3
|
+#include "cmRpt.h"
|
|
4
|
+#include "cmErr.h"
|
|
5
|
+#include "cmCtx.h"
|
|
6
|
+#include "cmMem.h"
|
|
7
|
+#include "cmMallocDebug.h"
|
|
8
|
+#include "cmJson.h"
|
|
9
|
+#include "cmThread.h"
|
|
10
|
+#include "cmUdpPort.h"
|
|
11
|
+#include "cmUdpNet.h"
|
|
12
|
+#include "cmRtSysMsg.h"
|
|
13
|
+#include "cmRtSys.h"
|
|
14
|
+#include "cmUiDrvr.h"
|
|
15
|
+#include "cmUi.h"
|
|
16
|
+#include "cmUiRtSysMstr.h"
|
|
17
|
+
|
|
18
|
+enum
|
|
19
|
+{
|
|
20
|
+ kLabelAmId,
|
|
21
|
+ kInSliderAmId,
|
|
22
|
+ kInMeterAmId,
|
|
23
|
+ kInToneAmId,
|
|
24
|
+ kInPassAmId,
|
|
25
|
+ kInMuteAmId,
|
|
26
|
+ kOutSliderAmId,
|
|
27
|
+ kOutMeterAmId,
|
|
28
|
+ kOutToneAmId,
|
|
29
|
+ kOutPassAmId,
|
|
30
|
+ kOutMuteAmId,
|
|
31
|
+ kAmCnt
|
|
32
|
+};
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+enum
|
|
36
|
+{
|
|
37
|
+ kMinDb = 24,
|
|
38
|
+ kMaxDb = -24,
|
|
39
|
+ kMtrMin = 0,
|
|
40
|
+ kMtrMax = 100
|
|
41
|
+};
|
|
42
|
+
|
|
43
|
+typedef struct cmAmPanel_str
|
|
44
|
+{
|
|
45
|
+ unsigned rtSubIdx;
|
|
46
|
+
|
|
47
|
+ unsigned panelId;
|
|
48
|
+
|
|
49
|
+ unsigned updateId;
|
|
50
|
+ unsigned wakeupId;
|
|
51
|
+ unsigned msgCbId;
|
|
52
|
+ unsigned audioCbId;
|
|
53
|
+
|
|
54
|
+ unsigned updateCnt;
|
|
55
|
+ unsigned wakeupCnt;
|
|
56
|
+ unsigned msgCbCnt;
|
|
57
|
+ unsigned audioCbCnt;
|
|
58
|
+
|
|
59
|
+ unsigned baseOutId;
|
|
60
|
+ unsigned iDevIdx;
|
|
61
|
+ unsigned oDevIdx;
|
|
62
|
+ unsigned iChCnt;
|
|
63
|
+ unsigned oChCnt;
|
|
64
|
+
|
|
65
|
+ unsigned a[ kAmCnt ];
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+ struct cmAmPanel_str* link;
|
|
69
|
+} cmAmPanel_t;
|
|
70
|
+
|
|
71
|
+typedef struct
|
|
72
|
+{
|
|
73
|
+ cmErr_t err;
|
|
74
|
+ unsigned appId;
|
|
75
|
+ cmUiH_t uiH;
|
|
76
|
+ cmRtSysH_t asH;
|
|
77
|
+ unsigned nextId;
|
|
78
|
+ cmAmPanel_t* list;
|
|
79
|
+} cmAm_t;
|
|
80
|
+
|
|
81
|
+cmUiRtMstrH_t cmUiRtMstrNullHandle = cmSTATIC_NULL_HANDLE;
|
|
82
|
+
|
|
83
|
+cmAm_t* _cmUiAmHandleToPtr( cmUiRtMstrH_t h )
|
|
84
|
+{
|
|
85
|
+ cmAm_t* p = (cmAm_t*)h.h;
|
|
86
|
+ assert( p!=NULL);
|
|
87
|
+ return p;
|
|
88
|
+}
|
|
89
|
+
|
|
90
|
+cmAmRC_t _cmUiAmFreePanels( cmAm_t* p, bool callDriverFl )
|
|
91
|
+{
|
|
92
|
+ cmAmRC_t rc = kOkAmRC;
|
|
93
|
+ cmAmPanel_t* pp = p->list;
|
|
94
|
+
|
|
95
|
+ while( pp != NULL )
|
|
96
|
+ {
|
|
97
|
+ cmAmPanel_t* np = pp->link;
|
|
98
|
+
|
|
99
|
+ unsigned panelId = pp->panelId;
|
|
100
|
+
|
|
101
|
+ if( callDriverFl )
|
|
102
|
+ if( cmUiClearPanel( p->uiH, p->appId, panelId ) != kOkUiRC )
|
|
103
|
+ {
|
|
104
|
+ rc = cmErrMsg(&p->err,kUiFailAmRC,"The panel %i clear failed.",panelId);
|
|
105
|
+ goto errLabel;
|
|
106
|
+ }
|
|
107
|
+
|
|
108
|
+ cmMemFree(pp);
|
|
109
|
+
|
|
110
|
+ pp = np;
|
|
111
|
+ }
|
|
112
|
+
|
|
113
|
+ p->nextId = 0;
|
|
114
|
+ p->list = NULL;
|
|
115
|
+
|
|
116
|
+ errLabel:
|
|
117
|
+ return rc;
|
|
118
|
+}
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+cmAmRC_t _cmUiAmFree( cmAm_t* p )
|
|
122
|
+{
|
|
123
|
+ _cmUiAmFreePanels(p,false);
|
|
124
|
+
|
|
125
|
+ if( cmUiDestroyApp( p->uiH, p->appId ) != kOkUiRC )
|
|
126
|
+ cmErrMsg(&p->err,kUiFailAmRC,"UI Mgr. app destroy failed.");
|
|
127
|
+
|
|
128
|
+ cmMemFree(p);
|
|
129
|
+ return kOkAmRC;
|
|
130
|
+}
|
|
131
|
+
|
|
132
|
+cmAmRC_t cmUiRtSysMstrAlloc( cmCtx_t* ctx, cmUiRtMstrH_t* hp, cmUiH_t uiH, cmRtSysH_t asH, unsigned appId )
|
|
133
|
+{
|
|
134
|
+ cmAmRC_t rc = kOkAmRC;
|
|
135
|
+
|
|
136
|
+ if((rc = cmUiRtSysMstrFree(hp)) != kOkAmRC )
|
|
137
|
+ return rc;
|
|
138
|
+
|
|
139
|
+ cmAm_t* p = cmMemAllocZ(cmAm_t,1);
|
|
140
|
+ cmErrSetup(&p->err,&ctx->rpt,"Audio System Master UI");
|
|
141
|
+
|
|
142
|
+ p->appId = appId;
|
|
143
|
+ p->uiH = uiH;
|
|
144
|
+ p->asH = asH;
|
|
145
|
+ p->nextId = 0;
|
|
146
|
+
|
|
147
|
+ // allocate the UI Mgr. app. slot for the audio system master control UI.
|
|
148
|
+ if( cmUiCreateApp( uiH, appId, cmInvalidId ) != kOkUiRC )
|
|
149
|
+ {
|
|
150
|
+ rc = cmErrMsg(&p->err,kUiFailAmRC,"The UI Mgr. failed while creating the Audio System UI app. slot.");
|
|
151
|
+ goto errLabel;
|
|
152
|
+ }
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+ hp->h = p;
|
|
156
|
+ errLabel:
|
|
157
|
+ if( rc != kOkAmRC )
|
|
158
|
+ _cmUiAmFree(p);
|
|
159
|
+ return rc;
|
|
160
|
+}
|
|
161
|
+
|
|
162
|
+cmAmRC_t cmUiRtSysMstrFree( cmUiRtMstrH_t* hp )
|
|
163
|
+{
|
|
164
|
+ cmAmRC_t rc = kOkAmRC;
|
|
165
|
+
|
|
166
|
+ if(hp==NULL || cmUiRtSysMstrIsValid(*hp)==false )
|
|
167
|
+ return kOkAmRC;
|
|
168
|
+
|
|
169
|
+ cmAm_t* p = _cmUiAmHandleToPtr(*hp);
|
|
170
|
+
|
|
171
|
+ if((rc = _cmUiAmFree(p)) != kOkAmRC )
|
|
172
|
+ return rc;
|
|
173
|
+
|
|
174
|
+ hp->h = NULL;
|
|
175
|
+
|
|
176
|
+ return rc;
|
|
177
|
+}
|
|
178
|
+
|
|
179
|
+bool cmUiRtSysMstrIsValid( cmUiRtMstrH_t h )
|
|
180
|
+{ return h.h != NULL; }
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+cmAmRC_t cmUiRtSysMstrInitialize( cmUiRtMstrH_t amH, const cmRtSysCtx_t* c, const cmChar_t* inDevLabel, const cmChar_t* outDevLabel )
|
|
184
|
+{
|
|
185
|
+ cmAmRC_t rc = kOkAmRC;
|
|
186
|
+ cmAm_t* p = _cmUiAmHandleToPtr(amH);
|
|
187
|
+ cmUiH_t uiH = p->uiH;
|
|
188
|
+ unsigned panelId = cmInvalidId;
|
|
189
|
+ unsigned colW = 50;
|
|
190
|
+ unsigned ctlW = 45;
|
|
191
|
+ unsigned n = 31;
|
|
192
|
+ cmChar_t chNumStr[ n+1 ];
|
|
193
|
+ int w;
|
|
194
|
+ cmAmPanel_t* pp = NULL;
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+ // This function is called once for each audio sub-system.
|
|
198
|
+ // If this is the first call in the sequence then clear the previous setup.
|
|
199
|
+ if( c->rtSubIdx == 0 )
|
|
200
|
+ {
|
|
201
|
+ if((rc = _cmUiAmFreePanels(p,true)) != kOkAmRC )
|
|
202
|
+ goto errLabel;
|
|
203
|
+
|
|
204
|
+ assert(p->list == NULL );
|
|
205
|
+ }
|
|
206
|
+
|
|
207
|
+ // create the panel recd and link it to the beginning of the list
|
|
208
|
+ pp = cmMemAllocZ(cmAmPanel_t,1);
|
|
209
|
+
|
|
210
|
+ pp->link = p->list;
|
|
211
|
+ p->list = pp;
|
|
212
|
+ pp->rtSubIdx = c->rtSubIdx;
|
|
213
|
+ pp->iDevIdx = c->ss->args.inDevIdx;
|
|
214
|
+ pp->oDevIdx = c->ss->args.outDevIdx;
|
|
215
|
+ pp->iChCnt = c->iChCnt;
|
|
216
|
+ pp->oChCnt = c->oChCnt;
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+ pp->panelId = p->nextId++;
|
|
220
|
+ pp->updateId = p->nextId++;
|
|
221
|
+ pp->wakeupId = p->nextId++;
|
|
222
|
+ pp->msgCbId = p->nextId++;
|
|
223
|
+ pp->audioCbId = p->nextId++;
|
|
224
|
+
|
|
225
|
+ pp->a[kLabelAmId] = p->nextId;
|
|
226
|
+ pp->a[kInSliderAmId] = p->nextId += c->iChCnt;
|
|
227
|
+ pp->a[kInMeterAmId] = p->nextId += c->iChCnt;
|
|
228
|
+ pp->a[kInToneAmId] = p->nextId += c->iChCnt;
|
|
229
|
+ pp->a[kInPassAmId] = p->nextId += c->iChCnt;
|
|
230
|
+ pp->a[kInMuteAmId] = p->nextId += c->iChCnt;
|
|
231
|
+
|
|
232
|
+ pp->baseOutId = p->nextId += c->iChCnt;
|
|
233
|
+
|
|
234
|
+ pp->a[kOutSliderAmId] = pp->baseOutId;
|
|
235
|
+ pp->a[kOutMeterAmId] = p->nextId += c->oChCnt;
|
|
236
|
+ pp->a[kOutToneAmId] = p->nextId += c->oChCnt;
|
|
237
|
+ pp->a[kOutPassAmId] = p->nextId += c->oChCnt;
|
|
238
|
+ pp->a[kOutMuteAmId] = p->nextId += c->oChCnt;
|
|
239
|
+ p->nextId += c->oChCnt;
|
|
240
|
+
|
|
241
|
+ panelId = pp->panelId;
|
|
242
|
+
|
|
243
|
+ if( cmUiCreatePanel(uiH, p->appId, panelId, "Master", 0 ) != kOkUiRC )
|
|
244
|
+ {
|
|
245
|
+ rc = cmErrMsg(&p->err,kUiFailAmRC,"Panel %i create failed.",panelId);
|
|
246
|
+ goto errLabel;
|
|
247
|
+ }
|
|
248
|
+
|
|
249
|
+ cmUiSetFillRows( uiH, p->appId, panelId, true );
|
|
250
|
+ cmUiCreateProgress(uiH, p->appId, panelId, pp->updateId, "Update", 0, 0, 1, 0 );
|
|
251
|
+ cmUiCreateProgress(uiH, p->appId, panelId, pp->wakeupId, "Wakeup", 0, 0, 1, 0 );
|
|
252
|
+ cmUiCreateProgress(uiH, p->appId, panelId, pp->msgCbId, "Message", 0, 0, 1, 0 );
|
|
253
|
+ cmUiCreateProgress(uiH, p->appId, panelId, pp->audioCbId,"Audio", 0, 0, 1, 0 );
|
|
254
|
+ cmUiSetFillRows( uiH, p->appId, panelId, false );
|
|
255
|
+
|
|
256
|
+ cmUiNewLine( uiH, p->appId, panelId );
|
|
257
|
+ cmUiCreateLabel( uiH, p->appId, panelId, cmInvalidId, inDevLabel, kInsideUiFl | kLeftUiFl );
|
|
258
|
+ cmUiNewLine( uiH, p->appId, panelId );
|
|
259
|
+
|
|
260
|
+ unsigned i;
|
|
261
|
+ for(i=0; i<c->iChCnt; ++i)
|
|
262
|
+ {
|
|
263
|
+ snprintf(chNumStr,n,"%i",i);
|
|
264
|
+
|
|
265
|
+ cmUiSetNextW( uiH, p->appId, panelId, ctlW );
|
|
266
|
+ cmUiCreateLabel( uiH, p->appId, panelId, cmInvalidId, chNumStr, 0 );
|
|
267
|
+ cmUiCreateVSlider(uiH, p->appId, panelId, pp->a[kInSliderAmId] + i, NULL, 0, kMinDb, kMaxDb, 0.1, 0 );
|
|
268
|
+ cmUiPlaceRight( uiH, p->appId, panelId );
|
|
269
|
+ cmUiCreateVMeter( uiH, p->appId, panelId, pp->a[kInMeterAmId] + i, NULL, 0, kMtrMin, kMtrMax, 0 );
|
|
270
|
+ w = cmUiSetW( uiH, p->appId, panelId, ctlW );
|
|
271
|
+ cmUiCreateCheck( uiH, p->appId, panelId, pp->a[kInToneAmId] + i, "T", 0, false );
|
|
272
|
+ cmUiCreateCheck( uiH, p->appId, panelId, pp->a[kInPassAmId] + i, "P", 0, false );
|
|
273
|
+ cmUiCreateCheck( uiH, p->appId, panelId, pp->a[kInMuteAmId] + i, "M", 0, false );
|
|
274
|
+ cmUiSetW( uiH, p->appId, panelId, w );
|
|
275
|
+ cmUiSetBaseCol( uiH, p->appId, panelId, 5 + (i+1)*colW);
|
|
276
|
+ }
|
|
277
|
+
|
|
278
|
+ cmUiSetBaseCol( uiH, p->appId, panelId, 0);
|
|
279
|
+ cmUiNewLine( uiH, p->appId, panelId );
|
|
280
|
+ cmUiCreateLabel( uiH,p->appId, panelId, cmInvalidId, outDevLabel, kInsideUiFl | kLeftUiFl );
|
|
281
|
+ cmUiNewLine( uiH, p->appId, panelId );
|
|
282
|
+
|
|
283
|
+ for(i=0; i<c->oChCnt; ++i)
|
|
284
|
+ {
|
|
285
|
+ snprintf(chNumStr,n,"%i",i);
|
|
286
|
+
|
|
287
|
+ cmUiSetNextW( uiH, p->appId, panelId, ctlW );
|
|
288
|
+ cmUiCreateLabel( uiH, p->appId, panelId, cmInvalidId, chNumStr, 0 );
|
|
289
|
+ cmUiCreateVSlider(uiH, p->appId, panelId, pp->a[kOutSliderAmId] + i, NULL, 0, kMinDb, kMaxDb, 0.1, 0 );
|
|
290
|
+ cmUiPlaceRight( uiH, p->appId, panelId );
|
|
291
|
+ cmUiCreateVMeter( uiH, p->appId, panelId, pp->a[kOutMeterAmId] + i, NULL, 0, kMtrMin, kMtrMax, 0 );
|
|
292
|
+ w = cmUiSetW( uiH, p->appId, panelId, ctlW );
|
|
293
|
+ cmUiCreateCheck( uiH, p->appId, panelId, pp->a[kOutToneAmId] + i, "T", 0, false );
|
|
294
|
+ cmUiCreateCheck( uiH, p->appId, panelId, pp->a[kOutPassAmId] + i, "P", 0, false );
|
|
295
|
+ cmUiCreateCheck( uiH, p->appId, panelId, pp->a[kOutMuteAmId] + i, "M", 0, false );
|
|
296
|
+ cmUiSetW( uiH, p->appId, panelId, w );
|
|
297
|
+ cmUiSetBaseCol( uiH, p->appId, panelId, 5 + (i+1)*colW);
|
|
298
|
+ }
|
|
299
|
+
|
|
300
|
+ errLabel:
|
|
301
|
+ return rc;
|
|
302
|
+}
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+cmAmPanel_t* _cmUiAmFindPanel( cmAm_t* p, unsigned panelId, bool errFl )
|
|
306
|
+{
|
|
307
|
+ cmAmPanel_t* pp = p->list;
|
|
308
|
+ for(; pp!=NULL; pp=pp->link)
|
|
309
|
+ if( pp->panelId == panelId )
|
|
310
|
+ return pp;
|
|
311
|
+
|
|
312
|
+ if( errFl )
|
|
313
|
+ cmErrMsg(&p->err,kPanelNotFoundAmRC,"The panel %i was not found.",panelId);
|
|
314
|
+
|
|
315
|
+ return NULL;
|
|
316
|
+}
|
|
317
|
+
|
|
318
|
+unsigned _cmUiAmCtlTypeId( cmAm_t* p, cmAmPanel_t* pp, cmUiCId_t cId, unsigned usrId,
|
|
319
|
+ unsigned sliderId, unsigned toneId, unsigned passId, unsigned muteId )
|
|
320
|
+{
|
|
321
|
+ switch( cId )
|
|
322
|
+ {
|
|
323
|
+ case kSliderUiCId:
|
|
324
|
+ assert( pp->a[sliderId] <= usrId && usrId < pp->a[sliderId]+pp->oChCnt);
|
|
325
|
+ return sliderId;
|
|
326
|
+ break;
|
|
327
|
+
|
|
328
|
+ case kCheckUiCId:
|
|
329
|
+ if( pp->a[toneId] <= usrId && usrId < pp->a[toneId]+pp->oChCnt )
|
|
330
|
+ return toneId;
|
|
331
|
+
|
|
332
|
+ if( pp->a[passId] <= usrId && usrId < pp->a[passId]+pp->oChCnt )
|
|
333
|
+ return passId;
|
|
334
|
+
|
|
335
|
+ if( pp->a[muteId] <= usrId && usrId < pp->a[muteId]+pp->oChCnt )
|
|
336
|
+ return muteId;
|
|
337
|
+ break;
|
|
338
|
+
|
|
339
|
+ default:
|
|
340
|
+ break;
|
|
341
|
+
|
|
342
|
+ }
|
|
343
|
+
|
|
344
|
+ return cmInvalidId;
|
|
345
|
+}
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+cmUiRC_t cmUiRtSysMstrOnUiEvent( cmUiRtMstrH_t h, const cmUiDriverArg_t* a )
|
|
349
|
+{
|
|
350
|
+ cmUiRC_t rc = kOkUiRC;
|
|
351
|
+ cmAm_t* p = _cmUiAmHandleToPtr(h);
|
|
352
|
+ cmAmPanel_t* pp;
|
|
353
|
+ cmRtSysMstr_t r;
|
|
354
|
+ unsigned typeId;
|
|
355
|
+ bool tabSelFl = a->dId==kSetValDId && a->cId == kPanelUiCId;
|
|
356
|
+
|
|
357
|
+ if((pp = _cmUiAmFindPanel( p, a->panelId, !tabSelFl )) == NULL)
|
|
358
|
+ {
|
|
359
|
+ if( tabSelFl )
|
|
360
|
+ return kOkUiRC;
|
|
361
|
+
|
|
362
|
+ return cmErrLastRC(&p->err);
|
|
363
|
+ }
|
|
364
|
+
|
|
365
|
+ // if the panel tab was selected/deslected ival will be equal to 1/0
|
|
366
|
+ if( a->usrId == pp->panelId )
|
|
367
|
+ {
|
|
368
|
+ cmRtSysStatusNotifyEnable(p->asH, pp->rtSubIdx, a->ival );
|
|
369
|
+ return rc;
|
|
370
|
+ }
|
|
371
|
+
|
|
372
|
+ // based on the usrId determine which control generated the event
|
|
373
|
+ if( a->usrId >= pp->baseOutId )
|
|
374
|
+ typeId = _cmUiAmCtlTypeId(p,pp,a->cId,a->usrId,kOutSliderAmId,kOutToneAmId,kOutPassAmId,kOutMuteAmId);
|
|
375
|
+ else
|
|
376
|
+ typeId = _cmUiAmCtlTypeId(p,pp,a->cId,a->usrId,kInSliderAmId,kInToneAmId,kInPassAmId,kInMuteAmId);
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+ // this control is not a slider or check btn so ignore it
|
|
380
|
+ if( typeId == cmInvalidId )
|
|
381
|
+ return rc;
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+ unsigned asInFl = 0;
|
|
385
|
+ unsigned asCtlId = cmInvalidId;
|
|
386
|
+ unsigned asCh = a->usrId - pp->a[typeId];
|
|
387
|
+ double asValue = 0;
|
|
388
|
+
|
|
389
|
+ switch( typeId )
|
|
390
|
+ {
|
|
391
|
+ case kInSliderAmId:
|
|
392
|
+ asInFl = 1;
|
|
393
|
+ asCtlId = kSliderUiRtId;
|
|
394
|
+ asValue = a->fval;
|
|
395
|
+ break;
|
|
396
|
+
|
|
397
|
+ case kInToneAmId:
|
|
398
|
+ asInFl = 1;
|
|
399
|
+ asCtlId = kToneUiRtId;
|
|
400
|
+ asValue = a->ival;
|
|
401
|
+ break;
|
|
402
|
+
|
|
403
|
+ case kInPassAmId:
|
|
404
|
+ asInFl = 1;
|
|
405
|
+ asCtlId = kPassUiRtId;
|
|
406
|
+ asValue = a->ival;
|
|
407
|
+ break;
|
|
408
|
+
|
|
409
|
+ case kInMuteAmId:
|
|
410
|
+ asInFl = 1;;
|
|
411
|
+ asCtlId = kMuteUiRtId;
|
|
412
|
+ asValue = a->ival;
|
|
413
|
+ break;
|
|
414
|
+
|
|
415
|
+ case kOutSliderAmId:
|
|
416
|
+ asCtlId = kSliderUiRtId;
|
|
417
|
+ asValue = a->fval;
|
|
418
|
+ break;
|
|
419
|
+
|
|
420
|
+ case kOutToneAmId:
|
|
421
|
+ asCtlId = kToneUiRtId;
|
|
422
|
+ asValue = a->ival;
|
|
423
|
+ break;
|
|
424
|
+
|
|
425
|
+ case kOutPassAmId:
|
|
426
|
+ asCtlId = kPassUiRtId;
|
|
427
|
+ asValue = a->ival;
|
|
428
|
+ break;
|
|
429
|
+
|
|
430
|
+ case kOutMuteAmId:
|
|
431
|
+ asCtlId = kMuteUiRtId;
|
|
432
|
+ asValue = a->ival;
|
|
433
|
+ break;
|
|
434
|
+
|
|
435
|
+ }
|
|
436
|
+
|
|
437
|
+ unsigned asDevIdx = asInFl ? pp->iDevIdx : pp->oDevIdx;
|
|
438
|
+
|
|
439
|
+ r.hdr.rtSubIdx = pp->rtSubIdx;
|
|
440
|
+ r.hdr.selId = kUiMstrSelRtId;
|
|
441
|
+ r.devIdx = asDevIdx;
|
|
442
|
+ r.chIdx = asCh;
|
|
443
|
+ r.inFl = asInFl;
|
|
444
|
+ r.ctlId = asCtlId;
|
|
445
|
+ r.value = asValue;
|
|
446
|
+
|
|
447
|
+ if( cmRtSysDeliverMsg(p->asH, &r, sizeof(r), cmInvalidId ) != kOkRtRC )
|
|
448
|
+ rc = cmErrMsg(&p->err,kSubSysFailUiRC,"Audio System master control UI message delivery to the audio system failed.");
|
|
449
|
+
|
|
450
|
+ return rc;
|
|
451
|
+}
|
|
452
|
+
|
|
453
|
+int _cmUiAmLinToDb( double v )
|
|
454
|
+{
|
|
455
|
+ if( v <= 0 )
|
|
456
|
+ return 0;
|
|
457
|
+
|
|
458
|
+ v = round(20.0*log10(v)+100.0);
|
|
459
|
+ return cmMin(kMtrMax,cmMax(kMtrMin,v));
|
|
460
|
+
|
|
461
|
+}
|
|
462
|
+
|
|
463
|
+cmUiRC_t cmUiRtSysMstrOnStatusEvent( cmUiRtMstrH_t h, const cmRtSysStatus_t* m, const double* iMeterArray, const double* oMeterArray )
|
|
464
|
+{
|
|
465
|
+ cmAm_t* p = _cmUiAmHandleToPtr(h);
|
|
466
|
+ cmAmPanel_t* pp = p->list;
|
|
467
|
+
|
|
468
|
+ for(; pp!=NULL; pp=pp->link)
|
|
469
|
+ if(pp->rtSubIdx == m->hdr.rtSubIdx )
|
|
470
|
+ break;
|
|
471
|
+
|
|
472
|
+ if( pp == NULL )
|
|
473
|
+ return cmErrMsg(&p->err,kPanelNotFoundUiRC,"The panel associated with Audio system index %i could not be found.",m->hdr.rtSubIdx);
|
|
474
|
+
|
|
475
|
+ cmUiSetInt(p->uiH, p->appId, pp->updateId, m->updateCnt != pp->updateCnt );
|
|
476
|
+ cmUiSetInt(p->uiH, p->appId, pp->wakeupId, m->wakeupCnt != pp->wakeupCnt );
|
|
477
|
+ cmUiSetInt(p->uiH, p->appId, pp->msgCbId, m->msgCbCnt != pp->msgCbCnt );
|
|
478
|
+ cmUiSetInt(p->uiH, p->appId, pp->audioCbId, m->audioCbCnt != pp->audioCbCnt );
|
|
479
|
+
|
|
480
|
+ pp->updateCnt = m->updateCnt;
|
|
481
|
+ pp->wakeupCnt = m->wakeupCnt;
|
|
482
|
+ pp->msgCbCnt = m->msgCbCnt;
|
|
483
|
+ pp->audioCbCnt= m->audioCbCnt;
|
|
484
|
+
|
|
485
|
+ unsigned i;
|
|
486
|
+
|
|
487
|
+ for(i=0; i<m->iMeterCnt; ++i)
|
|
488
|
+ cmUiSetInt(p->uiH, p->appId, pp->a[kInMeterAmId]+i, _cmUiAmLinToDb(iMeterArray[i]) );
|
|
489
|
+
|
|
490
|
+ for(i=0; i<m->oMeterCnt; ++i)
|
|
491
|
+ cmUiSetInt(p->uiH, p->appId, pp->a[kOutMeterAmId]+i, _cmUiAmLinToDb(oMeterArray[i]) );
|
|
492
|
+
|
|
493
|
+ return kOkUiRC;
|
|
494
|
+}
|
|
495
|
+
|
|
496
|
+void cmUiRtSysMstrClearStatus( cmUiRtMstrH_t h )
|
|
497
|
+{
|
|
498
|
+ cmAm_t* p = _cmUiAmHandleToPtr(h);
|
|
499
|
+
|
|
500
|
+ cmAmPanel_t* pp = p->list;
|
|
501
|
+ for(; pp!=NULL; pp=pp->link)
|
|
502
|
+ {
|
|
503
|
+ cmUiSetInt(p->uiH, p->appId, pp->updateId, 0 );
|
|
504
|
+ cmUiSetInt(p->uiH, p->appId, pp->wakeupId, 0 );
|
|
505
|
+ cmUiSetInt(p->uiH, p->appId, pp->msgCbId, 0 );
|
|
506
|
+ cmUiSetInt(p->uiH, p->appId, pp->audioCbId, 0 );
|
|
507
|
+ }
|
|
508
|
+
|
|
509
|
+}
|