Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a FIFO class and use it to replace the code in bytestreamToUMP. #13

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

paulhuggett
Copy link
Contributor

@paulhuggett paulhuggett commented Jun 14, 2024

Whilst reading through the bytestreamToUMP code I realized that the readIndex, writeIndex, bufferLength, and umpMessage fields are used together to form a FIFO/circular buffer. I've added a FIFO class to util.h and replaced those fields with an instance. The separates the responsibility of maintaining the FIFO and simplifies the more interesting code!

This new class also reduces overhead for a 4 element container to 1 byte vs. 3 integers previously and has the further benefit that is guards against under/overflow abuses.

This commit only affects the FIFO in this one header file. There is another in umpToMIDI1Protocol.cpp which should probably be switched over. I haven't done that yet because I want to limit the scope of this change.

That only leaves the quesiton of how to unit-test the code... For this kind of thing I usually use google test. Do you have a preference for how this is done? What would you think about adding it as an optional dependency?

paulhuggett and others added 6 commits June 14, 2024 21:07
Replace the readIndex, writeIndex, bufferLength, and umpMessage fields
with a single FIFO instance. The separates the responsibility of
maintaining the FIFO and simplifies the more interesting code!

This commit only affects the FIFO in this one header file. There are
others that There are other ad-hoc FIFOs in the code base that can
also perhaps be switched over. I want to limit the scope of this
change for the time being.

That only leaves the quesiton of how to unit-test the code...
* fix bytestreamToUMP Program Change translate when using MT4
* fix bytestreamToUMP RPN/NRPN index translate when using MT4
* added braces in UMPStreamParse to avoid confusion
* added more test for MT4 Translation and PC and RPN
…fixed PE chunking issues

-Fixed a bug in midiCIProcessor::processMIDICI where checkMUID was called in a way that would always return FALSE
-Added PE Status compiler defs for convinience
-Fixed typo in documentation
-Small formatting fix
Remove incorrect Check MUID Check from PR
@paulhuggett paulhuggett marked this pull request as ready for review June 17, 2024 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants