Closed moonhouse closed 8 years ago
Hi @moonhouse
Thanks for the clear post and example, is very helpful
This is an issue of the documentation not being clear
The Input#gets method should not clear the buffer. It returns the messages in the buffer that have been received since the last call to Input#gets.
On the other hand, the _Input#getsbuffer method returns all of the messages in the buffer since either the program was initialized or the buffer was explicitly cleared with _Input#clearbuffer
I'll follow up with a change to improve the documentation
Changes here https://github.com/arirusso/unimidi/pull/40 and marking this resolved
Reading the documentation I get the impression that
#gets(*args)
should clear the buffer while#gets_buffer(*args)
doesn't clear the buffer since the documentation for the latter method mentionsHowever, when I use gets the buffer doesn't seem to be cleared.
gives the following output:
The buffer grows continously as more MIDI events come in despite being read by
#gets
. Since the documentation doesn't clearly state if the buffer should be cleared after calling the method but rather is implied by the description for#gets_buffer
I am not sure if this is just unclear documentation or unintended behavior.This is while running unimidi (0.4.6) on ruby 2.3.1p112 under Mac OS X Yosemite.