ardour
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Friends | List of all members
ARDOUR::MidiBuffer Class Reference

#include <midi_buffer.h>

Inheritance diagram for ARDOUR::MidiBuffer:
ARDOUR::Buffer Evoral::EventSink< framepos_t >

Classes

class  iterator_base
 

Public Types

typedef framepos_t TimeType
 
typedef iterator_base
< MidiBuffer,
Evoral::MIDIEvent< TimeType > > 
iterator
 
typedef iterator_base< const
MidiBuffer, const
Evoral::MIDIEvent< TimeType > > 
const_iterator
 

Public Member Functions

 MidiBuffer (size_t capacity)
 
 ~MidiBuffer ()
 
void silence (framecnt_t nframes, framecnt_t offset=0)
 
void read_from (const Buffer &src, framecnt_t nframes, framecnt_t dst_offset=0, framecnt_t src_offset=0)
 
void merge_from (const Buffer &src, framecnt_t nframes, framecnt_t dst_offset=0, framecnt_t src_offset=0)
 
void copy (const MidiBuffer &copy)
 
bool push_back (const Evoral::MIDIEvent< TimeType > &event)
 
bool push_back (TimeType time, size_t size, const uint8_t *data)
 
uint8_t * reserve (TimeType time, size_t size)
 
void resize (size_t)
 
size_t size () const
 
bool empty () const
 
bool insert_event (const Evoral::MIDIEvent< TimeType > &event)
 
bool merge_in_place (const MidiBuffer &other)
 
uint32_t write (TimeType time, Evoral::EventType type, uint32_t size, const uint8_t *buf)
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
iterator erase (const iterator &i)
 
uint8_t * data () const
 
- Public Member Functions inherited from ARDOUR::Buffer
virtual ~Buffer ()
 
size_t capacity () const
 
DataType type () const
 
bool silent () const
 
virtual void clear ()
 
- Public Member Functions inherited from Evoral::EventSink< framepos_t >
virtual ~EventSink ()
 

Static Public Member Functions

static bool second_simultaneous_midi_byte_is_first (uint8_t, uint8_t)
 
- Static Public Member Functions inherited from ARDOUR::Buffer
static Buffercreate (DataType type, size_t capacity)
 

Private Attributes

uint8_t * _data
 timestamp, event, timestamp, event, ... More...
 
pframes_t _size
 

Friends

class iterator_base< MidiBuffer, Evoral::MIDIEvent< TimeType > >
 
class iterator_base< const MidiBuffer, const Evoral::MIDIEvent< TimeType > >
 

Additional Inherited Members

- Protected Member Functions inherited from ARDOUR::Buffer
 Buffer (DataType type)
 
- Protected Attributes inherited from ARDOUR::Buffer
DataType _type
 
pframes_t _capacity
 
bool _silent
 

Detailed Description

Buffer containing 8-bit unsigned char (MIDI) data.

Definition at line 35 of file midi_buffer.h.

Member Typedef Documentation

Definition at line 125 of file midi_buffer.h.

Definition at line 124 of file midi_buffer.h.

Definition at line 38 of file midi_buffer.h.

Constructor & Destructor Documentation

MidiBuffer::MidiBuffer ( size_t  capacity)

Definition at line 35 of file midi_buffer.cc.

MidiBuffer::~MidiBuffer ( )

Definition at line 45 of file midi_buffer.cc.

Member Function Documentation

iterator ARDOUR::MidiBuffer::begin ( )
inline

Definition at line 127 of file midi_buffer.h.

const_iterator ARDOUR::MidiBuffer::begin ( ) const
inline

Definition at line 130 of file midi_buffer.h.

void MidiBuffer::copy ( const MidiBuffer copy)

Definition at line 74 of file midi_buffer.cc.

uint8_t* ARDOUR::MidiBuffer::data ( ) const
inline

Definition at line 168 of file midi_buffer.h.

bool ARDOUR::MidiBuffer::empty ( ) const
inline

Definition at line 56 of file midi_buffer.h.

iterator ARDOUR::MidiBuffer::end ( )
inline

Definition at line 128 of file midi_buffer.h.

const_iterator ARDOUR::MidiBuffer::end ( ) const
inline

