MidiBuffer: make ::write() return an error code if ::insert_event() fails

This commit is contained in:
Paul Davis 2025-11-16 13:58:45 -07:00
parent 6e58f6e2c8
commit 1e6d75d781

View file

@ -258,8 +258,11 @@ MidiBuffer::insert_event (const Evoral::Event<TimeType>& ev)
uint32_t
MidiBuffer::write (TimeType time, Evoral::EventType type, uint32_t size, const uint8_t* buf)
{
insert_event(Evoral::Event<TimeType>(type, time, size, const_cast<uint8_t*>(buf)));
return size;
if (insert_event (Evoral::Event<TimeType>(type, time, size, const_cast<uint8_t*>(buf)))) {
return size;
} else {
return 0;
}
}
/** Reserve space for a new event in the buffer.