mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-06 14:52:34 +02:00
47 lines
882 B
C++
47 lines
882 B
C++
/**********************************************************************
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
RingBuffer.h
|
|
|
|
Dominic Mazzoni
|
|
|
|
*******************************************************************/
|
|
|
|
#ifndef __AUDACITY_RING_BUFFER__
|
|
#define __AUDACITY_RING_BUFFER__
|
|
|
|
#include "SampleFormat.h"
|
|
|
|
class RingBuffer {
|
|
public:
|
|
RingBuffer(sampleFormat format, int size);
|
|
~RingBuffer();
|
|
|
|
//
|
|
// For the writer only:
|
|
//
|
|
|
|
int AvailForPut();
|
|
int Put(samplePtr buffer, sampleFormat format, int samples);
|
|
|
|
//
|
|
// For the reader only:
|
|
//
|
|
|
|
int AvailForGet();
|
|
int Get(samplePtr buffer, sampleFormat format, int samples);
|
|
int Discard(int samples);
|
|
|
|
private:
|
|
int Len();
|
|
|
|
sampleFormat mFormat;
|
|
int mStart;
|
|
int mEnd;
|
|
int mBufferSize;
|
|
SampleBuffer mBuffer;
|
|
};
|
|
|
|
#endif /* __AUDACITY_RING_BUFFER__ */
|