Definition at line 131 of file midi_buffer.h.

iterator ARDOUR::MidiBuffer::erase ( const iterator i)
inline

Definition at line 133 of file midi_buffer.h.

bool MidiBuffer::insert_event ( const Evoral::MIDIEvent< TimeType > &  event)

Definition at line 203 of file midi_buffer.cc.

void MidiBuffer::merge_from ( const Buffer src,
framecnt_t  nframes,
framecnt_t  dst_offset = 0,
framecnt_t  src_offset = 0 
)
virtual

Implements ARDOUR::Buffer.

Definition at line 118 of file midi_buffer.cc.

bool MidiBuffer::merge_in_place ( const MidiBuffer other)

Merge other into this buffer. Realtime safe.

Definition at line 423 of file midi_buffer.cc.

bool MidiBuffer::push_back ( const Evoral::MIDIEvent< TimeType > &  ev)

Push an event into the buffer.

Note that the raw MIDI pointed to by ev will be COPIED and unmodified. That is, the caller still owns it, if it needs freeing it's Not My Problem(TM). Realtime safe.

Returns
false if operation failed (not enough room)

Definition at line 136 of file midi_buffer.cc.

bool MidiBuffer::push_back ( TimeType  time,
size_t  size,
const uint8_t *  data 
)

Push an event into the buffer.

Returns
false if operation failed (not enough room)

Definition at line 161 of file midi_buffer.cc.

void MidiBuffer::read_from ( const Buffer src,
framecnt_t  nframes,
framecnt_t  dst_offset = 0,
framecnt_t  src_offset = 0 
)
virtual

Read events from src starting at time offset into the START of this buffer, for time duration nframes. Relative time, where 0 = start of buffer.

Note that offset and nframes refer to sample time, NOT buffer offsets or event counts.

Implements ARDOUR::Buffer.

Definition at line 88 of file midi_buffer.cc.

uint8_t * MidiBuffer::reserve ( TimeType  time,
size_t  size 
)

Reserve space for a new event in the buffer.

This call is for copying MIDI directly into the buffer, the data location (of sufficient size to write size bytes) is returned, or 0 on failure. This call MUST be immediately followed by a write to the returned data location, or the buffer will be corrupted and very nasty things will happen.

Definition at line 268 of file midi_buffer.cc.

void MidiBuffer::resize ( size_t  )
virtual

Reallocate the buffer used internally to handle at least size_t units of data.

The buffer is not silent after this operation. the capacity argument passed to the constructor must have been non-zero.

Implements ARDOUR::Buffer.

Definition at line 51 of file midi_buffer.cc.

bool MidiBuffer::second_simultaneous_midi_byte_is_first ( uint8_t  a,
uint8_t  b 
)
static

returns true if the message with the second argument as its MIDI status byte should preceed the message with the first argument as its MIDI status byte.

Definition at line 301 of file midi_buffer.cc.

void MidiBuffer::silence ( framecnt_t  len,
framecnt_t  offset = 0 
)
virtual

Clear (eg zero, or empty) buffer

Implements ARDOUR::Buffer.

Definition at line 290 of file midi_buffer.cc.

size_t ARDOUR::MidiBuffer::size ( ) const
inline

Definition at line 55 of file midi_buffer.h.

uint32_t MidiBuffer::write ( TimeType  time,
Evoral::EventType  type,
uint32_t  size,
const uint8_t *  buf 
)
virtual

EventSink interface for non-RT use (export, bounce).

Implements Evoral::EventSink< framepos_t >.

Definition at line 254 of file midi_buffer.cc.

Friends And Related Function Documentation

friend class iterator_base< const MidiBuffer, const Evoral::MIDIEvent< TimeType > >
friend

Definition at line 179 of file midi_buffer.h.

friend class iterator_base< MidiBuffer, Evoral::MIDIEvent< TimeType > >
friend

Definition at line 178 of file midi_buffer.h.

Member Data Documentation

uint8_t* ARDOUR::MidiBuffer::_data
private

timestamp, event, timestamp, event, ...

Definition at line 181 of file midi_buffer.h.

pframes_t ARDOUR::MidiBuffer::_size
private

Definition at line 182 of file midi_buffer.h.


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