X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=libs%2Fardour%2Fmidi_buffer.cc;h=ee6bd13d51467a4ed1932769ad9809fa08d33e56;hb=fe85575a12d8c81e8d2d08b7d91238a88c8febe7;hp=4715be928c18d39c88e68225da959fbbe8527bca;hpb=e5e12acc5698090f2c0c614385e457cc0b46fbb0;p=ardour.git diff --git a/libs/ardour/midi_buffer.cc b/libs/ardour/midi_buffer.cc index 4715be928c..ee6bd13d51 100644 --- a/libs/ardour/midi_buffer.cc +++ b/libs/ardour/midi_buffer.cc @@ -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((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& ev) } uint8_t* const write_loc = _data + insert_offset; - *((TimeType*)write_loc) = t; + *(reinterpret_cast((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& ev) return true; } +uint32_t +MidiBuffer::write(TimeType time, Evoral::EventType type, uint32_t size, const uint8_t* buf) +{ + insert_event(Evoral::MIDIEvent(type, time, size, const_cast(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((uintptr_t)write_loc)) = time; // move write_loc to begin of MIDI buffer data to write to write_loc += stamp_size;