Ardour  9.0-pre0-350-gf17a656217
PBD::PlaybackBuffer< T > Class Template Reference

#include <playback_buffer.h>

Public Member Functions

 PlaybackBuffer (size_t sz, size_t res=8191)
 
virtual ~PlaybackBuffer ()
 
T * buffer ()
 
size_t bufsize () const
 
void reset ()
 
void align_to (PlaybackBuffer const &other)
 
size_t write_space () const
 
size_t read_space () const
 
size_t overwritable_at (size_t r) const
 
size_t read (T *dest, size_t cnt, bool commit=true, size_t offset=0)
 
size_t write (T const *src, size_t cnt)
 
size_t write_zero (size_t cnt)
 
size_t increment_write_ptr (size_t cnt)
 
size_t decrement_read_ptr (size_t cnt)
 
size_t increment_read_ptr (size_t cnt)
 
bool can_seek (int64_t cnt)
 
size_t read_ptr () const
 
size_t write_ptr () const
 
size_t reserved_size () const
 
size_t reservation_size () const
 

Static Public Member Functions

static size_t power_of_two_size (size_t sz)
 

Private Attributes

T * buf
 
const size_t reservation
 
size_t size
 
size_t size_mask
 
std::atomic< size_t > write_idx
 
std::atomic< size_t > read_idx
 
std::atomic< size_t > reserved
 
spinlock_t _reservation_lock
 
Glib::Threads::Mutex _reset_lock
 

Detailed Description

template<class T>
class PBD::PlaybackBuffer< T >

Definition at line 34 of file playback_buffer.h.

Constructor & Destructor Documentation

◆ PlaybackBuffer()

template<class T >
PBD::PlaybackBuffer< T >::PlaybackBuffer ( size_t  sz,
size_t  res = 8191 
)
inline

Definition at line 43 of file playback_buffer.h.

◆ ~PlaybackBuffer()

template<class T >
virtual PBD::PlaybackBuffer< T >::~PlaybackBuffer ( )
inlinevirtual

Definition at line 55 of file playback_buffer.h.

Member Function Documentation

◆ align_to()

template<class T >
void PBD::PlaybackBuffer< T >::align_to ( PlaybackBuffer< T > const &  other)
inline

Definition at line 75 of file playback_buffer.h.

◆ buffer()

template<class T >
T* PBD::PlaybackBuffer< T >::buffer ( )
inline

Definition at line 60 of file playback_buffer.h.

◆ bufsize()

template<class T >
size_t PBD::PlaybackBuffer< T >::bufsize ( ) const
inline

Definition at line 62 of file playback_buffer.h.

◆ can_seek()

template<class T >
bool PBD::PlaybackBuffer< T >::can_seek ( int64_t  cnt)
inline

Definition at line 184 of file playback_buffer.h.

◆ decrement_read_ptr()

template<class T >
size_t PBD::PlaybackBuffer< T >::decrement_read_ptr ( size_t  cnt)
inline

Definition at line 154 of file playback_buffer.h.

◆ increment_read_ptr()

template<class T >
size_t PBD::PlaybackBuffer< T >::increment_read_ptr ( size_t  cnt)
inline

Definition at line 172 of file playback_buffer.h.

◆ increment_write_ptr()

template<class T >
size_t PBD::PlaybackBuffer< T >::increment_write_ptr ( size_t  cnt)
inline

Definition at line 146 of file playback_buffer.h.

◆ overwritable_at()

template<class T >
size_t PBD::PlaybackBuffer< T >::overwritable_at ( size_t  r) const
inline

Definition at line 127 of file playback_buffer.h.

◆ power_of_two_size()

template<class T >
static size_t PBD::PlaybackBuffer< T >::power_of_two_size ( size_t  sz)
inlinestatic

Definition at line 37 of file playback_buffer.h.

◆ read()

template<class T >
size_t PBD::PlaybackBuffer< T >::read ( T *  dest,
size_t  cnt,
bool  commit = true,
size_t  offset = 0 
)

Definition at line 284 of file playback_buffer.h.

◆ read_ptr()

template<class T >
size_t PBD::PlaybackBuffer< T >::read_ptr ( ) const
inline

Definition at line 194 of file playback_buffer.h.

◆ read_space()

template<class T >
size_t PBD::PlaybackBuffer< T >::read_space ( ) const
inline

Definition at line 113 of file playback_buffer.h.

◆ reservation_size()

template<class T >
size_t PBD::PlaybackBuffer< T >::reservation_size ( ) const
inline

Definition at line 197 of file playback_buffer.h.

◆ reserved_size()

template<class T >
size_t PBD::PlaybackBuffer< T >::reserved_size ( ) const
inline

Definition at line 196 of file playback_buffer.h.

◆ reset()

template<class T >
void PBD::PlaybackBuffer< T >::reset ( )
inline

Definition at line 65 of file playback_buffer.h.

◆ write()

template<class T >
size_t PBD::PlaybackBuffer< T >::write ( T const *  src,
size_t  cnt 
)

Definition at line 216 of file playback_buffer.h.

◆ write_ptr()

template<class T >
size_t PBD::PlaybackBuffer< T >::write_ptr ( ) const
inline

Definition at line 195 of file playback_buffer.h.

◆ write_space()

template<class T >
size_t PBD::PlaybackBuffer< T >::write_space ( ) const
inline

Definition at line 84 of file playback_buffer.h.

◆ write_zero()

template<class T >
size_t PBD::PlaybackBuffer< T >::write_zero ( size_t  cnt)

Definition at line 250 of file playback_buffer.h.

Member Data Documentation

◆ _reservation_lock

template<class T >
spinlock_t PBD::PlaybackBuffer< T >::_reservation_lock
private

Definition at line 210 of file playback_buffer.h.

◆ _reset_lock

template<class T >
Glib::Threads::Mutex PBD::PlaybackBuffer< T >::_reset_lock
private

Definition at line 212 of file playback_buffer.h.

◆ buf

template<class T >
T* PBD::PlaybackBuffer< T >::buf
private

Definition at line 200 of file playback_buffer.h.

◆ read_idx

template<class T >
std::atomic<size_t> PBD::PlaybackBuffer< T >::read_idx
mutableprivate

Definition at line 206 of file playback_buffer.h.

◆ reservation

template<class T >
const size_t PBD::PlaybackBuffer< T >::reservation
private

Definition at line 201 of file playback_buffer.h.

◆ reserved

template<class T >
std::atomic<size_t> PBD::PlaybackBuffer< T >::reserved
mutableprivate

Definition at line 207 of file playback_buffer.h.

◆ size

template<class T >
size_t PBD::PlaybackBuffer< T >::size
private

Definition at line 202 of file playback_buffer.h.

◆ size_mask

template<class T >
size_t PBD::PlaybackBuffer< T >::size_mask
private

Definition at line 203 of file playback_buffer.h.

◆ write_idx

template<class T >
std::atomic<size_t> PBD::PlaybackBuffer< T >::write_idx
mutableprivate

Definition at line 205 of file playback_buffer.h.


The documentation for this class was generated from the following files: