Parcourir la source

cmApBuf.h/c: Limit the meter update parameter (meterMs) to the range 10-1000.

master
kevin il y a 11 ans
Parent
révision
2ccd818b55
2 fichiers modifiés avec 10 ajouts et 2 suppressions
  1. 6
    1
      cmApBuf.c
  2. 4
    1
      cmApBuf.h

+ 6
- 1
cmApBuf.c Voir le fichier

215
 
215
 
216
   _cmApBuf.devArray        = cmMemAllocZ( cmApDev, devCnt );
216
   _cmApBuf.devArray        = cmMemAllocZ( cmApDev, devCnt );
217
   _cmApBuf.devCnt          = devCnt;
217
   _cmApBuf.devCnt          = devCnt;
218
-  _cmApBuf.meterMs         = meterMs;
218
+  cmApBufSetMeterMs(meterMs);
219
   return kOkAbRC;
219
   return kOkAbRC;
220
 }
220
 }
221
 
221
 
451
 unsigned cmApBufMeterMs()
451
 unsigned cmApBufMeterMs()
452
 { return _cmApBuf.meterMs; }
452
 { return _cmApBuf.meterMs; }
453
 
453
 
454
+void     cmApBufSetMeterMs( unsigned meterMs )
455
+{
456
+  _cmApBuf.meterMs = cmMin(1000,cmMax(10,meterMs));
457
+}
458
+
454
 unsigned cmApBufChannelCount( unsigned devIdx, unsigned flags )
459
 unsigned cmApBufChannelCount( unsigned devIdx, unsigned flags )
455
 {
460
 {
456
   if( devIdx == cmInvalidIdx )
461
   if( devIdx == cmInvalidIdx )

+ 4
- 1
cmApBuf.h Voir le fichier

46
 
46
 
47
   /// Allocate and initialize an audio buffer.
47
   /// Allocate and initialize an audio buffer.
48
   /// devCnt - count of devices this buffer will handle.
48
   /// devCnt - count of devices this buffer will handle.
49
-  /// meterMs - length of the meter buffers in milliseconds
49
+  /// meterMs - length of the meter buffers in milliseconds (automatically limit to the range:10 to 1000)
50
   cmAbRC_t cmApBufInitialize( unsigned devCnt, unsigned meterMs );
50
   cmAbRC_t cmApBufInitialize( unsigned devCnt, unsigned meterMs );
51
 
51
 
52
   /// Deallocate and release any resource held by an audio buffer allocated via cmApBufInitialize().
52
   /// Deallocate and release any resource held by an audio buffer allocated via cmApBufInitialize().
106
 
106
 
107
   /// Return the meter window period as set by cmApBufInitialize()
107
   /// Return the meter window period as set by cmApBufInitialize()
108
   unsigned cmApBufMeterMs();
108
   unsigned cmApBufMeterMs();
109
+  
110
+  // Set the meter update period. THis function limits the value to between 10 and 1000.
111
+  void     cmApBufSetMeterMs( unsigned meterMs );
109
 
112
 
110
   /// Returns the channel count set via cmApBufSetup().
113
   /// Returns the channel count set via cmApBufSetup().
111
   unsigned cmApBufChannelCount( unsigned devIdx, unsigned flags );
114
   unsigned cmApBufChannelCount( unsigned devIdx, unsigned flags );

Chargement…
Annuler
Enregistrer