20 #ifndef ESSENTIA_STREAMING_RINGBUFFERIMPL_H
21 #define ESSENTIA_STREAMING_RINGBUFFERIMPL_H
32 CRITICAL_SECTION conditionLock;
33 CRITICAL_SECTION waitersCountLock;
38 InitializeCriticalSection(&conditionLock);
39 InitializeCriticalSection(&waitersCountLock);
40 event = CreateEvent (
NULL,
47 void lock() { EnterCriticalSection(&conditionLock); }
48 void unlock() { LeaveCriticalSection(&conditionLock); }
51 EnterCriticalSection(&waitersCountLock);
53 LeaveCriticalSection(&waitersCountLock);
55 LeaveCriticalSection(&conditionLock);
57 int result = WaitForSingleObject(event, INFINITE);
59 EnterCriticalSection(&waitersCountLock);
61 LeaveCriticalSection(&waitersCountLock);
63 EnterCriticalSection(&conditionLock);
68 EnterCriticalSection(&waitersCountLock);
69 bool haveWaiters = waitersCount > 0;
70 LeaveCriticalSection(&waitersCountLock);
105 namespace streaming {
188 if (size > inputSize) size = inputSize;
219 if (size > outputSize) size = outputSize;
Definition: ringbufferimpl.h:82
Condition()
Definition: ringbufferimpl.h:88
void signal()
Definition: ringbufferimpl.h:96
void unlock()
Definition: ringbufferimpl.h:94
void wait()
Definition: ringbufferimpl.h:95
void lock()
Definition: ringbufferimpl.h:93
pthread_mutex_t pthreadMutex
Definition: ringbufferimpl.h:84
pthread_cond_t pthreadCondition
Definition: ringbufferimpl.h:85
Definition: ringbufferimpl.h:107
enum essentia::streaming::RingBufferImpl::WaitingCondition _waitingCondition
void waitAvailable(void)
Definition: ringbufferimpl.h:153
Atomic _space
Definition: ringbufferimpl.h:115
int _writeIndex
Definition: ringbufferimpl.h:111
~RingBufferImpl()
Definition: ringbufferimpl.h:139
Real * _buffer
Definition: ringbufferimpl.h:117
int get(Real *outputData, int outputSize)
Definition: ringbufferimpl.h:216
void waitSpace(void)
Definition: ringbufferimpl.h:169
int add(const Real *inputData, int inputSize)
Definition: ringbufferimpl.h:185
Atomic _available
Definition: ringbufferimpl.h:114
void reset()
Definition: ringbufferimpl.h:144
int _readIndex
Definition: ringbufferimpl.h:112
WaitingCondition
Definition: ringbufferimpl.h:124
@ kAvailable
Definition: ringbufferimpl.h:125
@ kSpace
Definition: ringbufferimpl.h:125
RingBufferImpl(WaitingCondition c, int bufferSize)
Definition: ringbufferimpl.h:128
int _bufferSize
Definition: ringbufferimpl.h:109
Condition condition
Definition: ringbufferimpl.h:119
Definition: algorithm.h:28
Real AudioSample
Definition: types.h:349
float Real
Definition: types.h:69
#define NULL
Definition: tnt_i_refvec.h:33