Переглянути джерело

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

master
kevin 11 роки тому
джерело
коміт
f4829a838d
3 змінених файлів з 17 додано та 12 видалено
  1. 12
    11
      cmAudioSys.c
  2. 3
    1
      cmAudioSys.h
  3. 2
    0
      cmAudioSysMsg.h

+ 12
- 11
cmAudioSys.c Переглянути файл

21
 
21
 
22
 #include "cmMath.h"
22
 #include "cmMath.h"
23
 
23
 
24
-#include <unistd.h>  // usleep
25
 
24
 
26
 cmAudioSysH_t cmAudioSysNullHandle = { NULL };
25
 cmAudioSysH_t cmAudioSysNullHandle = { NULL };
27
 
26
 
130
     const char*           inDevLabel  = cp->ss.args.inDevIdx  == cmInvalidIdx ? "" : cmApDeviceLabel( cp->ss.args.inDevIdx );
129
     const char*           inDevLabel  = cp->ss.args.inDevIdx  == cmInvalidIdx ? "" : cmApDeviceLabel( cp->ss.args.inDevIdx );
131
     const char*           outDevLabel = cp->ss.args.outDevIdx == cmInvalidIdx ? "" : cmApDeviceLabel( cp->ss.args.outDevIdx );
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
     unsigned    segCnt = 3;
142
     unsigned    segCnt = 3;
142
     const void* msgDataPtrArray[] = { &m, inDevLabel, outDevLabel };
143
     const void* msgDataPtrArray[] = { &m, inDevLabel, outDevLabel };
495
       asH.h = cp->p; 
496
       asH.h = cp->p; 
496
 
497
 
497
       unsigned    selId             = kMidiMsgArraySelAsId;
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
       unsigned    msgByteCntArray[] = { sizeof(cp->ctx.asSubIdx), sizeof(selId), sizeof(pkt->devIdx), sizeof(pkt->portIdx), sizeof(pkt->msgCnt), pkt->msgCnt*sizeof(cmMidiMsg) };
500
       unsigned    msgByteCntArray[] = { sizeof(cp->ctx.asSubIdx), sizeof(selId), sizeof(pkt->devIdx), sizeof(pkt->portIdx), sizeof(pkt->msgCnt), pkt->msgCnt*sizeof(cmMidiMsg) };
500
       unsigned    msgSegCnt         = sizeof(msgByteCntArray)/sizeof(unsigned);
501
       unsigned    msgSegCnt         = sizeof(msgByteCntArray)/sizeof(unsigned);
501
 
502
 
578
 
579
 
579
     }
580
     }
580
 
581
 
581
-    cp->enableFl = enableFl;  
582
+    cp->enableFl = enableFl; 
582
   }
583
   }
583
   return kOkAsRC;
584
   return kOkAsRC;
584
 }
585
 }
610
       // cond variable from _cmAsAudioUpdate() otherwise the system may crash
611
       // cond variable from _cmAsAudioUpdate() otherwise the system may crash
611
 
612
 
612
       while( cp->audCbLock != 0 )
613
       while( cp->audCbLock != 0 )
613
-      { usleep(100000); }
614
+      { cmSleepUs(100000); }
614
 
615
 
615
       // signal the cond var to cause the thread to run
616
       // signal the cond var to cause the thread to run
616
       if((rc = cmThreadMutexSignalCondVar(cp->engMutexH)) != kOkThRC )
617
       if((rc = cmThreadMutexSignalCondVar(cp->engMutexH)) != kOkThRC )

+ 3
- 1
cmAudioSys.h Переглянути файл

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

+ 2
- 0
cmAudioSysMsg.h Переглянути файл

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

Завантаження…
Відмінити
Зберегти