Ardour  9.0-pre0-582-g084a23a80d
ARDOUR::MidiRingBuffer< T > Class Template Reference

#include <midi_ring_buffer.h>

Inheritance diagram for ARDOUR::MidiRingBuffer< T >:
[legend]

Public Member Functions

 MidiRingBuffer (size_t size)
 
bool read_prefix (T *time, Evoral::EventType *type, uint32_t *size)
 
bool read_contents (uint32_t size, uint8_t *buf)
 
size_t read (MidiBuffer &dst, samplepos_t start, samplepos_t end, samplecnt_t offset=0, bool stop_on_overflow_in_destination=false)
 
size_t skip_to (samplepos_t start)
 
void dump (std::ostream &dst)
 
void flush (samplepos_t start, samplepos_t end)
 
void reset_tracker ()
 
void resolve_tracker (MidiBuffer &dst, samplepos_t)
 
void resolve_tracker (Evoral::EventSink< samplepos_t > &dst, samplepos_t)
 
- Public Member Functions inherited from ARDOUR::EventRingBuffer< T >
 EventRingBuffer (size_t capacity)
 
size_t capacity () const
 
bool peek (uint8_t *, size_t size)
 
uint32_t write (T time, Evoral::EventType type, uint32_t size, const uint8_t *buf)
 
bool read (T *time, Evoral::EventType *type, uint32_t *size, uint8_t *buf)
 
- Public Member Functions inherited from PBD::RingBufferNPT< uint8_t >
 RingBufferNPT (size_t sz)
 
virtual ~RingBufferNPT ()
 
void reset ()
 
void set (size_t r, size_t w)
 
size_t read (uint8_t *dest, size_t cnt)
 
size_t write (const uint8_t *src, size_t cnt)
 
size_t write_one (const uint8_t src)
 
void get_read_vector (rw_vector *)
 
void get_write_vector (rw_vector *)
 
void decrement_read_ptr (size_t cnt)
 
void increment_read_ptr (size_t cnt)
 
void increment_write_ptr (size_t cnt)
 
size_t write_space ()
 
size_t read_space ()
 
uint8_t * buffer ()
 
size_t get_write_ptr () const
 
size_t get_read_ptr () const
 
size_t bufsize () const
 
- Public Member Functions inherited from Evoral::EventSink< Time >
virtual ~EventSink ()
 

Private Attributes

MidiNoteTracker _tracker
 

Additional Inherited Members

- Protected Attributes inherited from PBD::RingBufferNPT< uint8_t >
uint8_t * buf
 
size_t size
 
std::atomic< int > write_ptr
 
std::atomic< int > read_ptr
 

Detailed Description

template<typename T>
class ARDOUR::MidiRingBuffer< T >

A RingBuffer for (MIDI) events.

This is simply a wrapper around a raw ringbuffer which writes/reads events as flat placked blobs. The buffer looks like this:

[timestamp][type][size][size bytes of raw MIDI][timestamp][type]size

Definition at line 44 of file midi_ring_buffer.h.

Constructor & Destructor Documentation

◆ MidiRingBuffer()

template<typename T >
ARDOUR::MidiRingBuffer< T >::MidiRingBuffer ( size_t  size)
inline
Parameters
sizeSize in bytes.

Definition at line 47 of file midi_ring_buffer.h.

Member Function Documentation

◆ dump()

template<typename T >
void ARDOUR::MidiRingBuffer< T >::dump ( std::ostream &  dst)

◆ flush()

template<typename T >
void ARDOUR::MidiRingBuffer< T >::flush ( samplepos_t  start,
samplepos_t  end 
)

◆ read()

template<typename T >
size_t ARDOUR::MidiRingBuffer< T >::read ( MidiBuffer dst,
samplepos_t  start,
samplepos_t  end,
samplecnt_t  offset = 0,
bool  stop_on_overflow_in_destination = false 
)

◆ read_contents()

template<typename T >
bool ARDOUR::MidiRingBuffer< T >::read_contents ( uint32_t  size,
uint8_t *  buf 
)
inline

Read the content of an event. This call MUST be immediately preceded by a call to read_prefix (or the returned even will be garbage).

Definition at line 95 of file midi_ring_buffer.h.

◆ read_prefix()

template<typename T >
bool ARDOUR::MidiRingBuffer< T >::read_prefix ( T *  time,
Evoral::EventType type,
uint32_t *  size 
)
inline

Read the time and size of an event. This call MUST be immediately proceeded by a call to read_contents (or the read pointer will be garbage).

Definition at line 72 of file midi_ring_buffer.h.

◆ reset_tracker()

template<typename T >
void ARDOUR::MidiRingBuffer< T >::reset_tracker ( )

◆ resolve_tracker() [1/2]

template<typename T >
void ARDOUR::MidiRingBuffer< T >::resolve_tracker ( Evoral::EventSink< samplepos_t > &  dst,
samplepos_t   
)

◆ resolve_tracker() [2/2]

template<typename T >
void ARDOUR::MidiRingBuffer< T >::resolve_tracker ( MidiBuffer dst,
samplepos_t   
)

◆ skip_to()

template<typename T >
size_t ARDOUR::MidiRingBuffer< T >::skip_to ( samplepos_t  start)

Member Data Documentation

◆ _tracker

template<typename T >
MidiNoteTracker ARDOUR::MidiRingBuffer< T >::_tracker
private

Definition at line 63 of file midi_ring_buffer.h.


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