MidiBuffer::~MidiBuffer()
{
- free(_data);
+ cache_aligned_free(_data);
}
void
return;
}
- free (_data);
+ cache_aligned_free (_data);
cache_aligned_malloc ((void**) &_data, size);
const size_t stamp_size = sizeof(TimeType);
#ifndef NDEBUG
- if (DEBUG::MidiIO & PBD::debug_bits) {
+ if (DEBUG_ENABLED(DEBUG::MidiIO)) {
DEBUG_STR_DECL(a);
DEBUG_STR_APPEND(a, string_compose ("midibuffer %1 push event @ %2 sz %3 ", this, time, size));
for (size_t i=0; i < size; ++i) {
}
uint8_t* const write_loc = _data + _size;
- *((TimeType*)write_loc) = time;
+ *(reinterpret_cast<TimeType*>((uintptr_t)write_loc)) = time;
memcpy(write_loc + stamp_size, data, size);
_size += stamp_size + size;
}
uint8_t* const write_loc = _data + insert_offset;
- *((TimeType*)write_loc) = t;
+ *(reinterpret_cast<TimeType*>((uintptr_t)write_loc)) = t;
memcpy(write_loc + stamp_size, ev.buffer(), ev.size());
_size += bytes_to_merge;
return true;
}
+uint32_t
+MidiBuffer::write(TimeType time, Evoral::EventType type, uint32_t size, const uint8_t* buf)
+{
+ insert_event(Evoral::MIDIEvent<TimeType>(type, time, size, const_cast<uint8_t*>(buf)));
+ return size;
+}
+
/** Reserve space for a new event in the buffer.
*
* This call is for copying MIDI directly into the buffer, the data location
// write timestamp
uint8_t* write_loc = _data + _size;
- *((TimeType*)write_loc) = time;
+ *(reinterpret_cast<TimeType*>((uintptr_t)write_loc)) = time;
// move write_loc to begin of MIDI buffer data to write to
write_loc += stamp_size;