fix “no per-thread pool” abort
[ardour.git] / libs / ardour / midi_buffer.cc
index 4715be928c18d39c88e68225da959fbbe8527bca..ee6bd13d51467a4ed1932769ad9809fa08d33e56 100644 (file)
@@ -190,7 +190,7 @@ MidiBuffer::push_back(TimeType time, size_t size, const uint8_t* data)
        }
 
        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;
@@ -242,7 +242,7 @@ MidiBuffer::insert_event(const Evoral::MIDIEvent<TimeType>& ev)
        }
 
        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;
@@ -250,6 +250,13 @@ MidiBuffer::insert_event(const Evoral::MIDIEvent<TimeType>& ev)
        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
@@ -267,7 +274,7 @@ MidiBuffer::reserve(TimeType time, size_t size)
 
        // 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;