20 #ifndef ESSENTIA_PHANTOMBUFFER_H
21 #define ESSENTIA_PHANTOMBUFFER_H
25 #include "../roguevector.h"
26 #include "../threading.h"
27 #include "../essentiautil.h"
41 inline int total(
int bufferSize)
const {
163 _buffer.resize(size+phantomSize);
182 " which hasn't produced any token yet");
Definition: threading.h:51
Definition: threading.h:45
Definition: roguevector.h:30
int maxContiguousElements
Definition: types.h:423
int size
Definition: types.h:422
std::string fullName() const
Definition: multiratebuffer.h:30
Definition: phantombuffer.h:60
SourceBase * _parent
Definition: phantombuffer.h:193
void removeReader(ReaderID id)
Definition: phantombuffer_impl.h:52
bool acquireForRead(ReaderID id, int requested)
Definition: phantombuffer_impl.h:69
int availableForRead(ReaderID id) const
Definition: phantombuffer_impl.h:225
bool acquireForWrite(int requested)
Definition: phantombuffer_impl.h:101
Window _writeWindow
Definition: phantombuffer.h:199
void updateReadView(ReaderID id)
Definition: phantombuffer_impl.h:201
void resetTurns()
Definition: phantombuffer_impl.h:182
void relocateReadWindow(ReaderID id)
Definition: phantombuffer_impl.h:287
void setBufferType(BufferUsage::BufferUsageType type)
Definition: phantombuffer.h:69
BufferInfo bufferInfo() const
Definition: phantombuffer.h:99
int numberReaders() const
Definition: phantombuffer_impl.h:59
const std::vector< T > & readView(ReaderID id) const
Definition: phantombuffer_impl.h:29
std::vector< RogueVector< T > > _readView
Definition: phantombuffer.h:203
ReaderID addReader(bool startFromZero=false)
Definition: phantombuffer_impl.h:35
int totalTokensWritten() const
Definition: phantombuffer.h:168
void setBufferInfo(const BufferInfo &info)
Definition: phantombuffer.h:106
int availableForWrite(bool contiguous=true) const
Definition: phantombuffer_impl.h:248
void relocateWriteWindow()
Definition: phantombuffer_impl.h:276
std::vector< T > _buffer
Definition: phantombuffer.h:196
std::vector< T > & writeView()
Definition: phantombuffer.h:126
std::vector< Window > _readWindow
Definition: phantombuffer.h:200
int totalTokensRead(ReaderID id) const
Definition: phantombuffer.h:173
void updateWriteView()
Definition: phantombuffer_impl.h:209
PhantomBuffer(SourceBase *parent, int size, int phantomSize)
Definition: phantombuffer.h:112
RogueVector< T > _writeView
Definition: phantombuffer.h:202
PhantomBuffer(SourceBase *parent, BufferUsage::BufferUsageType type)
Definition: phantombuffer.h:64
void resize(int size, int phantomSize)
Definition: phantombuffer.h:162
void reset()
Definition: phantombuffer_impl.h:298
int _phantomSize
Definition: phantombuffer.h:195
Mutex mutex
Definition: phantombuffer.h:206
const T & lastTokenProduced() const
Definition: phantombuffer.h:178
~PhantomBuffer()
Definition: phantombuffer.h:123
int _bufferSize
Definition: phantombuffer.h:195
void releaseForWrite(int released)
Definition: phantombuffer_impl.h:123
void releaseForRead(ReaderID id, int released)
Definition: phantombuffer_impl.h:158
Definition: sourcebase.h:52
Definition: phantombuffer.h:33
Window()
Definition: phantombuffer.h:39
int begin
Definition: phantombuffer.h:35
int turn
Definition: phantombuffer.h:37
int end
Definition: phantombuffer.h:36
int total(int bufferSize) const
Definition: phantombuffer.h:41
#define NOWARN_UNUSED(expr)
Definition: essentiautil.h:42
BufferUsageType
Definition: types.h:436
@ forMultipleFrames
Definition: types.h:438
@ forLargeAudioStream
Definition: types.h:440
@ forAudioStream
Definition: types.h:439
@ forSingleFrames
Definition: types.h:437
Definition: algorithm.h:28
int ReaderID
Definition: types.h:344