Using HakenMidi.h

I’ve started writing code against HakenMidi.h in C++, starting with the 10.44 version. There are few things I’ve observed.

  • (This is really trivial, noticeable to me given my work history in internationalization, and it tickles me to see odd details that reveal history and flavor to a project). HakenMidi.h is codepage 1252 - encoded. In this day and age, UTF-8 would be preferable. The only way I know it’s this encoding is that there are 2 characters in a comment that are not ASCII, like the entirety of the rest of the file. Line 400 in VSCode (which assumes UTF8) shows this by default:

    image

    Those question marks are curly quotes (if you change the encoding to codepage 1252).

  • There is one comment with a line continuation (a typo, I think) on line 291. What about that? Well, it generates a warning from GCC with -Wall. I try to keep my builds clean, so I had to turn off this warning with a global -Wno-comment, which I’d prefer not to do. I couldn’t figure out how to disable it for just this header in a portable way with 2 minutes of googling. (My work life was strictly MSVC, so GCC and Clang are fairly new). The particular case I’m working on is strictly GCC, I think – it’s a VCV Rack plugin, but I have future projects that I expect to be more portable.

  • This file defines a gigantic enum, so these are global symbols. I didn’t want all that in the global namespace, so I include it via a wrapper to namespace these symbols:

    // wrap-haken-midi.hpp
    #pragma once
    namespace Haken {
    #include "HakenMidi.h"
    }
    
1 Like