@@ -194,6 +194,7 @@ cdef extern from "RtMidi.h":
194194 double getMessage(vector[unsigned char ] * message) except *
195195 void ignoreTypes(bool midiSysex, bool midiTime, bool midiSense) except *
196196 void setCallback(RtMidiCallback callback, void * data) except *
197+ void setBufferSize(unsigned int size, unsigned int count) except *
197198
198199 cdef cppclass RtMidiOut(RtMidi):
199200 Api RtMidiOut(Api rtapi, string clientName) except +
@@ -923,14 +924,8 @@ cdef class MidiIn(MidiBase):
923924 buffer overflows.
924925
925926 **Windows note:** the Windows Multi Media API uses fixed size buffers
926- for the reception of sysex messages, whose number and size is set at
927- compile time. Sysex messages longer than the buffer size can not be
928- received properly when using the Windows Multi Media API.
929-
930- The default distribution of python-rtmidi sets the number of sysex
931- buffers to four and the size of each to 8192 bytes. To change these
932- values, edit the ``RT_SYSEX_BUFFER_COUNT`` and ``RT_SYSEX_BUFFER_SIZE``
933- preprocessor defines in ``RtMidi.cpp`` and recompile.
927+ for the reception of sysex messages. You can change the number and
928+ size of the buffers with the ``set_buffer_size`` method.
934929
935930 """
936931 self .thisptr.ignoreTypes(sysex, timing, active_sense)
@@ -960,6 +955,10 @@ cdef class MidiIn(MidiBase):
960955 self ._callback = (func, data)
961956 self .thisptr.setCallback(& _cb_func, < void * > self ._callback)
962957
958+ def set_buffer_size (self , size , count ):
959+ """ Set the size and number of MIDI input buffers."""
960+ self .thisptr.setBufferSize(size, count)
961+
963962
964963cdef class MidiOut(MidiBase):
965964 """ Midi output client interface.
0 commit comments