Parcourir la source

cmAudioSys.h/c and cmAudioSysMsg.h: Added several kAsDfltXXX values. cmAudioSysSsInitMsg_t now includes srate and dspFramesPerCycle.

master
kevin il y a 11 ans
Parent
révision
f4829a838d
3 fichiers modifiés avec 17 ajouts et 12 suppressions
  1. 12
    11
      cmAudioSys.c
  2. 3
    1
      cmAudioSys.h
  3. 2
    0
      cmAudioSysMsg.h

+ 12
- 11
cmAudioSys.c Voir le fichier

@@ -21,7 +21,6 @@
21 21
 
22 22
 #include "cmMath.h"
23 23
 
24
-#include <unistd.h>  // usleep
25 24
 
26 25
 cmAudioSysH_t cmAudioSysNullHandle = { NULL };
27 26
 
@@ -130,13 +129,15 @@ cmAsRC_t _cmAsHostInitNotify( cmAs_t* p )
130 129
     const char*           inDevLabel  = cp->ss.args.inDevIdx  == cmInvalidIdx ? "" : cmApDeviceLabel( cp->ss.args.inDevIdx );
131 130
     const char*           outDevLabel = cp->ss.args.outDevIdx == cmInvalidIdx ? "" : cmApDeviceLabel( cp->ss.args.outDevIdx );
132 131
 
133
-    m.asSubIdx  = i;
134
-    m.selId     = kSsInitSelAsId;
135
-    m.asSubCnt  = p->ssCnt;
136
-    m.inDevIdx  = cp->ss.args.inDevIdx;
137
-    m.outDevIdx = cp->ss.args.outDevIdx;
138
-    m.inChCnt   = cp->status.iMeterCnt;
139
-    m.outChCnt  = cp->status.oMeterCnt;
132
+    m.asSubIdx          = i;
133
+    m.selId             = kSsInitSelAsId;
134
+    m.asSubCnt          = p->ssCnt;
135
+    m.inDevIdx          = cp->ss.args.inDevIdx;
136
+    m.outDevIdx         = cp->ss.args.outDevIdx;
137
+    m.dspFramesPerCycle = cp->ss.args.dspFramesPerCycle;
138
+    m.srate             = cp->ss.args.srate;
139
+    m.inChCnt           = cp->status.iMeterCnt;
140
+    m.outChCnt          = cp->status.oMeterCnt;
140 141
     
141 142
     unsigned    segCnt = 3;
142 143
     const void* msgDataPtrArray[] = { &m, inDevLabel, outDevLabel };
@@ -495,7 +496,7 @@ void _cmAudioSysMidiCallback( const cmMidiPacket_t* pktArray, unsigned pktCnt )
495 496
       asH.h = cp->p; 
496 497
 
497 498
       unsigned    selId             = kMidiMsgArraySelAsId;
498
-      const void* msgPtrArray[]     = { &cp->ctx.asSubIdx, &selId,        &pkt->devIdx,        &pkt->portIdx,        &pkt->msgCnt,        pkt->msgArray };
499
+      const void* msgPtrArray[]     = { &cp->ctx.asSubIdx,        &selId,        &pkt->devIdx,        &pkt->portIdx,        &pkt->msgCnt,        pkt->msgArray };
499 500
       unsigned    msgByteCntArray[] = { sizeof(cp->ctx.asSubIdx), sizeof(selId), sizeof(pkt->devIdx), sizeof(pkt->portIdx), sizeof(pkt->msgCnt), pkt->msgCnt*sizeof(cmMidiMsg) };
500 501
       unsigned    msgSegCnt         = sizeof(msgByteCntArray)/sizeof(unsigned);
501 502
 
@@ -578,7 +579,7 @@ cmAsRC_t _cmAudioSysEnable( cmAs_t* p, bool enableFl )
578 579
 
579 580
     }
580 581
 
581
-    cp->enableFl = enableFl;  
582
+    cp->enableFl = enableFl; 
582 583
   }
583 584
   return kOkAsRC;
584 585
 }
@@ -610,7 +611,7 @@ cmAsRC_t _cmAudioSysFinalize( cmAs_t* p )
610 611
       // cond variable from _cmAsAudioUpdate() otherwise the system may crash
611 612
 
612 613
       while( cp->audCbLock != 0 )
613
-      { usleep(100000); }
614
+      { cmSleepUs(100000); }
614 615
 
615 616
       // signal the cond var to cause the thread to run
616 617
       if((rc = cmThreadMutexSignalCondVar(cp->engMutexH)) != kOkThRC )

+ 3
- 1
cmAudioSys.h Voir le fichier

@@ -89,7 +89,9 @@ extern "C" {
89 89
     kAsDfltBufCnt            = 3,
90 90
     kAsDfltSrate             = 44100,
91 91
     kAsDfltSyncToInputFl     = 1,
92
-    kAsDfltMeterMs           = 50
92
+    kAsDfltMinMeterMs        = 10,
93
+    kAsDfltMeterMs           = 50,
94
+    kAsDfltMaxMeterMs        = 1000
93 95
   };
94 96
 
95 97
   typedef cmHandle_t cmAudioSysH_t;  //< Audio system handle type

+ 2
- 0
cmAudioSysMsg.h Voir le fichier

@@ -81,6 +81,8 @@ extern "C" {
81 81
     unsigned asSubCnt;  ///< count of sub-systems
82 82
     unsigned inDevIdx;  ///< input device index
83 83
     unsigned outDevIdx; ///< output device index
84
+    unsigned dspFramesPerCycle;
85
+    double   srate;
84 86
     unsigned inChCnt;   ///< input device channel count
85 87
     unsigned outChCnt;  ///< outut device channel count
86 88
   } cmAudioSysSsInitMsg_t;

Chargement…
Annuler
Enregistrer