23 #ifndef __ardour_midi_buffer_h__
24 #define __ardour_midi_buffer_h__
60 size_t size()
const {
return _size; }
61 bool empty()
const {
return _size == 0; }
70 template<
typename BufferType,
typename EventType>
97 assert(event_size >= 0);
100 *((
TimeType*)(buffer->_data + offset)),
101 event_size, ev_start);
107 assert(event_size >= 0);
110 *(
reinterpret_cast<TimeType*
>((uintptr_t)(buffer->_data + offset))),
111 event_size, ev_start);
115 return reinterpret_cast<TimeType*
>((uintptr_t)(buffer->_data + offset));
125 assert(event_size >= 0);
131 return (buffer != other.
buffer) || (offset != other.
offset);
135 return (buffer == other.
buffer) && (offset == other.
offset);
152 assert (i.
buffer ==
this);
156 if (event_size < 0) {
163 if (total_data_deleted >= _size) {
169 if (i.
offset + total_data_deleted >= _size) {
170 assert (_size > total_data_deleted);
171 _size -= total_data_deleted;
179 for (a = i.
offset, b = i.
offset + total_data_deleted; b < _size; ++b, ++a) {
183 _size -= total_data_deleted;
200 static bool second_simultaneous_midi_byte_is_first (uint8_t, uint8_t);
204 friend class
iterator_base< const MidiBuffer, const Evoral::Event<TimeType> >;
206 static size_t align32 (size_t s) {
207 #if defined(__arm__) || defined(__aarch64__)
208 return ((s - 1) | 3) + 1;
iterator_base(const iterator_base< BufferType, EventType > &o)
iterator_base< BufferType, EventType > & operator++()
iterator_base(BufferType &b, samplecnt_t o)
EventType operator*() const
bool operator==(const iterator_base< BufferType, EventType > &other) const
Evoral::EventType * event_type_ptr()
bool operator!=(const iterator_base< BufferType, EventType > &other) const
MidiBuffer(size_t capacity)
uint8_t * _data
[timestamp, event-type, event]*
iterator_base< MidiBuffer, Evoral::Event< TimeType > > iterator
iterator erase(const iterator &i)
bool merge_in_place(const MidiBuffer &other)
void read_from(const Buffer &src, samplecnt_t nframes, sampleoffset_t dst_offset=0, sampleoffset_t src_offset=0)
void silence(samplecnt_t nframes, samplecnt_t offset=0)
void merge_from(const Buffer &src, samplecnt_t nframes, sampleoffset_t dst_offset=0, sampleoffset_t src_offset=0)
void copy(MidiBuffer const *const)
const_iterator begin() const
const_iterator end() const
uint32_t write(TimeType time, Evoral::EventType type, uint32_t size, const uint8_t *buf)
iterator_base< const MidiBuffer, const Evoral::Event< TimeType > > const_iterator
bool push_back(const Evoral::Event< TimeType > &event)
uint8_t * reserve(TimeType time, Evoral::EventType event_type, size_t size)
bool push_back(TimeType time, Evoral::EventType event_type, size_t size, const uint8_t *data)
bool insert_event(const Evoral::Event< TimeType > &event)
void copy(const MidiBuffer ©)
Temporal::samplecnt_t samplecnt_t
Temporal::sampleoffset_t sampleoffset_t
Temporal::samplepos_t samplepos_t
static int midi_event_size(uint8_t status)