|
@@ -354,10 +354,15 @@ cmAdRC_t _cmAdParseSysJsonTree( cmAd_t* p )
|
354
|
354
|
{
|
355
|
355
|
cmAudioSysArgs_t* asap = &p->asCfgArray[i].cfg.ssArray[j].args;
|
356
|
356
|
const cmJsonNode_t* argsNodePtr = cmJsonArrayElementC(ssArrayNodePtr,j);
|
|
357
|
+
|
|
358
|
+ asap->inDevIdx = cmInvalidIdx;
|
|
359
|
+ asap->outDevIdx = cmInvalidIdx;
|
|
360
|
+ asap->inDevLabel = NULL;
|
|
361
|
+ asap->outDevLabel = NULL;
|
357
|
362
|
|
358
|
363
|
if((jsRC = cmJsonMemberValues( argsNodePtr, &errLabelPtr,
|
359
|
|
- "inDevIdx", kIntTId, &asap->inDevIdx,
|
360
|
|
- "outDevIdx", kIntTId, &asap->outDevIdx,
|
|
364
|
+ "inDevLabel", kStringTId, &asap->inDevLabel,
|
|
365
|
+ "outDevLabel", kStringTId, &asap->outDevLabel,
|
361
|
366
|
"syncToInputFl", kTrueTId, &asap->syncInputFl,
|
362
|
367
|
"msgQueueByteCnt", kIntTId, &asap->msgQueueByteCnt,
|
363
|
368
|
"devFramesPerCycle", kIntTId, &asap->devFramesPerCycle,
|
|
@@ -443,6 +448,35 @@ cmAdRC_t _cmAdCreateAggDevices( cmAd_t* p )
|
443
|
448
|
return rc;
|
444
|
449
|
}
|
445
|
450
|
|
|
451
|
+cmAdRC_t _cmAdResolveDeviceLabels( cmAd_t* p )
|
|
452
|
+{
|
|
453
|
+ cmAdRC_t rc = kOkAdRC;
|
|
454
|
+ unsigned i,j;
|
|
455
|
+
|
|
456
|
+ // for each cmAsAudioSysCfg record in audioSysCfgArray[]
|
|
457
|
+ for(i=0; i<p->asCfgCnt; ++i)
|
|
458
|
+ {
|
|
459
|
+ // for each audio system sub-subsystem
|
|
460
|
+ for(j=0; j<p->asCfgArray[i].cfg.ssCnt; ++j)
|
|
461
|
+ {
|
|
462
|
+ cmAudioSysArgs_t* asap = &p->asCfgArray[i].cfg.ssArray[j].args;
|
|
463
|
+ if((asap->inDevIdx = cmApDeviceLabelToIndex( asap->inDevLabel )) == cmInvalidId )
|
|
464
|
+ {
|
|
465
|
+ rc = cmErrMsg(&p->err,kInvalidAudioDevIdxAdRC,"The audio input device '%s' could not be found.", cmStringNullGuard(asap->inDevLabel));
|
|
466
|
+ goto errLabel;
|
|
467
|
+ }
|
|
468
|
+
|
|
469
|
+ if((asap->outDevIdx = cmApDeviceLabelToIndex( asap->outDevLabel )) == cmInvalidId )
|
|
470
|
+ {
|
|
471
|
+ rc = cmErrMsg(&p->err,kInvalidAudioDevIdxAdRC,"The audio input device '%s' could not be found.", cmStringNullGuard(asap->inDevLabel));
|
|
472
|
+ goto errLabel;
|
|
473
|
+ }
|
|
474
|
+ }
|
|
475
|
+ }
|
|
476
|
+ errLabel:
|
|
477
|
+ return rc;
|
|
478
|
+}
|
|
479
|
+
|
446
|
480
|
cmAdRC_t _cmAdCreateNrtDevices( cmAd_t* p )
|
447
|
481
|
{
|
448
|
482
|
cmAdRC_t rc = kOkAdRC;
|
|
@@ -721,10 +755,11 @@ cmAdRC_t cmAudDspAlloc( cmCtx_t* ctx, cmAdH_t* hp, cmMsgSendFuncPtr_t cbFunc, vo
|
721
|
755
|
if((rc = _cmAdParseSysJsonTree(p)) != kOkAdRC )
|
722
|
756
|
goto errLabel;
|
723
|
757
|
|
|
758
|
+
|
724
|
759
|
// create the aggregate device
|
725
|
760
|
if( _cmAdCreateAggDevices(p) != kOkAdRC )
|
726
|
761
|
goto errLabel;
|
727
|
|
-
|
|
762
|
+
|
728
|
763
|
// create the non-real-time devices
|
729
|
764
|
if( _cmAdCreateNrtDevices(p) != kOkAdRC )
|
730
|
765
|
goto errLabel;
|
|
@@ -740,6 +775,12 @@ cmAdRC_t cmAudDspAlloc( cmCtx_t* ctx, cmAdH_t* hp, cmMsgSendFuncPtr_t cbFunc, vo
|
740
|
775
|
goto errLabel;
|
741
|
776
|
}
|
742
|
777
|
|
|
778
|
+ if( _cmAdResolveDeviceLabels(p) != kOkApRC )
|
|
779
|
+ {
|
|
780
|
+ rc = cmErrMsg(&p->err,kAudioPortFailAdRC,"Audio device labels could not be resolved..");
|
|
781
|
+ goto errLabel;
|
|
782
|
+ }
|
|
783
|
+
|
743
|
784
|
// initialize the audio buffer
|
744
|
785
|
if( cmApBufInitialize( cmApDeviceCount(), p->meterMs ) != kOkApRC )
|
745
|
786
|
{
|