[yoshimi] Re: Numbers, numbers, numbers

  • From: Jesper Lloyd <jpl.lloyd@xxxxxxxxx>
  • To: yoshimi@xxxxxxxxxxxxx
  • Date: Sat, 28 Jul 2018 20:42:25 +0200

I really appreciate the effort to make the core interchange more readable,
previously it deterred me from pursuing some ideas about user interface
improvements.

2018-07-28 20:26 GMT+02:00 Will Godfrey <willgodfrey@xxxxxxxxxxxxxxx>:

This is probably only of interest to people looking at the code...

Up to now we've had huge blocks of 'magic' numbers in decision trees.
Although
not immediately obvious these followed a fairly logical pattern, with gaps
in
the sequences to allow for insertions while the whole system was being
developed. Although there are a few entries still missing, the overall
structure is now substantially complete.

Therefore (as was always intended) in the current 'master' the vast
majority of
these numbers have now been replaced by meaningful identifiers, and the
last few
stragglers will be done eventually.

The intention was then to collapse all the gaps to give more efficient
switch
statements. However in the intervening time several CLI users have been
using
the direct access method to reach controls that are not yet available
formally.
In view of this, I'll be leaving the actual values as they are until all of
them are properly addressable.

There is now a (self-descriptive) globals.h file where all these
definitions
are made (along with all the '#defines' that were previously in
CMakeLists.txt

The use of namespaces combined with typed enumerators not only gives clear
compartmentalised  identifiers, but also gives isolation between sections,
protecting against name clashes. It is also still compatible with integers
and
unsigned chars without needing typecasting. This is important, as all
these are
passed through ring buffers using the central CommandBlock structure -
which is
now also defined here.

--
Will J Godfrey
http://www.musically.me.uk
Say you have a poem and I have a tune.
Exchange them and we can both have a poem, a tune, and a song.
Yoshimi source code is available from either: https://sourceforge.net/
projects/yoshimi
Or: https://github.com/Yoshimi/yoshimi
Our list archive is at: https://www.freelists.org/archive/yoshimi
To post, email to yoshimi@xxxxxxxxxxxxx

Other related posts: